Re: [Zope] string splitting in dtml

2000-12-06 Thread Jim Washington

Just a thought:

Have you tried using "_.str(thedate)" to convert it into a string?  I am
not using Access, but since Zope can handle the Access date stuff
properly, it may be using something like _.str() internally.  It's what
I would try first.

-- Jim Washington

"Spicklemire, Jerry" wrote:
> 
> 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
> >
> > 
> >
> > 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.

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




RE: [Zope] string splitting in dtml

2000-12-06 Thread Spicklemire, Jerry

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
> 
> 
> 
> 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.



___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] string splitting in dtml

2000-12-05 Thread Mike Kelland

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?  Or is there another reason
it's not working (I've tried it with my other varibles pulled from the
database in the same query and it's only the date types that are giving this
error, all other variables work fine)?

I also tried the



solution but got the error:

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

Thanks very much for everyone's help so far!
Mike Kelland
[EMAIL PROTECTED]

- Original Message -
From: "Spicklemire, Jerry" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, December 04, 2000 4:38 PM
Subject: [Zope] string splitting in dtml


> Mike asked:
>
> > I have a date string (ie dd/mm/yy) which I'm drawing out of a database
> > (ODBC connection to Access) with a Z SQL method and I need to use that
> > data to set the initial condition of a set of 3 select items (ie day,
> > month and year).  Is there a way to split this date (it'll come out
> > looking like dd/mm/yy) to get the components of it
>
> You could use the Python "string slice" syntax, like so:
>
>month_of_year="_['start_date'][3:5]"
>   year_of_century="_['start_date'][6:8]">
> The  day,
> of the  month,
> of the year 20
> 
>
> Later,
> Jerry S.
>
> ___
> Zope maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>
>


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] string splitting in dtml

2000-12-04 Thread Andy McKay



will be the 2nd element of the start_date, in this case mm
--
  Andy McKay, Developer.
  ActiveState.


- Original Message -
From: "Mike Kelland" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 04, 2000 1:14 PM
Subject: [Zope] string splitting in dtml


I have a date string (ie dd/mm/yy) which I'm drawing out of a database (ODBC
connection to Access) with a Z SQL method and I need to use that data to set
the initial condition of a set of 3 select items (ie day, month and year).
Is there a way to split this date (it'll come out looking like dd/mm/yy) to
get the components of it so that I can do:











??



Thanks!

Mike Kelland
[EMAIL PROTECTED]




___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )