Re: [Zope] Zope with Microsoft Access

2000-11-24 Thread Mike Kelland

Hrm... I've tried what you said, but  it still fails to work...

Is there a Zope guru out there who is willing to look over this code in it
entirety (ie the DTML and the ZSQL Method) and work with me directly to try
to get this working?

Thanks,
Mike
[EMAIL PROTECTED]

- Original Message -
From: "Chris Gray" [EMAIL PROTECTED]
To: "Mike Kelland" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, November 23, 2000 3:56 PM
Subject: Re: [Zope] Zope with Microsoft Access


 Here's a fix.  Change the line:

 dtml-call UpdateHours(REQUEST)

 to:

 dtml-call "UpdateHours(myval=_['myval'], mykey=_['mykey'],
 sequence_item=_['sequence-item'])"

 and change the name of the parameter in your ZSQL method from
 sequence-item to sequence_item and change the dtml-var tag in the method
 to dtml-var sequence_item.

 Cheers,
 Chris

 On Wed, 22 Nov 2000, Mike Kelland wrote:

  What does dtml-var "0/0" actually do?  Looks like all it would do is
  divide by zero which *has* to be some kind of error.  The problem, I
think,
  lies mainly in the arguments being passed to UpdateHours.  I have done a
  whole slew of tests to show that my if statement works perfectly (the
  _.string.find thing seems to return false if it finds the specified sub
  string which is odd, but works) and I've actually outputted the correct
SQL
  in the DTML (ie displayed it within the page) and I've copied and pasted
  that SQL directly into a ZSQL Method and ran it on my database and that
  works fine.  However it seems to do absolutly nothing when I actually
  attempt to run everything together and call UpdateHours from the DTML
  document.  I've played a little with namespace as well, but as I said,
I'm
  new to all this so there may be an error there.
 
  Thanks for everyone's insight so far, it's really helpful, and please
keep
  those suggestions coming! : )
 
  Mike Kelland
  [EMAIL PROTECTED]
 
  - Original Message -
  From: "[EMAIL PROTECTED]" [EMAIL PROTECTED]
  To: "Mike Kelland" [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Wednesday, November 22, 2000 8:48 PM
  Subject: Re: [Zope] Zope with Microsoft Access
 
 
   You may not be entering UpdateHours.
  
   Try dtml-var "0/0" just before the call to UpdateHours.
   Or some other obvious way to know if your entering it.
  
   Here's how I coded the same kind of thing.
   Although I'm reading the Zope book right now to see how I should have
done
   it.
   The book is good and I might just learn a better solution than 0/0 :)
  
   --- Part of addContact
   form action="insertNewContactForm" method="get"
   table
   trtdName:/tdtdinput type="text" name="name" /td/tr
   trtdTitle:/tdtdinput type="text" name="title"/td/tr
   trtdPhone:/tdtdinput type="text" name="phone"/td/tr
   /table
   tabletr
   tdinput type="submit" name="cmd" value="Insert"/td
   tdinput type="submit" name="cmd" value="Update"/td
   tdinput type="submit" name="cmd" value="Delete"/td
   tdinput type="submit" name="cmd" value="Clear"/td
   /tr/table
   /form
  
   ---insertNewContactForm
   dtml-if expr="_.len(name)  0"
dtml-if expr="cmd=='Insert'"
  dtml-var insertNewContact
dtml-elif expr="cmd=='Delete'"
 dtml-call deleteWhere
dtml-elif expr="cmd=='Update'"
 dtml-call updateWhere
dtml-elif expr="cmd=='Clear'"
/dtml-if
   /dtml-if
   dtml-var "RESPONSE.redirect('addContact')"
  
   --Darrell
  
  
   ___
   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 )
 



 ___
 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] Zope with Microsoft Access

2000-11-24 Thread Rik Hoekstra


 Hi, this is my first posting to the list, and about my 4th day working
with
 Zope.  I have a bit of a problem.  All my code so far is working well.
Just
 the following section is defying my attempts to make it run.  What it does
 is to update a field in the database (to allow employees to quickly update
 their hours in the hours tracking thing I'm creating)  it's complex since
 all the employees hours will be listed on one page and will be instantly
 updatable (with a select box that allows the choice of +/- (name is
 modifydtml-var hoursID and value is either + hours already input or -
 hours already input) and a text field for entering hours to add or
 subtract (name is mod_hoursdtml-var hoursID)).

 The code (in the DTML document) is:

 dtml-in "REQUEST.form.items()"
 dtml-if "_.string.find(_['sequence-key'], 'mod_hours')"
 dtml-else
 dtml-let mykey=sequence-key myval=sequence-item
 dtml-in "REQUEST.form.items()"
 dtml-if "_.string.find(_['sequence-key'], 'modify')"
 dtml-else
 dtml-if "_['sequence-key'][6:9] == mykey[9:12]"
 dtml-if myval
 dtml-call UpdateHours(REQUEST)
 /dtml-if
 /dtml-if

 /dtml-if
 /dtml-in

 /dtml-let
 /dtml-if
 /dtml-in

 and the SQL method UpdateHours is:

 update emp_hours set hours =
 dtml-var expr="_['sequence-item']"
 dtml-var expr="_['myval']"
 where
 hoursID = dtml-var expr="_['mykey'][9:12]";

 with arguments: sequence-item, myval, mykey

 I've tried everything I can think of but it not only refuses to do
anything,
 it also refuses to raise an error.

 If anyone can help out I'd be very grateful.


This seems to be more of a DTML problem than an Access problem. It is hard
to follow anyway...
A few questions: have you tried using something like changing the form names
to using the name.item:records syntax. something like

input type="checkbox" name="modify.dtml-var hoursID:records" value="+"
input type="checkbox" name="modify.dtml-var hoursID:records" value="-"
input type="hidden" name="modify.inputhrs:records" value="hours already
input"
and a text field for entering hours to add or
input type= "text"  name="modify.mod_hours:records" value="dtml-var
hoursID"

this will give your dtml method a dictionary like structure called modify
you can loop over.

Starting from there will save you a whole lot of hacking. Also I'm not at
all sure that you can use the [sequenct-key] as arguments for your SQL
Method.

On the records and types in forms see:
http://www.zope.org/Members/Zen/howto/FormVariableTypes

hth

Rik


___
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] Zope with Microsoft Access

2000-11-24 Thread Mike Kelland

I actually have this up and running now (as of about 5 minutes ago).  It's a
hack but it works great so I'm not going to mess with it.

Thanks a lot to everyone who gave me pointers, most especially Chris Gray
whose solution fixed it in the end.

Now I need a way of implementing Apache style authentication.  Is there an
easy way to do this?

Thanks!
Mike
[EMAIL PROTECTED]
- Original Message -
From: "Rik Hoekstra" [EMAIL PROTECTED]
To: "Mike Kelland" [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, November 24, 2000 12:21 PM
Subject: Re: [Zope] Zope with Microsoft Access



  Hi, this is my first posting to the list, and about my 4th day working
 with
  Zope.  I have a bit of a problem.  All my code so far is working well.
 Just
  the following section is defying my attempts to make it run.  What it
does
  is to update a field in the database (to allow employees to quickly
update
  their hours in the hours tracking thing I'm creating)  it's complex
since
  all the employees hours will be listed on one page and will be instantly
  updatable (with a select box that allows the choice of +/- (name is
  modifydtml-var hoursID and value is either + hours already input
or -
  hours already input) and a text field for entering hours to add or
  subtract (name is mod_hoursdtml-var hoursID)).
 
  The code (in the DTML document) is:
 
  dtml-in "REQUEST.form.items()"
  dtml-if "_.string.find(_['sequence-key'], 'mod_hours')"
  dtml-else
  dtml-let mykey=sequence-key myval=sequence-item
  dtml-in "REQUEST.form.items()"
  dtml-if "_.string.find(_['sequence-key'], 'modify')"
  dtml-else
  dtml-if "_['sequence-key'][6:9] == mykey[9:12]"
  dtml-if myval
  dtml-call UpdateHours(REQUEST)
  /dtml-if
  /dtml-if
 
  /dtml-if
  /dtml-in
 
  /dtml-let
  /dtml-if
  /dtml-in
 
  and the SQL method UpdateHours is:
 
  update emp_hours set hours =
  dtml-var expr="_['sequence-item']"
  dtml-var expr="_['myval']"
  where
  hoursID = dtml-var expr="_['mykey'][9:12]";
 
  with arguments: sequence-item, myval, mykey
 
  I've tried everything I can think of but it not only refuses to do
 anything,
  it also refuses to raise an error.
 
  If anyone can help out I'd be very grateful.
 

 This seems to be more of a DTML problem than an Access problem. It is hard
 to follow anyway...
 A few questions: have you tried using something like changing the form
names
 to using the name.item:records syntax. something like

 input type="checkbox" name="modify.dtml-var hoursID:records" value="+"
 input type="checkbox" name="modify.dtml-var hoursID:records" value="-"
 input type="hidden" name="modify.inputhrs:records" value="hours already
 input"
 and a text field for entering hours to add or
 input type= "text"  name="modify.mod_hours:records" value="dtml-var
 hoursID"

 this will give your dtml method a dictionary like structure called modify
 you can loop over.

 Starting from there will save you a whole lot of hacking. Also I'm not at
 all sure that you can use the [sequenct-key] as arguments for your SQL
 Method.

 On the records and types in forms see:
 http://www.zope.org/Members/Zen/howto/FormVariableTypes

 hth

 Rik




___
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] Zope with Microsoft Access

2000-11-23 Thread Chris Gray

Here's a fix.  Change the line:

dtml-call UpdateHours(REQUEST)

to:

dtml-call "UpdateHours(myval=_['myval'], mykey=_['mykey'],
sequence_item=_['sequence-item'])"

and change the name of the parameter in your ZSQL method from
sequence-item to sequence_item and change the dtml-var tag in the method
to dtml-var sequence_item.

Cheers,
Chris

On Wed, 22 Nov 2000, Mike Kelland wrote:

 What does dtml-var "0/0" actually do?  Looks like all it would do is
 divide by zero which *has* to be some kind of error.  The problem, I think,
 lies mainly in the arguments being passed to UpdateHours.  I have done a
 whole slew of tests to show that my if statement works perfectly (the
 _.string.find thing seems to return false if it finds the specified sub
 string which is odd, but works) and I've actually outputted the correct SQL
 in the DTML (ie displayed it within the page) and I've copied and pasted
 that SQL directly into a ZSQL Method and ran it on my database and that
 works fine.  However it seems to do absolutly nothing when I actually
 attempt to run everything together and call UpdateHours from the DTML
 document.  I've played a little with namespace as well, but as I said, I'm
 new to all this so there may be an error there.
 
 Thanks for everyone's insight so far, it's really helpful, and please keep
 those suggestions coming! : )
 
 Mike Kelland
 [EMAIL PROTECTED]
 
 - Original Message -
 From: "[EMAIL PROTECTED]" [EMAIL PROTECTED]
 To: "Mike Kelland" [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Wednesday, November 22, 2000 8:48 PM
 Subject: Re: [Zope] Zope with Microsoft Access
 
 
  You may not be entering UpdateHours.
 
  Try dtml-var "0/0" just before the call to UpdateHours.
  Or some other obvious way to know if your entering it.
 
  Here's how I coded the same kind of thing.
  Although I'm reading the Zope book right now to see how I should have done
  it.
  The book is good and I might just learn a better solution than 0/0 :)
 
  --- Part of addContact
  form action="insertNewContactForm" method="get"
  table
  trtdName:/tdtdinput type="text" name="name" /td/tr
  trtdTitle:/tdtdinput type="text" name="title"/td/tr
  trtdPhone:/tdtdinput type="text" name="phone"/td/tr
  /table
  tabletr
  tdinput type="submit" name="cmd" value="Insert"/td
  tdinput type="submit" name="cmd" value="Update"/td
  tdinput type="submit" name="cmd" value="Delete"/td
  tdinput type="submit" name="cmd" value="Clear"/td
  /tr/table
  /form
 
  ---insertNewContactForm
  dtml-if expr="_.len(name)  0"
   dtml-if expr="cmd=='Insert'"
 dtml-var insertNewContact
   dtml-elif expr="cmd=='Delete'"
dtml-call deleteWhere
   dtml-elif expr="cmd=='Update'"
dtml-call updateWhere
   dtml-elif expr="cmd=='Clear'"
   /dtml-if
  /dtml-if
  dtml-var "RESPONSE.redirect('addContact')"
 
  --Darrell
 
 
  ___
  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 )
 



___
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] Zope with Microsoft Access

2000-11-22 Thread Chris Gray

Isn't the problem your else tags?  Remove them and I think you'll get the
effect you wanted.  As it stands the condition:

dtml-if "_['sequence-key'][6:9] == mykey[9:12]"

is never true.

Chris

On Wed, 22 Nov 2000, Mike Kelland wrote:

 Hi, this is my first posting to the list, and about my 4th day working with
 Zope.  I have a bit of a problem.  All my code so far is working well.  Just
 the following section is defying my attempts to make it run.  What it does
 is to update a field in the database (to allow employees to quickly update
 their hours in the hours tracking thing I'm creating)  it's complex since
 all the employees hours will be listed on one page and will be instantly
 updatable (with a select box that allows the choice of +/- (name is
 modifydtml-var hoursID and value is either + hours already input or -
 hours already input) and a text field for entering hours to add or
 subtract (name is mod_hoursdtml-var hoursID)).
 
 The code (in the DTML document) is:
 
 dtml-in "REQUEST.form.items()"
 dtml-if "_.string.find(_['sequence-key'], 'mod_hours')"
 dtml-else
 dtml-let mykey=sequence-key myval=sequence-item
 dtml-in "REQUEST.form.items()"
 dtml-if "_.string.find(_['sequence-key'], 'modify')"
 dtml-else
 dtml-if "_['sequence-key'][6:9] == mykey[9:12]"
 dtml-if myval
 dtml-call UpdateHours(REQUEST)
 /dtml-if
 /dtml-if
 
 /dtml-if
 /dtml-in
 
 /dtml-let
 /dtml-if
 /dtml-in
 
 and the SQL method UpdateHours is:
 
 update emp_hours set hours =
 dtml-var expr="_['sequence-item']"
 dtml-var expr="_['myval']"
 where
 hoursID = dtml-var expr="_['mykey'][9:12]";
 
 with arguments: sequence-item, myval, mykey
 
 I've tried everything I can think of but it not only refuses to do anything,
 it also refuses to raise an error.
 
 If anyone can help out I'd be very grateful.
 
 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 )
 


___
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] Zope with Microsoft Access

2000-11-22 Thread [EMAIL PROTECTED]

You may not be entering UpdateHours.

Try dtml-var "0/0" just before the call to UpdateHours.
Or some other obvious way to know if your entering it.

Here's how I coded the same kind of thing.
Although I'm reading the Zope book right now to see how I should have done
it.
The book is good and I might just learn a better solution than 0/0 :)

--- Part of addContact
form action="insertNewContactForm" method="get"
table
trtdName:/tdtdinput type="text" name="name" /td/tr
trtdTitle:/tdtdinput type="text" name="title"/td/tr
trtdPhone:/tdtdinput type="text" name="phone"/td/tr
/table
tabletr
tdinput type="submit" name="cmd" value="Insert"/td
tdinput type="submit" name="cmd" value="Update"/td
tdinput type="submit" name="cmd" value="Delete"/td
tdinput type="submit" name="cmd" value="Clear"/td
/tr/table
/form

---insertNewContactForm
dtml-if expr="_.len(name)  0"
 dtml-if expr="cmd=='Insert'"
   dtml-var insertNewContact
 dtml-elif expr="cmd=='Delete'"
  dtml-call deleteWhere
 dtml-elif expr="cmd=='Update'"
  dtml-call updateWhere
 dtml-elif expr="cmd=='Clear'"
 /dtml-if
/dtml-if
dtml-var "RESPONSE.redirect('addContact')"

--Darrell


___
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] Zope with Microsoft Access

2000-11-22 Thread [EMAIL PROTECTED]

From: "Mike Kelland" [EMAIL PROTECTED]
 What does dtml-var "0/0" actually do?  Looks like all it would do is
 divide by zero which *has* to be some kind of error.  

Yelp, that's exactly what it does.
My goal was to prove one way or another that a bit of code was executed.
Divide by zero is one way to do that.

--Darrell


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