[Zope] string splitting in dtml
Spicklemire, Jerry
Jerry.Spicklemire@IFLYATA.COM
Wed, 6 Dec 2000 09:57:29 -0500
Mike said:
> I tried what you recommended and got the following error:
>
> Error Type: AttributeError
> Error Value: __getslice__
>
> The problem I think is that the variable is drawn from the database as
type
> date (Microsoft Access 2k) and somehow is cast into a date type. Is there
a
> way to re-cast this variable as a string type?
You're right, it's not really a string, even though Zope is smart enough
to render it into one when inserting it directly into HTML.
> I also tried the
>
> <dtml-var "_.string.split(start_date, '/')[1]">
>
> solution but got the error:
>
> Error Type: TypeError
> Error Value: argument 1: expected read-only character buffer, instance
found
Now if only Zope were smart enough to tel us what it "really" is,
so we could transform it!
It looks like MS Access delivers dates as some proprietary object type.
However, in your query, you may be able to wrap the date field like so:
to_char(dateFieldName)
to convince MS Access to return a formatted string instead.
Once you can see what the string looks like, the slicing bit
should work.
Good Luck!
Jerry S.