TurboGears 2.1.1 released!

After a reflection moment caused by the need to think what will follow after the pylons and repoze.bfg merge in pyramid the TurboGears2 team has decide to gather up all its forces and give to TurboGears2 its own independent life. The first steps have been oriented to improve the framework reliability and brought to life the TurboGears continuous integrations system and a standard project release process. After a few months of work 2.1.1 has been released and it brings many fixes and improvements, 2.1.2 is under its way and a 2.2 release with major improvements is already planned! TG2 Core: * Fixed dependencies for Python 2.4. Now any packages that are needed are automatically installed. * Updated package requirements as […]

Mobile devices detection with TurboGears2

We just released tgext.mobilemiddleware for turbogears2 to make easier to handle templates for mobile devices and detect mobile devices requests. Indeed it is quite simple to use as it makes possible just to register a different template by using @expoe_mobile decorator which will be used for mobile devices, making possible to create mobile version of web page by using for example jquery mobile

Redis Remote Procedure Calls (RPC)

While I’m not sure if it is a good or really stupid idea I decided to start trying to implement a RPC library on the redis database. In theory it should be a good idea as you can have a very fast and persistent multi-consumer queue of tasks (like rabbit-mq or other AMQP) which can be worked out to also give answers back. Also using redis permits to quickly distribute work over multiple servers by simply running another server without any change to the code itself. If you want to check REPC (yes, this is the only name I have been able to think of…), you can take a look at https://github.com/amol-/repc Serialization format for data is JSON just because […]

Canvas CompositeOperation different behaviour on WebKit and Firefox

Recently while coding a game/scene library for Canvas I had the idea of implementing pixel perfect collision by using an offscreen canvas where to draw the two objects alone and check if they collide. This can be easilly done with the source-in/destination-in composite operation. If any pixel of the offscreen canvas if not white then the two objects collide. It seems a great idea, but I had a bad surprise when testing it on Chrome and Safari. Indeed it seems that source-in and destination-in have been differently intended on webkit. I find the Mozilla implementation more useful, but as the Canvas 2D specifications are written it is difficult to understand what they mean by Display the source image wherever both […]

Handling iOS out of memory warning for images in web applications

It seems that one of the main problems with websites on iPad when handling with a lot of images is the limited memory reserved for images. If you have a lot of big images you will start seeing white boxes instead of your pictures when viewing the site on the iPad. It seems somehow that Safari for iOS ignores the memory limit for background images, so you can consider substituting your img with divs with background-image to avoid hitting against the limit. This is also valid for iOS Applications that use UIWebView.

Fixing broken inline genshi tags on TG2.1

Turbogears 2.1 got a little issue with genshi templates being rendered as xml instead of xhtml. This causes the most various strange problems with tags nesting being closed in random points as the browser likes. This is caused by an improvement to the mechanism used to decide with rendering format to use that it is now based on the response content type. If your applications returns Content-Type text/xml or text/plain your templates will be rendered as xml or as plain text. But what happens with your application returns text/html which is the default case? Indeed in this case the application asks to your configuration file what to do, and as in your configuration file by default there isn’t any templating.genshi.method […]

Workaround for empty helpers in Turbogears 2.1

Last release of TG2.1 has a subtle bug due to the changes helpers management to support in pylons 1.0, this makes the “h” object appear as an empty dict instead of your application helpers module. The bug is already tracked on http://trac.turbogears.org/ticket/2488 and as the fix is quite easy it will be probably fixed soon. In the mean time you can work around it by monkey patching the pylons.templating.pylons_globals (I do it in lib/app_globals.py but any place is fine). import tg.render, pylons def patched_pylons_globals(): x = tg.render.my_pylons_globals() if x[’h’] == {}: conf = pylons.config._current_obj() x[’h’] = conf[’package’].lib.helpers return x pylons.templating.pylons_globals = patched_pylons_globals This will make your helpers work again in TG2.1. Please pay attention that this code is specific for […]