external python script populating items
Somhorst JJT <[email protected]> Mon, 2 May 2005 13:57:37 +0200
| Newsgroups | gmane.comp.web.zope.formulator.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi there all,
ive got a problem. In my extension I've got two forms. The first form is
presented ( and used ) when someone want to create an object. In a field i
have specified an external python script for populating the items list
(tuple). This does work perfectly. The dropdown is filled with values.
The second form is basicly the same but its function is to present the
information when a user wants to EDIT the object. When i try to edit
something my server stops and says:
AttributeError: Request
when i delete the python script from the tales part in both forms it works
again. My question is.. why does this happen? Because both python scripts
are the same and have the same output.
the contents of the script:
## Script (Python) "tuple"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
oldtuple= container.get_tree(0)
newtuple = [('-----', '0')]
i = 1
for a in oldtuple:
newtuple.append((a[1].get_title(), str(i)))
i = i+1
return newtuple
and the error log:
Traceback (innermost last):
Module ZPublisher.Publish, line 101, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 39, in call_object
Module Shared.DC.Scripts.Bindings, line 306, in __call__
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
Module Products.FileSystemSite.FSPageTemplate, line 191, in _exec
Module Products.FileSystemSite.FSPageTemplate, line 124, in pt_render
Module Products.PageTemplates.PageTemplate, line 96, in pt_render
- <FSPageTemplate at
/testroot/service_views/Silva/edit/VersionedContent/tab_edit used for
/testroot/service_views/Classroom/edit/VersionedContent/Classroom>
Module TAL.TALInterpreter, line 190, in __call__
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 407, in do_optTag_tal
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 671, in do_useMacro
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 409, in do_optTag_tal
Module TAL.TALInterpreter, line 394, in do_optTag
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 671, in do_useMacro
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 694, in do_defineSlot
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 409, in do_optTag_tal
Module TAL.TALInterpreter, line 394, in do_optTag
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 637, in do_condition
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 409, in do_optTag_tal
Module TAL.TALInterpreter, line 394, in do_optTag
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 694, in do_defineSlot
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 409, in do_optTag_tal
Module TAL.TALInterpreter, line 394, in do_optTag
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 569, in do_insertStructure_tal
Module Products.PageTemplates.TALES, line 221, in evaluate
- Line 18, Column 0
- Expression: standard:'view/edit'
- Names:
{'container': <DirectoryViewSurrogate instance at 025076E0>,
'context': <DirectoryViewSurrogate instance at 02507FB0>,
'default': <Products.PageTemplates.TALES.Default instance at
0x01716C38>,
'here': <DirectoryViewSurrogate instance at 02507FB0>,
'loop': <SafeMapping instance at 02BD8A50>,
'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter
instance at 0x0171CFD0>,
'nothing': None,
'options': {'args': ()},
'repeat': <SafeMapping instance at 02BD8A50>,
'request': <HTTPRequest,
URL=http://localhost:8080/testroot/01010/edit/index_html>,
'root': <Application instance at 02456230>,
'template': <FSPageTemplate at
/testroot/service_views/Silva/edit/VersionedContent/tab_edit used for
/testroot/service_views/Classroom/edit/VersionedContent/Classroom>,
'traverse_subpath': [],
'user': admin}
Module Products.PageTemplates.Expressions, line 172, in __call__
Module Products.PageTemplates.Expressions, line 167, in _eval
Module Products.PageTemplates.Expressions, line 66, in render
Module Products.PageTemplates.ZRPythonExpr, line 73, in call_with_ns
Module Products.FileSystemSite.FSPythonScript, line 99, in
__render_with_namespace__
Module Shared.DC.Scripts.Bindings, line 320, in __render_with_namespace__
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
Module Products.FileSystemSite.FSPythonScript, line 160, in _exec
Module None, line 13, in edit
- <FSPythonScript at
/testroot/service_views/Classroom/edit/VersionedContent/Classroom/edit>
- Line 13
Module Products.XMLWidgets.EditorService, line 358, in render
- __traceback_info__:
('service_custom_widgets_classroom/top/classroom/mode_normal',
<DirectoryViewSurrogate instance at 02ACE680>)
Module Shared.DC.Scripts.Bindings, line 306, in __call__
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
Module Products.FileSystemSite.FSPageTemplate, line 191, in _exec
Module Products.FileSystemSite.FSPageTemplate, line 124, in pt_render
Module Products.PageTemplates.PageTemplate, line 96, in pt_render
- <FSPageTemplate at
/testroot/service_custom_widgets_classroom/top/classroom/render used for
/testroot/service_custom_widgets_classroom/top/classroom/mode_normal>
Module TAL.TALInterpreter, line 190, in __call__
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 671, in do_useMacro
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 407, in do_optTag_tal
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 694, in do_defineSlot
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 407, in do_optTag_tal
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 407, in do_optTag_tal
Module TAL.TALInterpreter, line 389, in no_tag
Module TAL.TALInterpreter, line 234, in interpret
Module TAL.TALInterpreter, line 569, in do_insertStructure_tal
Module Products.PageTemplates.TALES, line 221, in evaluate
- Line 9, Column 2
- Expression: <PythonExpr helpers.get_ept_content(request.node,
here.service_editorsupport)>
- Names:
{'container': <DirectoryViewSurrogate instance at 02A0F590>,
'context': <DirectoryViewSurrogate instance at 02ACE680>,
'default': <Products.PageTemplates.TALES.Default instance at
0x01716C38>,
'here': <DirectoryViewSurrogate instance at 02ACE680>,
'loop': <SafeMapping instance at 02AB4B20>,
'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter
instance at 0x0171CFD0>,
'nothing': None,
'options': {'args': ()},
'repeat': <SafeMapping instance at 02AB4B20>,
'request': <HTTPRequest,
URL=http://localhost:8080/testroot/01010/edit/index_html>,
'root': <Application instance at 02456230>,
'template': <FSPageTemplate at
/testroot/service_custom_widgets_classroom/top/classroom/render used for
/testroot/service_custom_widgets_classroom/top/classroom/mode_normal>,
'traverse_subpath': [],
'user': admin}
Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
- __traceback_info__: helpers.get_ept_content(request.node,
here.service_editorsupport)
Module Python expression "helpers.get_ept_content(request.node,
here.service_editorsupport)", line 1, in <expression>
Module Products.SilvaCLASS.helpers, line 83, in get_ept_content
Module Products.SilvaCLASS.helpers, line 107, in load_content
Module Products.Formulator.Field, line 551, in __getitem__
Module Products.Formulator.Field, line 111, in get_value
AttributeError: REQUEST
Yours sincerely,
J.somhorst