[Zope] HowTo Render txt-Files with LocalFS in PythonScript?

Elena Schulz elena.schulz@gmx.net
Mon, 5 Aug 2002 12:01:04 +0200


Dear List,

with the following PythonScript I try to render the content of txt-Files
with LocalFS according to the howto of LocalFS (...snip..." To insert the
text of the file after evaluating it as a DTML template in the current
namespace, you would use:  <dtml-var "test['foo.dtml'](_.None, _)">
.....snip ...").

My Script:

## Script (Python) "getContentFiles"
##bind container=container
##bind context=context
##bind namespace=_
##bind script=script
##bind subpath=traverse_subpath
##parameters=REQUEST=None,myLFSInstance
##title=

myLFS = getattr(context, myLFSInstance)
print myLFS['textfile.txt'](_.None,_)

but I get the below Error-Message. If I try:

print myLFS['textfile.txt'].data

the content is returned but without rendering (as expected).
Does anybody know how to get the rendering done?

Thanks a lot for your help,

Elena


Error-Message:

Error Type: AttributeError
Error Value: __call__:


Traceback (innermost last):
  File J:\Zope\ZopeSite\lib\python\ZPublisher\Publish.py, line 223, in
publish_module
  File J:\Zope\ZopeSite\lib\python\ZPublisher\Publish.py, line 187, in
publish
  File J:\Zope\ZopeSite\lib\python\Zope\__init__.py, line 226, in
zpublisher_exception_hook
    (Object: jobs)
  File J:\Zope\ZopeSite\lib\python\ZPublisher\Publish.py, line 171, in
publish
  File J:\Zope\ZopeSite\lib\python\ZPublisher\mapply.py, line 160, in mapply
    (Object: index.html)
  File J:\Zope\ZopeSite\lib\python\ZPublisher\Publish.py, line 112, in
call_object
    (Object: index.html)
  File J:\Zope\ZopeSite\lib\python\OFS\DTMLMethod.py, line 199, in __call__
    (Object: index.html)
  File J:\Zope\ZopeSite\lib\python\DocumentTemplate\DT_String.py, line 546,
in __call__
    (Object: index.html)
  File J:\Zope\ZopeSite\lib\python\OFS\DTMLMethod.py, line 192, in __call__
    (Object: inhalt)
  File J:\Zope\ZopeSite\lib\python\DocumentTemplate\DT_String.py, line 546,
in __call__
    (Object: inhalt)
  File J:\Zope\ZopeSite\lib\python\DocumentTemplate\DT_Util.py, line 231, in
eval
    (Object: getContentFiles(_.None,sourceFolder,contentFiles))
    (Info: getContentFiles)
  File <string>, line 2, in f
    (Object: guarded_getattr)
  File J:\Zope\ZopeSite\lib\python\Shared\DC\Scripts\Bindings.py, line 324,
in __call__
    (Object: getContentFiles)
  File J:\Zope\ZopeSite\lib\python\Shared\DC\Scripts\Bindings.py, line 354,
in _bindAndExec
    (Object: getContentFiles)
  File J:\Zope\ZopeSite\lib\python\Products\PythonScripts\PythonScript.py,
line 363, in _exec
    (Object: getContentFiles)
    (Info: ({'script': <PythonScript instance at 01F468C0>, 'context':
<Folder instance at 01F4D430>, 'container': <Folder instance at 01EF0530>,
'_': <TemplateDict object at 01EB1A30>, 'traverse_subpath': []}, (None,
'stxTexte', ['jobs.txt']), {}, (None, None)))
  File Script (Python), line 16, in getContentFiles
AttributeError: (see above)