News
Home Home Contact us Contact
home News Projects Tests Files Follow manatlan on Twitter Sign in
2009/08/21 15:44

jQuery on serverside with taconite

In my quest to find the better ajax method ;-). I'd found a way to send back multiple actions easily, using the jQuery Taconite plugin (thanks to rupert.lloyd's recipe, which gave me this idea)

Taken from taconite's website :

The jQuery Taconite Plugin allows you to easily make multiple DOM updates using the results of a single AJAX call. It processes an XML command document that contain instructions for updating the DOM.

On serverside, I had just created a simple class helper to build out the taconite xml format.

class jQuery(object):
    def __init__(self): self._x=[]

    def __getattr__(self,cmd):
        def _d(*args,**kargs):
            _p=lambda a: a.replace("&","&amp;").replace('"',"&quot;").replace('>',"&gt;").replace('<',"&lt;")
            assert len(args)>0
            if kargs: assert "content" in kargs

            if "content" in kargs: # element commands
                self._x.append(u"""<%s select="%s">%s</%s>""" % (cmd,_p(args[0]),kargs["content"],cmd))
            else:
                if cmd=="eval": #eval commands
                    self._x.append(u"<eval>\n<![CDATA[\n%s\n]]>\n</eval>" % args[0])
                else:   # non-element commands
                    a=[u'''%s="%s"'''%(k,_p(v)) for k,v in zip(["select","arg1","arg2","arg3","arg4"],args)]
                    self._x.append(u"""<%s %s/>""" % (cmd,u" ".join(a)))
        return _d

    def __repr__(self):
        return u"<taconite>\n%s\n</taconite>" % "\n".join(self._x)

Now, imagine a simple html page like this :

<html>
    <head>
        <script type="text/javascript" src="/static/jquery.js"></script>
        <script type="text/javascript" src="/static/jquery.taconite.js"></script>
    </head>
    <body>
        <div id="content"></div>
        <button onclick="$.get('ajax');">test</button>
    </body>
</html>

And this python handler on the serverside :

class AjaxHandler:
    def GET(self):
        self.header("Content-type","text/xml")
        j=jQuery()
        j.append("#content",content="hello.")
        j.attr("#content","style","border:2px dotted red")
        j.eval("alert();")
        return j

The html button test, will call the ajax url, which will answer by appending some content in the flow of div#content, by setting a border to div#content, and by evaluating the javascript code "alert()", on the clientside. (according to taconite commands like described here).

Nifty ;-)

Comments (View)
2009/08/18 20:05

New website for jbrout

jBrout has now a new official website. Currently it just contains the content of the old website (french & english content). But it will be easier to maintain, because it now uses GoogleAppEngine using the python language (as Jbrout) (TigerWiki is not supported anymore).

For now, it uses the jbrout news from my main website. So news are only available in "english". But, in the near future, french's news will be available too. You can subscribe to jbrout rss (french rss in the future), to stay tuned.

Comments (View) Tags: jbrout, gae
2009/08/17 08:46

I'm back, and jbrout can now share pictures with upnp/dlna

I'm back from holidays and I had just added a new plugin to jBrout, to be able to share pictures thru upnp/dlna devices (upnp av). It works only on *nix platforms, because it uses the marvellous ushare, which is available on all good platforms ;-). So I can watch my recent pictures on the TV in my sofa, thru the wonderful freebox mediaplayer which is a UPNP AV compliant device ;-). Sweet.

Comments (View) Tags: jbrout
2009/07/20 11:11

Playing with the (Google)Wave

I like this thing. I had changed the purpose of my robot maison@appspot.com. Now, when added to a wave as a participant, it will post all blips on http://maison.appspot.com ;-) So blips are now really public ... and can be seen by the rest of the world ;-).

Perhaps you will fall in love on what's happening in GoogleWave. A lot of interesting discussions ;-).

It's just a kind of concept, for fun purpose only !

Comments (View) Tags: wave
2009/07/19 18:14

Surfing the (google)wave

Amazing ... Today I had received my google wave account, and started to play with wavelets, blips and all these newer things ;-). Really amazing. I really think that it could be the next big thing in the social/communication side of the web.

It takes me one hour to developp a robot (maison@appspot.com) which replace the word 'fuck' by 'f**k' in all the blips of a wave ... amazing. (Edit : my robot has generated a lot of blips in a wave (wavesandbox.com!w+UyA_PnlT%A) yesterday night ... really funny)

Now, I can't really think all things that could be available in a such system. But as always: APIs from google are just perfects ... they fit my brain. Every thing can be done using python and GAE : just perfect.

EDIT : A really good introduction to present what google wave is (in french)

Comments (View) Tags: wave
2009/07/18 13:04

Big changes in manatlan.com ;-)

Apparently nothing has changed (may be some disturbance now). But a lot of changes was made. I had just migrate all files+models from one appspot-id to another one (At the beginning I couldn't choose "manatlan" as appspot-id ?! Now it works ?!). Files were easily migrated (thanks to gae). But models were more complex, thanks to AEX, it helps me a lot ;-)

BTW, flux.manatlan.com was a subdomain of my old appspot-id (it was very dependant on this website). Now it has its own appspot-id and works alone (with its own cron, taskqueue, and own quotas). It's in beta stage now (use at your own risks).

So, this is the first post (a test ;-)) on my new appspot-id.

Comments (View) Tags: aex, gae
2009/06/29 21:08

Plugin flux 0.2 for totem

Just a line, for those who follow my rss for the totem's plugin flux. Here is a new release : more stable, with a progress bar for long process and RFI podcasts too !

Comments (View)
2009/06/16 21:37

Just released a plugin for totem : "flux"

After my preceding post, I'd started a new/better totem plugin called flux. In fact, it's a plugin which is plugin'able and provides a lot of features in one plugin. Mainly easy access to live streams, to rss/atom videos/youtube/dailymotion, to audios and videos of well-known french podcasts (canal+/radios). Sure, this plugin is mainly for french people, so the page is in french language. It's the initial public release, but I use it for long times now ;-). Hope it will enjoy french people, like me ;-)

UPDATE 2009/06/29 : just released 0.2 version ;-)

Comments (View)
2009/05/02 12:26

Some plugins for totem player

Today, I've played with totem and its plugins. I have seen that they can be done in python/gtk. After hacking an existing one, I've built 2 plugins (in a very short time, less than 30 minutes). The first one is for listening some popular french radios. The second is for watching some streams of canal+, the 'zapping'.

I think I will made them better in the near future because it's easy and fun to develop them. I had never liked totem before, but it's pretty cool to let users(developers) improve it with plugins.

UPDATE 2009/06/16 : Now, these plugins are discontinuited. You should find them in a better totem plugin, named flux

Comments (View)
2009/04/21 17:17

A simple tool to send files thru http

Just a post to tell that I've added a simple tool to share files with friends : yserv ! In fact, I use it for many years, and I really think it can be useful for someone else.

In my case, I use it to send files/folders when I am on instant messaging services. I just drag'n'drop files on my shorcut, and my computer act as an httpserver letting my friends download the files. When they finish, I just quit the tool. It's very handy to send files in live. It's a kind of instant-serving.

Hope it could help someone too.

More infos

UPDATE 2009/05/01 Now, yserv is in pypi

Comments (View)
<< oldest newest >>

Tags

RSS Python Powered Get Ubuntu
©opyleft 2008-2019 - manatlan