[Zope] getting contents of file into a variable

Bjørge Solli Bjørge Solli
Sat, 7 Sep 2002 12:08:04 +0200 (MEST)


How can I do this?

I try this way:
<dtml-let shovedid="SEMESTERID_HOVED" hovedid="str2int(shovedid)">
where SEMESTERID_HOVED contains one line of integers (20021).
str2int is an external python script just returning the int-cast of
whatever string it gets in.

Traceback (innermost last):
  File /export/space/Zope/Zope-2.4.x/lib/python/ZPublisher/Publish.py,
line 223, in publish_module
  File /export/space/Zope/Zope-2.4.x/lib/python/ZPublisher/Publish.py,
line 187, in publish
  File /space/Zope/Zope-2.4.x/lib/python/Zope/__init__.py, line 226, in
zpublisher_exception_hook
    (Object: fag)
  File /export/space/Zope/Zope-2.4.x/lib/python/ZPublisher/Publish.py,
line 171, in publish
  File /space/Zope/Zope-2.4.x/lib/python/ZPublisher/mapply.py, line 160,
in mapply
    (Object: lagKataloger_ogOppdater)
  File /export/space/Zope/Zope-2.4.x/lib/python/ZPublisher/Publish.py,
line 112, in call_object
    (Object: lagKataloger_ogOppdater)
  File /export/space/Zope/Zope-2.4.x/lib/python/OFS/DTMLMethod.py, line
200, in __call__
    (Object: lagKataloger_ogOppdater)
  File /space/Zope/Zope-2.4.x/lib/python/DocumentTemplate/DT_String.py,
line 546, in __call__
    (Object: lagKataloger_ogOppdater)
  File /export/space/Zope/Zope-2.4.x/lib/python/DocumentTemplate/DT_In.py,
line 770, in renderwob
    (Object: finnalt)
  File
/export/space/Zope/Zope-2.4.x/lib/python/DocumentTemplate/DT_With.py, line
148, in render
    (Object: _.getitem(kodeaar(aarid),1))
  File
/export/space/Zope/Zope-2.4.x/lib/python/DocumentTemplate/DT_With.py, line
148, in render
    (Object: _.getitem(kode,1))
  File
/export/space/Zope/Zope-2.4.x/lib/python/DocumentTemplate/DT_Let.py, line
147, in render
    (Object: shovedid=&quot;SEMESTERID_HOVED&quot;
hovedid=&quot;str2int(shovedid)&quot;)
  File
/export/space/Zope/Zope-2.4.x/lib/python/DocumentTemplate/DT_Util.py, line
231, in eval
    (Object: str2int(shovedid))
    (Info: shovedid)
  File &lt;string&gt;, line 2, in f
  File
/export/space/Zope/Zope-2.4.x/lib/python/Products/ExternalMethod/ExternalMethod.py,
line 274, in __call__
    (Object: str2int)
    (Info: ((&lt;DTMLMethod instance at 16eed80&gt;,), {}, None))
  File /export/space/Zope/zope/Extensions/str2int.py, line 2, in str2int
    (Object: SEMESTERID_HOVED)
AttributeError: (see above)

As you can see, it gets the object not the string the object is
containing. So how do I get the contents instead?

regards
Bjorge
-- 
http://www.ii.uib.no/~bjorge/smile/Smiles
--
Bjørge Solli - Universitas Bergensis, Norway
mailto:Bjorge@Kvarteret.no icq#29210281 MSN:bobelloco@hotmail.com
Møllendalsv.19, 5009 Bergen, Norway tel:+47 55202853/91614343