Re: TwForms 0.9.1 Mako LookupException

0 views
Skip to first unread message

Alberto Valverde

unread,
Jun 22, 2008, 1:47:54 PM6/22/08
to Luke, toscawidge...@googlegroups.com
Luke wrote:
> Hi,
> (I tried to post this once already, it didn't seem to take, so here it
> is again)
>
> After upgrading our app to tw 0.9.2/tw.forms 0.9.1 following Alberto's
> upgrade instructions, I started receiving:
> TopLevelLookupException: Cant locate template for uri '/tw/forms/
> templates/list_form.mak'
>
> on all my locations using tw.forms.
>
> After bumbling around for hours I finally hit on the theory that it
> was tw.forms change to a zipped distribution, and sure enough
> unzipping it resolves this. So, I assume that something along the
> lines of
> http://peak.telecommunity.com/DevCenter/PythonEggs#accessing-package-resources
>
> needs to be implemented somewhere?
>
(just read this in the moderation queue after posting a reply to your
previous email, please ignore it)

My fault, I've never tested tw.forms' mako templates from a zipped egg
so this bug slipped by since Genshi seems to be able to load templates
from them with no problems. Mako's buffet plugin or template loader
would need to be patched to support reading templates from zipped eggs
so widget eggs containing mako templates can be zipped.

For the meantime, I've turned off the zip_safe flag from setup.py.

Thanks for spotting it!
Alberto

Luke

unread,
Jul 10, 2008, 8:25:15 PM7/10/08
to ToscaWidgets-discuss


On Jun 22, 10:47 am, Alberto Valverde <albe...@toscat.net> wrote:
> Luke wrote:
> > Hi,
> > (I tried to post this once already, it didn't seem to take, so here it
> > is again)
>
> > After upgrading our app to tw 0.9.2/tw.forms 0.9.1 following Alberto's
> > upgrade instructions, I started receiving:
> > TopLevelLookupException: Cant locate template for uri '/tw/forms/
> > templates/list_form.mak'
>
> > on all my locations using tw.forms.
>
> > After bumbling around for hours I finally hit on the theory that it
> > was tw.forms change to a zipped distribution, and sure enough
> > unzipping it resolves this.  So, I assume that something along the
> > lines of
> >http://peak.telecommunity.com/DevCenter/PythonEggs#accessing-package-...
>
> > needs to be implemented somewhere?
>
> (just read this in the moderation queue after posting a reply to your
> previous email, please ignore it)
>
> My fault, I've never tested tw.forms' mako templates from a zipped egg
> so this bug slipped by since Genshi seems to be able to load templates
> from them with no problems. Mako's buffet plugin or template loader
> would need to be patched to support reading templates from zipped eggs
> so widget eggs containing mako templates can be zipped.
>
> For the meantime, I've turned off the zip_safe flag from setup.py.
Hi Alberto,
I've upgraded a couple more machines to tw.forms 0.9.1 and the .egg
still seems to show up zipped (so I have to manually unzip it to make
things work). Was your fix supposed to install it as a regular
directory again or did I misunderstand?
Best
Luke

Alberto Valverde

unread,
Jul 11, 2008, 8:28:25 AM7/11/08
to toscawidge...@googlegroups.com

Hi Luke,

I haven't made a release yet that includes the fix (will try to do shortly
but can't promise anything since I'm in semi-crunch mode right now until
tuesday).

You can, however, pull the develepment snapshot (works without mercurial
too):

easy_install tw.forms==dev

If you want to list this requirement in setup.py so easy_install does it's
magic then write something like this in your project's setup.py:

install_requires = [
"tw.forms >= 0.9.2dev_20080711, ==dev",
]

That will tell setuptools to install a development snapshot from today (or
tomorrow...) if it hasn't got it already. tw.forms metadata is properly
registered at pypi so that easy_install finds TW's repositories and
requests a zip archive from there.

BTW, those of you who host packages at tw.org: make sure you list
'http://toscawidgets.org/download/' at your packages setup.py
"download_url" key if you want your users to be able to download dev.
snapshots.

You might see some problems related to a corrupted zip header or something
like that (I sometimes get this error when updating/reinstalling zipped
packages). In this case, remove the old tw.forms egg from site-packages
and try updating again.

Alberto

Reply all
Reply to author
Forward
0 new messages