[Zope-Checkins] SVN: Products.Five/branches/1.3/ Merge 1.4 branch r69327:69328 into 1.3

2006-08-01 Thread Alec Mitchell
Log message for revision 69329:
  Merge 1.4 branch r69327:69328 into 1.3
  

Changed:
  U   Products.Five/branches/1.3/CHANGES.txt
  U   Products.Five/branches/1.3/browser/tests/test_traversable.py
  U   Products.Five/branches/1.3/traversable.py

-=-
Modified: Products.Five/branches/1.3/CHANGES.txt
===
--- Products.Five/branches/1.3/CHANGES.txt  2006-08-01 18:02:11 UTC (rev 
69328)
+++ Products.Five/branches/1.3/CHANGES.txt  2006-08-01 18:05:22 UTC (rev 
69329)
@@ -8,6 +8,8 @@
 Bugfixes
 
 
+* Fix problem with WebDAV/HEAD requests due to new traversal order.
+
 * Backported the new traversal lookup order from Zope 2.10 (attribute, adapter,
   acquired attribute).
 

Modified: Products.Five/branches/1.3/browser/tests/test_traversable.py
===
--- Products.Five/branches/1.3/browser/tests/test_traversable.py
2006-08-01 18:02:11 UTC (rev 69328)
+++ Products.Five/branches/1.3/browser/tests/test_traversable.py
2006-08-01 18:05:22 UTC (rev 69329)
@@ -301,6 +301,19 @@
   ...
   The mouse has been eaten by the eagle
 
+Head requests have some unusual behavior in Zope 2, in particular, a failed
+item lookup on an ObjectManager returns a NullResource, rather
+than raising a KeyError.  We need to make sure that this doesn't
+result in acquired attributes being shadowed by the NullResource:
+
+   print http(r'''
+  ... HEAD /test_folder_1_/ftf/mouse HTTP/1.1
+  ...
+  ... ''')
+  HTTP/1.1 200 OK
+  ...
+
+
 Clean up:
 
from zope.app.testing.placelesssetup import tearDown

Modified: Products.Five/branches/1.3/traversable.py
===
--- Products.Five/branches/1.3/traversable.py   2006-08-01 18:02:11 UTC (rev 
69328)
+++ Products.Five/branches/1.3/traversable.py   2006-08-01 18:05:22 UTC (rev 
69329)
@@ -27,6 +27,7 @@
 from zope.app.interface import queryType
 
 from Acquisition import aq_base
+from webdav.NullResource import NullResource
 import Products.Five.security
 from zExceptions import NotFound
 from ZPublisher import xmlrpc
@@ -60,7 +61,7 @@
 # 1. If an object has __bobo_traverse__, use it.
 # 2. Otherwise do attribute look-up or, if that doesn't work,
 #key item lookup.
-
+result = _marker
 if hasattr(self, '__fallback_traverse__'):
 try:
 return self.__fallback_traverse__(REQUEST, name)
@@ -81,7 +82,12 @@
 return getattr(self, name)
 try:
 # item access should never acquire
-return self[name]
+result = self[name]
+# WebDAV requests will always return something,
+# sometimes it's a NullResource, which we will ignore
+# and return later if necessary
+if not isinstance(result, NullResource):
+return result
 except (KeyError, IndexError, TypeError, AttributeError):
 pass
 
@@ -116,7 +122,12 @@
 pass
 
 # Fallback on acquisition, let it raise an AttributeError if it must
-return getattr(self, name)
+try:
+return getattr(self, name)
+except AttributeError:
+if result is not _marker:
+return result
+raise
 
 __bobo_traverse__.__five_method__ = True
 

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Products.Five/branches/1.2/ Merge 1.4 branch r69327:69328 into 1.2

2006-08-01 Thread Alec Mitchell
Log message for revision 69330:
  Merge 1.4 branch r69327:69328 into 1.2
  

Changed:
  U   Products.Five/branches/1.2/CHANGES.txt
  U   Products.Five/branches/1.2/browser/tests/test_traversable.py
  U   Products.Five/branches/1.2/traversable.py

-=-
Modified: Products.Five/branches/1.2/CHANGES.txt
===
--- Products.Five/branches/1.2/CHANGES.txt  2006-08-01 18:05:22 UTC (rev 
69329)
+++ Products.Five/branches/1.2/CHANGES.txt  2006-08-01 18:17:53 UTC (rev 
69330)
@@ -5,6 +5,8 @@
 Five 1.2.6 (unreleased)
 ===
 
+* Fix problem with WebDAV/HEAD requests due to new traversal order.
+
 * Backported the new traversal lookup order from Zope 2.10 (attribute, adapter,
   acquired attribute).
 

Modified: Products.Five/branches/1.2/browser/tests/test_traversable.py
===
--- Products.Five/branches/1.2/browser/tests/test_traversable.py
2006-08-01 18:05:22 UTC (rev 69329)
+++ Products.Five/branches/1.2/browser/tests/test_traversable.py
2006-08-01 18:17:53 UTC (rev 69330)
@@ -301,6 +301,19 @@
   ...
   The mouse has been eaten by the eagle
 
+Head requests have some unusual behavior in Zope 2, in particular, a failed
+item lookup on an ObjectManager returns a NullResource, rather
+than raising a KeyError.  We need to make sure that this doesn't
+result in acquired attributes being shadowed by the NullResource:
+
+   print http(r'''
+  ... HEAD /test_folder_1_/ftf/mouse HTTP/1.1
+  ...
+  ... ''')
+  HTTP/1.1 200 OK
+  ...
+
+
 Clean up:
 
from zope.app.tests.placelesssetup import tearDown

Modified: Products.Five/branches/1.2/traversable.py
===
--- Products.Five/branches/1.2/traversable.py   2006-08-01 18:05:22 UTC (rev 
69329)
+++ Products.Five/branches/1.2/traversable.py   2006-08-01 18:17:53 UTC (rev 
69330)
@@ -24,6 +24,7 @@
 from zope.app.traversing.adapters import traversePathElement
 
 from Acquisition import aq_base
+from webdav.NullResource import NullResource
 import Products.Five.security
 from zExceptions import NotFound
 from ZPublisher import xmlrpc
@@ -60,7 +61,7 @@
 # 1. If an object has __bobo_traverse__, use it.
 # 2. Otherwise do attribute look-up or, if that doesn't work,
 #key item lookup.
-
+result = _marker
 if hasattr(self, '__fallback_traverse__'):
 try:
 return self.__fallback_traverse__(REQUEST, name)
@@ -81,7 +82,12 @@
 return getattr(self, name)
 try:
 # item access should never acquire
-return self[name]
+result = self[name]
+# WebDAV requests will always return something,
+# sometimes it's a NullResource, which we will ignore
+# and return later if necessary
+if not isinstance(result, NullResource):
+return result
 except (KeyError, IndexError, TypeError, AttributeError):
 pass
 
@@ -115,7 +121,12 @@
 pass
 
 # Fallback on acquisition, let it raise an AttributeError if it must
-return getattr(self, name)
+try:
+return getattr(self, name)
+except AttributeError:
+if result is not _marker:
+return result
+raise
 
 __bobo_traverse__.__five_method__ = True
 

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/branches/2.10/ Fix bug in WebDAV/HEAD requests caused by traversal order change

2006-08-01 Thread Alec Mitchell
Log message for revision 69331:
  Fix bug in WebDAV/HEAD requests caused by traversal order change
  

Changed:
  U   Zope/branches/2.10/doc/CHANGES.txt
  U   Zope/branches/2.10/lib/python/OFS/Traversable.py
  U   Zope/branches/2.10/lib/python/OFS/tests/testTraverse.py

-=-
Modified: Zope/branches/2.10/doc/CHANGES.txt
===
--- Zope/branches/2.10/doc/CHANGES.txt  2006-08-01 18:17:53 UTC (rev 69330)
+++ Zope/branches/2.10/doc/CHANGES.txt  2006-08-01 19:30:42 UTC (rev 69331)
@@ -8,6 +8,9 @@
 
 Bugs Fixed
 
+  - Traversal order changes were causing WebDAV requests which used
+acquisition to fail.
+
   - Collector #2157: Expose name of broken class in SystemError raised
 from '__getstate__' of a broken instance.
 

Modified: Zope/branches/2.10/lib/python/OFS/Traversable.py
===
--- Zope/branches/2.10/lib/python/OFS/Traversable.py2006-08-01 18:17:53 UTC 
(rev 69330)
+++ Zope/branches/2.10/lib/python/OFS/Traversable.py2006-08-01 19:30:42 UTC 
(rev 69331)
@@ -26,6 +26,7 @@
 from zExceptions import NotFound
 from ZODB.POSException import ConflictError
 from OFS.interfaces import ITraversable
+import webdav
 
 from zope.interface import implements, Interface
 from zope.component import queryMultiAdapter
@@ -165,6 +166,7 @@
 else:
 obj = self
 
+resource = _marker
 try:
 while path:
 name = path_pop()
@@ -237,6 +239,13 @@
 else:
 try:
 next = obj[name]
+# The item lookup may return a NullResource,
+# if this is the case we save it and return it
+# if all other lookups fail.
+if isinstance(next,
+  
webdav.NullResource.NullResource):
+resource = next
+raise KeyError(name)
 except AttributeError:
 # Raise NotFound for easier debugging
 # instead of AttributeError: __getitem__
@@ -268,8 +277,11 @@
 except AttributeError:
 raise e
 if next is _marker:
-# Nothing found re-raise error
-raise e
+# If we have a NullResource from earlier use it.
+next = resource
+if next is _marker:
+# Nothing found re-raise error
+raise e
 
 obj = next
 

Modified: Zope/branches/2.10/lib/python/OFS/tests/testTraverse.py
===
--- Zope/branches/2.10/lib/python/OFS/tests/testTraverse.py 2006-08-01 
18:17:53 UTC (rev 69330)
+++ Zope/branches/2.10/lib/python/OFS/tests/testTraverse.py 2006-08-01 
19:30:42 UTC (rev 69331)
@@ -592,11 +592,25 @@
 
 However, acquired attributes *should* be shadowed. See discussion on
 http://codespeak.net/pipermail/z3-five/2006q2/001474.html
-
+
manage_addIndexSimpleContent(self.folder, 'mouse', 'Mouse')
self.folder.ftf.unrestrictedTraverse('mouse')()
   u'The mouse has been eaten by the eagle'
-  
+
+Head requests have some unusual behavior in Zope 2, in particular, a failed
+item lookup on an ObjectManager returns a NullResource, rather
+than raising a KeyError.  We need to make sure that this doesn't
+result in acquired attributes being shadowed by the NullResource,
+but that unknown names still give NullResources:
+
+   self.app.REQUEST.maybe_webdav_client = True
+   self.app.REQUEST['REQUEST_METHOD'] = 'HEAD'
+   self.folder.ftf.unrestrictedTraverse('mouse')()
+  u'The mouse has been eaten by the eagle'
+   self.folder.ftf.unrestrictedTraverse('nonsense')
+  webdav.NullResource.NullResource object at ...
+
+
 Clean up:
 
from zope.app.testing.placelesssetup import tearDown

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


[Zope-Checkins] SVN: Zope/trunk/lib/python/OFS/ Merge the fix in r69331 from 2.10 branch (WebDAV/HEAD request acquisition issue)

2006-08-01 Thread Alec Mitchell
Log message for revision 69332:
  Merge the fix in r69331 from 2.10 branch (WebDAV/HEAD request acquisition 
issue)
  

Changed:
  U   Zope/trunk/lib/python/OFS/Traversable.py
  U   Zope/trunk/lib/python/OFS/tests/testTraverse.py

-=-
Modified: Zope/trunk/lib/python/OFS/Traversable.py
===
--- Zope/trunk/lib/python/OFS/Traversable.py2006-08-01 19:30:42 UTC (rev 
69331)
+++ Zope/trunk/lib/python/OFS/Traversable.py2006-08-01 19:49:56 UTC (rev 
69332)
@@ -26,6 +26,7 @@
 from zExceptions import NotFound
 from ZODB.POSException import ConflictError
 from OFS.interfaces import ITraversable
+import webdav
 
 from zope.interface import implements, Interface
 from zope.component import queryMultiAdapter
@@ -165,6 +166,7 @@
 else:
 obj = self
 
+resource = _marker
 try:
 while path:
 name = path_pop()
@@ -237,6 +239,13 @@
 else:
 try:
 next = obj[name]
+# The item lookup may return a NullResource,
+# if this is the case we save it and return it
+# if all other lookups fail.
+if isinstance(next,
+  
webdav.NullResource.NullResource):
+resource = next
+raise KeyError(name)
 except AttributeError:
 # Raise NotFound for easier debugging
 # instead of AttributeError: __getitem__
@@ -268,8 +277,11 @@
 except AttributeError:
 raise e
 if next is _marker:
-# Nothing found re-raise error
-raise e
+# If we have a NullResource from earlier use it.
+next = resource
+if next is _marker:
+# Nothing found re-raise error
+raise e
 
 obj = next
 

Modified: Zope/trunk/lib/python/OFS/tests/testTraverse.py
===
--- Zope/trunk/lib/python/OFS/tests/testTraverse.py 2006-08-01 19:30:42 UTC 
(rev 69331)
+++ Zope/trunk/lib/python/OFS/tests/testTraverse.py 2006-08-01 19:49:56 UTC 
(rev 69332)
@@ -592,11 +592,25 @@
 
 However, acquired attributes *should* be shadowed. See discussion on
 http://codespeak.net/pipermail/z3-five/2006q2/001474.html
-
+
manage_addIndexSimpleContent(self.folder, 'mouse', 'Mouse')
self.folder.ftf.unrestrictedTraverse('mouse')()
   u'The mouse has been eaten by the eagle'
-  
+
+Head requests have some unusual behavior in Zope 2, in particular, a failed
+item lookup on an ObjectManager returns a NullResource, rather
+than raising a KeyError.  We need to make sure that this doesn't
+result in acquired attributes being shadowed by the NullResource,
+but that unknown names still give NullResources:
+
+   self.app.REQUEST.maybe_webdav_client = True
+   self.app.REQUEST['REQUEST_METHOD'] = 'HEAD'
+   self.folder.ftf.unrestrictedTraverse('mouse')()
+  u'The mouse has been eaten by the eagle'
+   self.folder.ftf.unrestrictedTraverse('nonsense')
+  webdav.NullResource.NullResource object at ...
+
+
 Clean up:
 
from zope.app.testing.placelesssetup import tearDown

___
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins


Re: [Zope-dev] Windows Installers

2006-08-01 Thread Sidnei da Silva
On Tue, Aug 01, 2006 at 01:25:56AM -0400, Tim Peters wrote:
| Note 2.9.4 changed the build procedure to be the same as 2.8.x again. I've
| made the changes, and hopefully it should work just fine.
| 
| The 2.9.4 build started failing here:
| 
| ...
| mkdir -p /cygdrive/c/Code/Zope2.9/inst/src
| cd /cygdrive/c/Code/Zope2.9/inst/src  tar xzf ../tmp/Zope-2.9.4.tgz
| 
| gzip: stdin: unexpected end of file
| tar: Child returned status 1
| tar: Error exit delayed from previous errors
| make: *** [src/Zope-2.9.4/inst/configure.py] Error 2

'ZOPEVERSION' in WinBuilders/mk/zope.mk is lacking the '-final'.

| I renamed the Zope 2.9.4 tarball download to worm around that, and
| then it failed here:
| 
| mkdir -p /cygdrive/c/Code/Zope2.9/inst/src
| cd /cygdrive/c/Code/Zope2.9/inst/src  tar xzf ../tmp/Zope-2.9.4.tgz
| touch src/Zope-2.9.4/inst/configure.py
| touch: cannot touch `src/Zope-2.9.4/inst/configure.py': No such file
| or directory
| make: *** [src/Zope-2.9.4/inst/configure.py] Error 1
| 
| 
| Again it's fatally confused about whether the Zope tarball and/or
| unpacked directory root does or does not have -final in its name.  I
| didn't repair this, I just wormed around it again (I have no idea what
| the /intent/ is now).

The intent is that it works *wink*.

| Finally, the code for finding Inno Setup in common.mk was broken,
| trying to feed a native Windows path to the Cygwin bash shell.

Ah. It wasn't broken, just didn't work the way you expected *g*. What I did 
actually was to add a 'installer' target to the Windows makefile, so the steps 
I used where:

  python inst/configure.py (options?)
  nmake installer

The 'installer' target does:

   $(CD) inst  sh Winbuilders/buildout zope ZOPEVERSION=$(ZOPEVERSION)

So, it's actually running from 'cmd.exe', that's why it worked. Also
it's passing the correct 'ZOPEVERSION' variable, because that's read
from the 'canonical' place in versions.py.

I suggest that we document these steps instead of the previous ones,
because they are less likely to get out of sync, specially w/regards
to 'ZOPEVERSION'.

-- 
Sidnei da Silva
Enfold Systemshttp://enfoldsystems.com
Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope] MySQL queries in Python

2006-08-01 Thread Muk Yan
Dear Coveted Braintrust,I was wondering if anyone had any experience with MySQL queries in Python in Zope:import MySQLdbimport stringrequest = container.REQUESTsession = request.SESSION
result = (context.aq_parent).selects.select_from_table()print resultreturn printedWHERE select.select_from_table() IS:SELECT nameFROM personWHERE ID = dtml-var REQUEST.SESSION.get
('person_id')I know the MySQL query works, but I get garbage results from the python script (Shared.DC.ZRDB.Results.Results instance at 0x132a5c88). All I want is to contain the results of the SQL query in a list or container.
Thanks and take care,Muk Yan
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] MySQL queries in Python

2006-08-01 Thread Jonathan



Have a look at this:

http://www.zope.org/Members/spinwing/ZSQL_Results



Jonathan

  - Original Message - 
  From: 
  Muk Yan 
  To: zope@zope.org 
  Sent: Tuesday, August 01, 2006 2:50 
  PM
  Subject: [Zope] MySQL queries in 
  Python
  Dear Coveted Braintrust,I was wondering if anyone had 
  any experience with MySQL queries in Python in Zope:import 
  MySQLdbimport stringrequest = container.REQUESTsession = 
  request.SESSIONresult = 
  (context.aq_parent).selects.select_from_table()print resultreturn 
  printedWHERE select.select_from_table() IS:SELECT nameFROM 
  personWHERE ID = dtml-var "REQUEST.SESSION.get 
  ('person_id')"I know the MySQL query works, but I get garbage 
  results from the python script (Shared.DC.ZRDB.Results.Results instance at 
  0x132a5c88). All I want is to contain the results of the SQL query 
  in a list or container. Thanks and take care,Muk Yan
  
  

  ___Zope maillist 
  - 
  Zope@zope.orghttp://mail.zope.org/mailman/listinfo/zope** 
  No cross posts or HTML encoding! **(Related lists - 
  http://mail.zope.org/mailman/listinfo/zope-announcehttp://mail.zope.org/mailman/listinfo/zope-dev 
  )
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] MySQL queries in Python

2006-08-01 Thread Andreas Jung



--On 1. August 2006 14:50:19 -0400 Muk Yan [EMAIL PROTECTED] wrote:


I know the MySQL query works, but I get garbage results from the python
script (Shared.DC.ZRDB.Results.Results instance at 0x132a5c88).  All I
want is to contain the results of the SQL query in a list or container.



Zope Book 2.7 edition - RDBMS chapter. The result object is an iterator 
will return a row of the resultset for each iteration.


-aj

pgpVcDD2jTQav.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] MySQL queries in Python

2006-08-01 Thread John Barham

import MySQLdb


This is probably redundant.


import string

request = container.REQUEST
session = request.SESSION

 result = (context.aq_parent).selects.select_from_table()

print result


Assuming you want the person's name printed, change this line to:

print result[0].name

Think of the result from a ZSQL query as a list/iterator over the
resulting rows.  In your case I'm assuming there is only one person
row w/ the given id, so there is only one row in the result, but you
still have to explicitly de-reference it w/ its index.

HTH,

 John
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] MySQL queries in Python

2006-08-01 Thread Dennis Allison

Usually you install the database adaptor ZMySQLDB and make queries through 
a ZSQL Method object.

On Tue, 1 Aug 2006, Muk Yan wrote:

 Dear Coveted Braintrust,
 
 I was wondering if anyone had any experience with MySQL queries in Python in
 Zope:
 
 import MySQLdb
 import string
 
 request = container.REQUEST
 session = request.SESSION
 
 result = (context.aq_parent).selects.select_from_table()
 
 print result
 return printed
 
 WHERE select.select_from_table() IS:
 
 SELECT name
 FROM person
 WHERE ID = dtml-var REQUEST.SESSION.get('person_id')
 
 I know the MySQL query works, but I get garbage results from the python
 script (Shared.DC.ZRDB.Results.Results instance at 0x132a5c88).  All I
 want is to contain the results of the SQL query in a list or container.
 
 Thanks and take care,
 Muk Yan
 

-- 

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


[Zope] button to submit with several parameters and call python script

2006-08-01 Thread Alan

Hi Dears,

I am looking for ideas of how to use a submitting button to pass
several parameters to a python script.

I have googled but I found different solutions not really appropriate
to my case I guess.

I was trying something like this:

 form action=do_status.py method=POST
  input type=hidden name=jname:string
  input type=hidden name=juser:string
  input type=submit value=Submit
 /form

Then I defined my do_status.py with parameters jname, juser


print jname, juser
return printed


and nothing is printed.

But what I would like was something like clicking on a button I would
call a specific python script with parameters, eg:
span tal:content=python: here.do_status(jname,juser)

Any help here would be very appreciated. Many thanks in advance.

Cheers,
Alan

--
Alan Wilter S. da Silva, D.Sc. - Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.

http://www.bio.cam.ac.uk/~awd28

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] button to submit with several parameters and call pythonscript

2006-08-01 Thread Jonathan


- Original Message - 
From: Alan [EMAIL PROTECTED]

To: zope@zope.org
Sent: Tuesday, August 01, 2006 7:53 PM
Subject: [Zope] button to submit with several parameters and call 
pythonscript


I was trying something like this:

 form action=do_status.py method=POST
  input type=hidden name=jname:string
  input type=hidden name=juser:string
  input type=submit value=Submit
 /form

Then I defined my do_status.py with parameters jname, juser


print jname, juser
return printed


and nothing is printed.


This is an html question, not a zope question, but... you are missing the 
value attribute:


  input type=hidden name=jname:string value=do something to get a 
value here

  input type=hidden name=juser:string value=xxx



Jonathan


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] button to submit with several parameters and call python script

2006-08-01 Thread David H

Alan wrote:


Hi Dears,

I am looking for ideas of how to use a submitting button to pass
several parameters to a python script.

I have googled but I found different solutions not really appropriate
to my case I guess.

I was trying something like this:

 form action=do_status.py method=POST
  input type=hidden name=jname:string
  input type=hidden name=juser:string
  input type=submit value=Submit
 /form

Then I defined my do_status.py with parameters jname, juser


print jname, juser
return printed




Try print context.REQUEST.get('jname','???')


and nothing is printed.


David

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] MySQL queries in Python

2006-08-01 Thread Paul Winkler
On Tue, Aug 01, 2006 at 02:50:19PM -0400, Muk Yan wrote:
 Dear Coveted Braintrust,
 
 I was wondering if anyone had any experience with MySQL queries in Python in
 Zope:

People have already answered your main question, but:

 SELECT name
 FROM person
 WHERE ID = dtml-var REQUEST.SESSION.get('person_id')

Never ever pass raw user input to a sql query!  If you're not familiar
with the phrase sql injection...  google it :)

The zope book relational databases chapter explains how to use
dtml-sqlvar which is one way to avoid the danger.  

-- 

Paul Winkler
http://www.slinkp.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: Re: [Zope] button to submit with several parameters and call python script

2006-08-01 Thread Alan

Thanks guys, but I got another solution that worked (after some hours googling).

input type=hidden name=juser tal:attributes=value juser

Cheers,
Alan

On 02/08/06, David H [EMAIL PROTECTED] wrote:

Alan wrote:

 Hi Dears,

 I am looking for ideas of how to use a submitting button to pass
 several parameters to a python script.

 I have googled but I found different solutions not really appropriate
 to my case I guess.

 I was trying something like this:

  form action=do_status.py method=POST
   input type=hidden name=jname:string
   input type=hidden name=juser:string
   input type=submit value=Submit
  /form

 Then I defined my do_status.py with parameters jname, juser

 print jname, juser
 return printed


Try print context.REQUEST.get('jname','???')

 and nothing is printed.

David





--
Alan Wilter S. da Silva, D.Sc. - Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.

http://www.bio.cam.ac.uk/~awd28

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )