Re: [Zope] dtml-calendar question (still not working)

2000-08-04 Thread tom smith

This message is about how to use dtml-calendar to get it's data out of an
odbc database

on 3/8/00 5:35 pm, R. David Murray at [EMAIL PROTECTED] wrote:

 On Thu, 3 Aug 2000, tom smith wrote:
 I'm still getting allsorts of errors. My code is like this...
 
 dtml-let yearnr="date.yy()" monthnr="date.mm()" daynr="date.dd()"
 dtml-let startDateString="monthnr+'/'+daynr+'/'+yearnr"
 
 
 dtml-in expr="get_days_events(startDateString)"
 dtml-var EventName
 /dtml-in
 
 /dtml-let
 
 /dtml-let
 
 I'm having trouble passing StartDateString to get_days_events. If I look at
 StartDateString using dtml-var startDateString it looks OK.
 
 What kind of errors?

I get

Zope has encountered an error while publishing this resource.

Error Type: Bad Request
Error Value: ['startDateString']

the get_days_events() sql function looks like this...

SELECT * FROM tblCalendar
WHERE
(startDate ='dtml-var startDateString 23:59:00'
AND endDate = 'dtml-var startDateString 00:00:00')
OR 
(startDate = 'dtml-var startDateString 00:00:00'
AND startDate = 'dtml-var startDateString  23:59:00')
ORDER BY startDate

with startDateString entered into the arguments field

I know the sql is a bit ugly but it's what I'm stuck with
:-|


I tried using dtml-sqlvar but it wrapped quotes around my date which also
needs the time to 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] dtml-calendar question (I GOT IT!!!!!!!!)

2000-08-04 Thread tom smith

My problem was with passing the arguments around

I used ...

 dtml-in "get_days_events(startDateString=startDateString)"
 dtml-var namebr
/dtml-in

notice the startDateString=StartDateString...which I thought the dtml-let
would've handled, anywaythis seems to have fixed it

can anyone tell me why?

cheers

tom


___
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] dtml-calendar question (I GOT IT!!!!!!!!)

2000-08-04 Thread R. David Murray

On Fri, 4 Aug 2000, tom smith wrote:
 notice the startDateString=StartDateString...which I thought the dtml-let
 would've handled, anywaythis seems to have fixed it
 
 can anyone tell me why?

ZSQL methods do not pick variables up out of the name space because
the possability of unintended collision with database variables is
considered too high.  So ZSQL forces you to be fairly explicit
about which variables you are passing.

--RDM


___
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] dtml-calendar question.

2000-08-03 Thread Chris Withers

"R. David Murray" wrote:
 
 On Thu, 3 Aug 2000, Andrew Kenneth Milton wrote:
  | Well, yeah.  A restricted python environment.  The point being, it follows
  | python syntax rules grin.
 
  kind of... :-)
 
 In what way does it *not* follow Python (expression) syntax rules?

_['something'] doesn't just return the value from the dictionary which
has the 'something' key, if it's callable, it'll try to call it and then
return that... not nice :(

If you want to be safe, use _.getitem('something',0)...

cheers,

Chris

___
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] dtml-calendar question (still not working)

2000-08-03 Thread tom smith

on 3/8/00 10:14 am, Chris Withers at [EMAIL PROTECTED] wrote:

 "R. David Murray" wrote:
 
 On Thu, 3 Aug 2000, Andrew Kenneth Milton wrote:
 | Well, yeah.  A restricted python environment.  The point being, it follows
 | python syntax rules grin.
 
 kind of... :-)
 
 In what way does it *not* follow Python (expression) syntax rules?
 
 _['something'] doesn't just return the value from the dictionary which
 has the 'something' key, if it's callable, it'll try to call it and then
 return that... not nice :(
 
 If you want to be safe, use _.getitem('something',0)...

I'm still getting allsorts of errors. My code is like this...

dtml-let yearnr="date.yy()" monthnr="date.mm()" daynr="date.dd()"
dtml-let startDateString="monthnr+'/'+daynr+'/'+yearnr"


dtml-in expr="get_days_events(startDateString)"
dtml-var EventName
/dtml-in

/dtml-let

/dtml-let

I'm having trouble passing StartDateString to get_days_events. If I look at
StartDateString using dtml-var startDateString it looks OK.

one last attempt anyone?

cheers

tom


___
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] dtml-calendar question.

2000-08-03 Thread R. David Murray

On Thu, 3 Aug 2000, Chris Withers wrote:
  In what way does it *not* follow Python (expression) syntax rules?
 
 _['something'] doesn't just return the value from the dictionary which
 has the 'something' key, if it's callable, it'll try to call it and then
 return that... not nice :(
 
 If you want to be safe, use _.getitem('something',0)...

True enough, that's a somewhat weird semantic, but it's still
following python *syntax* rules grin.

--RDM



___
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] dtml-calendar question (still not working)

2000-08-03 Thread R. David Murray

On Thu, 3 Aug 2000, tom smith wrote:
 I'm still getting allsorts of errors. My code is like this...
 
 dtml-let yearnr="date.yy()" monthnr="date.mm()" daynr="date.dd()"
 dtml-let startDateString="monthnr+'/'+daynr+'/'+yearnr"
 
 
 dtml-in expr="get_days_events(startDateString)"
 dtml-var EventName
 /dtml-in
 
 /dtml-let
 
 /dtml-let
 
 I'm having trouble passing StartDateString to get_days_events. If I look at
 StartDateString using dtml-var startDateString it looks OK.

What kind of errors? 

--RDM


___
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] dtml-calendar question.

2000-08-02 Thread R. David Murray

On Sat, 12 Aug 2000, tom smith wrote:
 dtml-in get_days_events(dtml-var "date.mm()"/dtml-var
 "date.dd()"/dtml-var "date.yy()")

Untested:

dtml-in expr="get_days_events('%s/%s/%' % (date.mm(),date.dd(),date.yy())"

Inside the quotes you are in Python...

--RDM


___
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] dtml-calendar question.

2000-08-02 Thread Andrew Kenneth Milton

+[ R. David Murray ]-
| On Sat, 12 Aug 2000, tom smith wrote:
|  dtml-in get_days_events(dtml-var "date.mm()"/dtml-var
|  "date.dd()"/dtml-var "date.yy()")
| 
| Untested:
| 
| dtml-in expr="get_days_events('%s/%s/%' % (date.mm(),date.dd(),date.yy())"
| 
| Inside the quotes you are in Python...

kind of...

-- 
Totally Holistic Enterprises Internet|  P:+61 7 3870 0066   | Andrew Milton
The Internet (Aust) Pty Ltd  |  F:+61 7 3870 4477   | 
ACN: 082 081 472 ABN: 83 082 081 472 |  M:+61 416 022 411   | Carpe Daemon
PO Box 837 Indooroopilly QLD 4068|[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 )




Re: [Zope] dtml-calendar question.

2000-08-02 Thread R. David Murray

On Thu, 3 Aug 2000, Andrew Kenneth Milton wrote:
 | Untested:
 | 
 | dtml-in expr="get_days_events('%s/%s/%' % (date.mm(),date.dd(),date.yy())"
 | 
 | Inside the quotes you are in Python...
 
 kind of...

Well, yeah.  A restricted python environment.  The point being, it follows
python syntax rules grin.

I see I made a typo: '%s/%s/%s'.

--RDM


___
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] dtml-calendar question.

2000-08-02 Thread Andrew Kenneth Milton

+[ R. David Murray ]-
| On Thu, 3 Aug 2000, Andrew Kenneth Milton wrote:
|  | Untested:
|  | 
|  | dtml-in expr="get_days_events('%s/%s/%' % (date.mm(),date.dd(),date.yy())"
|  | 
|  | Inside the quotes you are in Python...
|  
|  kind of...
| 
| Well, yeah.  A restricted python environment.  The point being, it follows
| python syntax rules grin.

kind of... :-)

-- 
Totally Holistic Enterprises Internet|  P:+61 7 3870 0066   | Andrew Milton
The Internet (Aust) Pty Ltd  |  F:+61 7 3870 4477   | 
ACN: 082 081 472 ABN: 83 082 081 472 |  M:+61 416 022 411   | Carpe Daemon
PO Box 837 Indooroopilly QLD 4068|[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 )




Re: [Zope] dtml-calendar question.

2000-08-02 Thread R. David Murray

On Thu, 3 Aug 2000, Andrew Kenneth Milton wrote:
 | Well, yeah.  A restricted python environment.  The point being, it follows
 | python syntax rules grin.
 
 kind of... :-)

In what way does it *not* follow Python (expression) syntax rules?

--RDM


___
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 )