On Thu, June 1, 2006 18:08, Jonathan wrote:
>
> ----- Original Message -----
> From: "Jürgen Herrmann" <[EMAIL PROTECTED]>
> To: <zope@zope.org>
> Sent: Thursday, June 01, 2006 11:51 AM
> Subject: [Zope] global name 'context' not defined in TrustedFSPageTemplate
>
>
>> hi!
>>
>> i get the following error in one of my trusted page template files:
>>
>> Traceback (innermost last):
>>    * Module ZPublisher.Publish, line 113, in publish
>>    * Module ZPublisher.mapply, line 88, in mapply
>>    * Module ZPublisher.Publish, line 40, in call_object
>>    * Module Shared.DC.Scripts.Bindings, line 311, in __call__
>>    * Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
>>    * Module Products.CMFCore.FSPageTemplate, line 195, in _exec
>>    * Module Products.TrustedExecutables.TrustedFSPageTemplate, line 31, in
>> pt_render
>>    * Module Products.PageTemplates.PageTemplate, line 104, in pt_render
>>      <TrustedFSPageTemplate at /bliss/BlissCalendar/show_content_week>
>>    * Module TAL.TALInterpreter, line 238, in __call__
>>    * Module TAL.TALInterpreter, line 281, in interpret
>>    * Module TAL.TALInterpreter, line 507, in do_setLocal_tal
>>    * Module Products.PageTemplates.TALES, line 221, in evaluate
>>      URL:
>> file:/home/bliss/zope/Products/BlissCalendar/www/BlissCalendar/show_content_week.xpt
>>      Line 3, Column 0
>>      Expression: <PythonExpr dates.sort(lambda a,b:
>> cmp(context.utils.text2date(a),
>> context.utils.text2date(b)))>
>>      Names:
>>
>>      {'container': <BlissCalendar at /bliss/BlissCalendar>,
>>       'context': <BlissCalendar at /bliss/BlissCalendar>,
>>       'default': <Products.PageTemplates.TALES.Default instance at
>> 0xb703850c>,
>>       'here': <BlissCalendar at /bliss/BlissCalendar>,
>>       'loop': <Products.PageTemplates.TALES.SafeMapping object at
>> 0xb5d9426c>,
>>       'modules':
>> <Products.TrustedExecutables.TrustedExpression._ModuleImporter instance at
>> 0xb6fa1b8c>,
>>       'nothing': None,
>>       'options': {'args': ()},
>>       'repeat': <Products.PageTemplates.TALES.SafeMapping object at
>> 0xb5d9426c>,
>>       'request': <HTTPRequest,
>> URL=https://bliss.local/BlissCalendar/show_content_week>,
>>       'root': <Application at >,
>>       'template': <TrustedFSPageTemplate at
>> /bliss/BlissCalendar/show_content_week>,
>>       'traverse_subpath': [],
>>       'user': <User at /bliss/data/Users/instances/juherm00 used for
>> /bliss/acl_users>}
>>
>>    * Module Products.PageTemplates.PythonExpr, line 70, in __call__
>>      __traceback_info__: dates.sort(lambda a,b:
>> cmp(context.utils.text2date(a),
>> context.utils.text2date(b)))
>>    * Module <string>, line 2, in f
>>    * Module <string>, line 2, in <lambda>
>>
>> NameError: global name 'context' is not defined
>
> Just a guess (the python gurus could answer this for sure), but lambda
> functions have access to variables in the containing scope, which in your
> case is the date.sort function.  Does date.sort provide access to 'context'?
>
> A quick test would be to get rid of the lambda function and create a named
> function and see if that works.
>
i have to add that this was a "normal" page template file before, just
converted i to a trusted one. in the "normal" page template file this
expression just worked.

i'll dig a bit deeper tomorrow if nothing comes up here.
going home now, my brain refuses to think any longer.

regards, juergen
_______________________________________________________________________

>> XLhost.de - eXperts in Linux hosting <<

Jürgen Herrmann
Bruderwöhrdstraße 15b, DE-93051 Regensburg

Fon:  +49 (0)700 XLHOSTDE [0700 95467833]
Fax:  +49 (0)721 151 463027
WEB:  http://www.XLhost.de
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to