[Zope] Interbase and Date datatype

Michael Schulz mschulz@webgis.de
Fri, 13 Jul 2001 12:33:29 +0200


Dear List,

i am using zope2.3.1, python 1.5.2 and interbase adapter gvibda096.

I am accessing an interbase DATE type column via a zsql-method and want
to reformat the returned date (yyyy/mm/dd), but i can't figure out how?
I tried without success:


1.) <dtml-var "_.DateTime(_['gueltig_von'])"></td>
Error: AttributeError

2.) <dtml-var "gueltig_von.strftime('%d.%m.%Y')">
Error:
  File /usr/local/Zope-2.3.1-src/lib/python/DocumentTemplate/DT_Util.py,
line 334, in eval
    (Object: gueltig_von.strftime('%d.%m.%Y'))
    (Info: gueltig_von)
  File <string>, line 0, in ?
  File /usr/local/Zope-2.3.1-src/lib/python/DocumentTemplate/DT_Util.py,
line 127, in careful_getattr
AttributeError: (see above)

3.) With this script:
|#create_date(datum_string)
| from string import split, join
| list_date = split(datum_string,"/")
| return list_date[2]+"."+list_date[1]+"."+list_date[0]

<dtml-var "create_date(datum=_['gueltig_von'])">

Error Type: TypeError
Error Value: argument 1: expected read-only character buffer, instance
found

  File
/usr/local/Zope-2.3.1-src/lib/python/Products/PythonScripts/PythonScript.py,
line 336, in _exec
    (Object: create_date)
    (Info: ({'script': <PythonScript instance at 8cdc120>, 'context': <r
instance at 8add6e8>, 'container': <Folder instance at 8cdbb98>,
'traverse_subpath': []}, (), {'datum': <Products.gvibDA.gvib.gvib.Date
instance at 8cff7b8>}, None))
  File Script (Python), line 5, in create_date
TypeError: (see above)

Could anybody think of another method to reformat the column values or
has this problem to do with gvibda?

TIA, Michael

--
-------------------------------------------------------------
Michael Schulz
in medias res GmbH, D-79100 Freiburg