[Zope] PythonScript question

Michel Pelletier michel@digicool.com
Sun, 28 Jan 2001 10:57:47 -0800 (PST)


On Sat, 27 Jan 2001, Timothy Wilson wrote:

> Hi everyone,
>
> I'm using the Photo product to diplay some pictures at various resolutions
> and to display them on a certain date. (Some may recall my questions about a
> "Picture of the day" recently.) I want to set a 'display_date' property for
> each Photo instance and I'd like to do it using a PythonScript. I've created
> a form and PythonScript, but I get this error:
>
> Error Type: TypeError
> Error Value: argument 1: expected read-only character buffer, instance found
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This Error Value is your first clue...


>   File Script (Python), line 8, in POTD_add
> TypeError: (see above)
>
> Here's the relevant part of the form:
>
>  <th align="right">Display Date</th>
>  <td><input name="display_date:date" size="20" value=""></td>
                    ^^^^^^^^^^^^^^^^^
display_date is a DateTime object.


> And here's my PythonScript 'POTD_add' to which I pass the parameter list
> 'title, display_date, and file':
>
> """
> Create a "Picture of the Day" image.
> """
> import string
>
> # create a unique object id based on the display date
> newID = string.split(display_date, '/')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You're trying to split a date object like a string.


-Michel