Re: [Zope] Did I miss some major change in Z SQL Methods ?

2001-01-28 Thread Curtis Maloney

On Thursday 25 January 2001 21:29, peter bengtson wrote:
 Curtis,
 Doing Z SQL Methods (SELECT) is really easy with DTML.
 When you've got a working example of it in DTML, then we can perhaps help
 you to convert that into Python Method code.

 Cheers, Peter


Peter,

Please, do not mistake me for a newbie.  I have been developing ZOPE 
applications for around a year now.  This time, however, I have decided to 
try to use Python, instead of doing the entire app in DTML.  People say this 
is a 'Bad Thing(tm)'.

The SQL Method works fine.  I can easily test that with the 'Test' tab.  
Really, the only difference now to how I would have previously done this is 
that I have the python method slicing the result for me.

That being said, I have tried removing that, and going to the Z SQL method 
directly, and it STILL doesn't work.

I fear that something is getting lost in the Acquisition...


Have a better one,
Curtis Maloney.

___
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] Did I miss some major change in Z SQL Methods ?

2001-01-28 Thread Fred Yankowski

I missed the original message, but I'm trying to do something similar
-- use Python Methods rather than DTML -- and I found one critical
difference just today.  Here's an example:

I've got an SQL Method called 'select_item' that takes 'item_id' as
its only input parameter.

I've got a DTML Method 'form_action' that has 'item_id' in its
namespace by virtue of being posted from an HTTP form.

When I would invoke the SQL method from DTML I could do just
dtml-call select_item
and the SQL method would get the item_id from the DTML method.

But when using a new 'action_script' Python Method (PythonMethod
0.1.7) I have to pass that item_id explicitly from the DTML
   dtml-call "action_script(item_id)"
and action_script itself has to call the SQL method like so
   self.select_item(item_id=item_id)

I don't know why the explicit parameter passing is needed in the
latter case (DTML to Python Method to SQL Method) but not in the
former (DTML to SQL Method).  I'm sure I'm missing some trick.

In fact, this aspect of Zope -- when values are passed explicitly and
when not -- is a major confusion for me.  (And anyone who responds
about "Zen" deserves to have the size 12 boot applied.)


On Mon, Jan 29, 2001 at 09:28:17AM +1100, Curtis Maloney wrote:
 The SQL Method works fine.  I can easily test that with the 'Test' tab.  
 Really, the only difference now to how I would have previously done this is 
 that I have the python method slicing the result for me.
 
 That being said, I have tried removing that, and going to the Z SQL method 
 directly, and it STILL doesn't work.

-- 
Fred Yankowski   [EMAIL PROTECTED]  tel: +1.630.879.1312
Principal Consultant www.OntoSys.com   fax: +1.630.879.1370
OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA

___
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] Did I miss some major change in Z SQL Methods ?

2001-01-28 Thread Curtis Maloney

On Monday 29 January 2001 10:19, Fred Yankowski wrote:
 I missed the original message, but I'm trying to do something similar
 -- use Python Methods rather than DTML -- and I found one critical
 difference just today.  Here's an example:

 I've got an SQL Method called 'select_item' that takes 'item_id' as
 its only input parameter.

 I've got a DTML Method 'form_action' that has 'item_id' in its
 namespace by virtue of being posted from an HTTP form.

 When I would invoke the SQL method from DTML I could do just
 dtml-call select_item
 and the SQL method would get the item_id from the DTML method.

 But when using a new 'action_script' Python Method (PythonMethod
 0.1.7) I have to pass that item_id explicitly from the DTML
dtml-call "action_script(item_id)"
 and action_script itself has to call the SQL method like so
self.select_item(item_id=item_id)

 I don't know why the explicit parameter passing is needed in the
 latter case (DTML to Python Method to SQL Method) but not in the
 former (DTML to SQL Method).  I'm sure I'm missing some trick.

 In fact, this aspect of Zope -- when values are passed explicitly and
 when not -- is a major confusion for me.  (And anyone who responds
 about "Zen" deserves to have the size 12 boot applied.)


The way it appears to work is this:
DTML will pass it's namespace on implicitly.
Python will not.

The exact details of what are passed are somewhat of a mystery, true.  
Rember, of course that dtml-var "method_name()"  is a Python expression.  
As I understand it, the equivalent of:

dtml-var method_name

as a Python expression is:

dtml-var "method_name(_.None, _)"

When it comes to Python scripts, yes, you must pass all parameters 
explicitly.  IMHO, this is a good thing in many cases, as it forces you to 
make sure you are passing the correct values.  But I can see how implied 
values could make life easier... oh well...

Have a better one,
Curtis Maloney

P.S.  I'm now moving my application to Zope 2.3 in the vague hope that 
PythonScripts will handle this problem better.

___
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] Did I miss some major change in Z SQL Methods ?

2001-01-25 Thread Hannu Krosing

Curtis Maloney wrote:
 
 Green things,
 
 I have a few methods poking about that just don't seem to make sense
 
 A Z SQL Method ( Returner.sql.getDetails ) which simply contains:
 
 SELECT * FROM Returner WHERE ReturnerID=dtml-sqlvar User type="int"
 
 Which returns everything as expected.  The I have a Python Method which
 refers to it, simply wrapping it up, and taking the first (of what should be
 only one anyway) element.  It contains the following:
 ( Returner.getDetails(self, User) )
 
 return self.sql.getDetails(User=User)[0]
 
 Now.. for some reason, the following throws complaints about not being able
 to find ANY of the fields in the row:
 
 dtml-with "Returner.getDetails(Returner, User=12)"
   dtml-var fieldName
 /dtml-with

what does :

 dtml-in "[Returner.getDetails(Returner, User=12)]"
   dtml-var sequence-item html_quote
 /dtml-in

return ?


Hannu

___
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] Did I miss some major change in Z SQL Methods ?

2001-01-25 Thread peter bengtson

Curtis,
Doing Z SQL Methods (SELECT) is really easy with DTML.
When you've got a working example of it in DTML, then we can perhaps help
you to convert that into Python Method code.

Cheers, Peter


 On Thursday 25 January 2001 16:50, Evan Simpson wrote:
  From: "Curtis Maloney" [EMAIL PROTECTED]
 
   A Z SQL Method ( Returner.sql.getDetails )
 
  [snip]
 
   dtml-with "Returner.getDetails(Returner, User=12)"
 dtml-var fieldName
   /dtml-with
 
  You want either:
 
  dtml-in "Returner.getDetails(Returner, User=12)"
dtml-var fieldName
  /dtml-in
 

 No...if you'd paid attention, the Returner.getDetails() is a python method
 that calls Returner.sql.getDetails() and does the [0] slicing.

 Besides, I've also tried ditching the Python Method, and doing the slicing
in
 my DTML, and it STILL doesn't work.  This is what has me so confused.
Even
 removing most of the complexity, the problem persists.

  Cheers,
 
  Evan @ digicool  4-am

 Have a better one,
 Curtis Maloney

 ___
 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] Did I miss some major change in Z SQL Methods ?

2001-01-24 Thread Curtis Maloney


Green things,

I have a few methods poking about that just don't seem to make sense

A Z SQL Method ( Returner.sql.getDetails ) which simply contains:

SELECT * FROM Returner WHERE ReturnerID=dtml-sqlvar User type="int"

Which returns everything as expected.  The I have a Python Method which 
refers to it, simply wrapping it up, and taking the first (of what should be 
only one anyway) element.  It contains the following:
( Returner.getDetails(self, User) )

return self.sql.getDetails(User=User)[0]

Now.. for some reason, the following throws complaints about not being able 
to find ANY of the fields in the row:

dtml-with "Returner.getDetails(Returner, User=12)"
  dtml-var fieldName
/dtml-with

Now, previously I've accessed my ZSQL Methods directly from DTML, but this 
time I was trying to abstract slightly, for various reasons...  But this 
bizarre behaviour has begun.  Can anyone explain what I'm missing?

Zope 2.2.5
ZMySQLDA 1.2.0
PythonMethods 0.1.7
Linux (RH 6.1 +)

Have a better one,
Curtis Maloney

___
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] Did I miss some major change in Z SQL Methods ?

2001-01-24 Thread Evan Simpson

From: "Curtis Maloney" [EMAIL PROTECTED]
 A Z SQL Method ( Returner.sql.getDetails )
[snip]
 dtml-with "Returner.getDetails(Returner, User=12)"
   dtml-var fieldName
 /dtml-with

You want either:

dtml-in "Returner.getDetails(Returner, User=12)"
  dtml-var fieldName
/dtml-in

...or...


dtml-with "Returner.getDetails(Returner, User=12)[0]"
  dtml-var fieldName
/dtml-with

Cheers,

Evan @ digicool  4-am


___
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] Did I miss some major change in Z SQL Methods ?

2001-01-24 Thread Curtis Maloney

On Thursday 25 January 2001 16:50, Evan Simpson wrote:
 From: "Curtis Maloney" [EMAIL PROTECTED]

  A Z SQL Method ( Returner.sql.getDetails )

 [snip]

  dtml-with "Returner.getDetails(Returner, User=12)"
dtml-var fieldName
  /dtml-with

 You want either:

 dtml-in "Returner.getDetails(Returner, User=12)"
   dtml-var fieldName
 /dtml-in


No...if you'd paid attention, the Returner.getDetails() is a python method 
that calls Returner.sql.getDetails() and does the [0] slicing.

Besides, I've also tried ditching the Python Method, and doing the slicing in 
my DTML, and it STILL doesn't work.  This is what has me so confused.  Even 
removing most of the complexity, the problem persists.

 Cheers,

 Evan @ digicool  4-am

Have a better one,
Curtis Maloney

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