[Zope-dev] DateTime, strftime and TimeError

2005-05-11 Thread Santi Camps
Hi all,
I think its known that using strftime method of DateTime module with 
dates = 1900 or = 2038, a TimeError is raised.   For instance:

 d = DateTime('2045/30/01')
 d.strftime('%d/%m/%Y')
DateTime.DateTime.TimeError: The time 2369343600.00 is beyond the 
range of this Python implementation

I've read that the reason was a validation to avoid int overflows.   I 
think this could be fixed using datetime module (new in python 2.3) 
instead of old time.localtime

Do you think its a good idea ?   Can I provide a patch that way ?
Thanks
Santi Camps

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


Re: [Zope-dev] DateTime, strftime and TimeError

2005-05-11 Thread Andrew Langmead
On May 11, 2005, at 10:08 AM, Santi Camps wrote:I think its known that using strftime method of DateTime module with dates = 1900 or = 2038, a TimeError is raised.   For instance:DateTime can handle dates with larger ranges, it just can't display them with the strftime method.DateTime's strftime method is impelemented with the standard C libraries' strftime(), and a C time_t datatype only represents dates between 1970 and 2038.___
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 )


Re: [Zope-dev] DateTime, strftime and TimeError

2005-05-11 Thread Santi Camps
En/na Andrew Langmead ha escrit:
On May 11, 2005, at 10:08 AM, Santi Camps wrote:
I think its known that using strftime method of DateTime module with 
dates = 1900 or = 2038, a TimeError is raised.   For instance:


DateTime can handle dates with larger ranges, it just can't display 
them with the strftime method.

DateTime's strftime method is impelemented with the standard C 
libraries' strftime(), and a C time_t datatype only represents dates 
between 1970 and 2038.


Yes, I know, but displaying them through a datetime.datetime object the 
display can also work fine.   That's my proposal.

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


Re: [Zope-dev] SMTP socket error

2005-05-11 Thread Dieter Maurer
Shilpa P wrote at 2005-5-11 06:13 +0100:
 I am trying to send mail using python.I tried the
 command
 
  import smtplib
  s=smtplib.SMTP(localhost)
 
 I get the following error
 socket.error: (10053, 'Software caused connection
 abort')

Your SMTP server does not like your process -- almost surely
due to security restrictions in this server.

Consult your administrator for the SMTP server.

-- 
Dieter
___
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] Re: Refcounts, ZODB Cache and memory leaks?

2005-05-11 Thread Dylan Jay
I've been going some testing with gc.set_debug etc and it looks like there 
isn't a memory leak or at least not one the garbage collector can find. That 
means that the data must be remaining reachable somehow.

-- 
Dylan Jay
---
http://www.meetmemap.com - makes giving directions easy
http://www.pretaweb.com - Update-it-yourself, low cost websites
http://www.eatmanifesto.com - against all dumbing down of food
Y!:dylan_jay ICQ:520341 MSN:[EMAIL PROTECTED] Ph:+61423198306
Dylan Jay [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Peter Bengtsson [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 Dylan Jay me at dylanjay.com writes:

 If anyone has experience with finding these kind of rouge references I'd
 really appreciate any tips.

 I have no idea how to patch tings with LeakFinder to find your problems 
 because
 LeakFinder, albeit a great piece of code, attempts an incredibly 
 difficult task.
 Most likely, your memory leaks is due to an assignment of really large 
 lists on
 complex objects (eg. more complex than strings or numbers).

 Can you expound on this a little as this sounds very interesting? Why do 
 assignments to a list normally result in leaks? Do you mean lists of 
 complex objects or complex objects that have lists?

 Look for any constructs where you extract large lists and do operations 
 on them.
 Once you have, if you ever, contain these, return to the mailing list and 
 we can
 try to solve it together.

 I certainly do operations on lists, partucularly LazyMap etc. I do 
 operations with catalog results and map them to lazily to custom objects 
 which are joined by aquisition to catalog brains.

 I'm new to memory leak debugging in python but have done it before in 
 java.
From what I understand garbage collection happens differently in java. In
 java you have to avoid circular references, is the same true in python?



 ___
 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 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 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] ZODB question

2005-05-11 Thread Pascal Peregrina
Hi,

In a Zope / Zeo configuration (2.7.6), is there a way, on the Zope instance,
to know when the database (Zeo) was last packed ?

Thanks.

Pascal


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.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: [Zope] container and context for folderish objects

2005-05-11 Thread Milos Prudek
Milos Prudek wrote:
I created a very simple folderish product. Everything works fine. But I 
 was surprised that context and container seem to behave differently 
for folderish object than for normal Folder.
To answer my own question: I misunderstood what container does. Desired 
behaviour can be obtained via

pli tal:repeat=item python:here.aq_parent.objectIds() 
tal:content=item/p

--
Milos Prudek
http://www.spoxdesign.com - your web usability testing
___
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] LDAPUserFolder and roles/groups assignment Problem

2005-05-11 Thread Bernard Lange
Hi ,
I've instantiated a Group User Folder object for my Zope+Plone 
application and configured it to take users from an LDAP server in order 
to get users id and passwords validated against LDAP. So far, so good 
users can log in using their LDAP credentials.

The underlying users source is a LDAPUserFolder. I have configured it 
so that the groups are not stored on LDAP. Consequently the groups' 
source is default UserFolder.I have also configured Anonymous,Member as 
default roles to LDAP users.

I'm using ZOPE (ver.Zope 2.7.5-final, python 2.3.5, linux2) and Plone 
(2.0.4.3)with GRUF version: 3.1.1 and LDAPUserFolder 2.4 on Debian box.
All except LDAPUserFolder installed from debian packages.

I have encountered problems with assigning other roles to users. When I 
enter acl_users/Users tab of my Plone site check one of the users and 
the role I want to assign, confirm it I get the following error:

Site error:

This site encountered an error trying to fulfill your request. The 
errors were:

Error Type
AttributeError
Error Value
'NoneType' object has no attribute 'find'
Request made at
2005/05/11 11:04:33.681 GMT+2
**
The full stack trace from error log is as follows:

Exception Details
Back to Error Log
Time
2005/05/11 11:07:35.111 GMT+2
User Name (User Id)
zopeadmin (zopeadmin)
Request URL
http://myhost:9673/copy_of_plone/acl_users/changeOrCreateUsers
Exception Type
AttributeError
Exception Value
'NoneType' object has no attribute 'find'
Traceback (innermost last):
* Module ZPublisher.Publish, line 101, in publish
* Module ZPublisher.mapply, line 88, in mapply
* Module ZPublisher.Publish, line 39, in call_object
* Module Products.GroupUserFolder.GroupUserFolder, line 1372, in 
changeOrCreateUsers
* Module Products.GroupUserFolder.GroupUserFolder, line 1110, in 
_updateUser
* Module Products.GroupUserFolder.GroupUserFolder, line 1057, in 
_doChangeUser
* Module Products.GroupUserFolder.LDAPUserFolderAdapter, line 138, 
in _doChangeUser
* Module Products.LDAPUserFolder.LDAPUserFolder, line 1497, in 
manage_editUserRoles

AttributeError: 'NoneType' object has no attribute 'find'
Display traceback as text
REQUEST
form
changeOrCreateUsers	'Change'
default_password	'password obscured'
new_users	[]
users	['bernard']
roles	['Reviewer']
cookies
cookieTest	'1'
__ac_name	'bernard'
tree-s 
'eJzTyCkw5NLIKTDiClZ3hANXW3WuAmOuRKCECUjWFEXWFyRrBpY1B8laAGVDci1LowJtQTKWXIlAABQ3NEDS5pxfDpI0NOSCyCFb6JqbD5YzhsqZIMn5ZTuC5UzBpuoBAF0OLNI'
__ac	'YmVybmFyZDoxMjNhYmM%3D%0A'
_ZopeId	'63617490A10pAKsRfQA'
lazy items
SESSION	bound method SessionDataManager.getSessionData of 
SessionDataManager instance at 420c05f0
other
TraversalRequestNameStack	[]
roles	['Reviewer']
AUTHENTICATED_USER	zopeadmin
URL	'http://myhost:9673/copy_of_plone/acl_users/changeOrCreateUsers'
SERVER_URL	'http://myhost:9673'
AUTHENTICATION_PATH	''
PATH_INFO	'/copy_of_plone/acl_users/changeOrCreateUsers'
PUBLISHED	bound method GroupUserFolder.changeOrCreateUsers of 
GroupUserFolder instance at 41924da0
default_password	'password obscured'
new_users	[]
ACTUAL_URL	'http://myhost:9673/copy_of_plone/acl_users/changeOrCreateUsers'
users	['bernard']
URL0	http://myhost:9673/copy_of_plone/acl_users/changeOrCreateUsers
URL1	http://myhost:9673/copy_of_plone/acl_users
URL2	http://myhost:9673/copy_of_plone
URL3	http://myhost:9673
BASE0	http://myhost:9673
BASE1	http://myhost:9673
BASE2	http://myhost:9673/copy_of_plone
BASE3	http://myhost:9673/copy_of_plone/acl_users
BASE4	http://myhost:9673/copy_of_plone/acl_users/changeOrCreateUsers
environ
HTTP_COOKIE	'cookieTest=1; 
tree-s=eJzTyCkw5NLIKTDiClZ3hANXW3WuAmOuRKCECUjWFEXWFyRrBpY1B8laAGVDci1LowJtQTKWXIlAABQ3NEDS5pxfDpI0NOSCyCFb6JqbD5YzhsqZIMn5ZTuC5UzBpuoBAF0OLNI; 
_ZopeId=63617490A10pAKsRfQA; __ac=YmVybmFyZDoxMjNhYmM%3D%0A; 
__ac_name=bernard'
SERVER_SOFTWARE	'Zope/(Zope 2.7.5-final, python 2.3.5, linux2) 
ZServer/1.1 Plone/2.0.4'
SCRIPT_NAME	''
REQUEST_METHOD	'POST'
HTTP_KEEP_ALIVE	'300'
SERVER_PROTOCOL	'HTTP/1.1'
channel.creation_time	1115802248
CONNECTION_TYPE	'keep-alive'
HTTP_ACCEPT_CHARSET	'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
HTTP_USER_AGENT	'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) 
Gecko/20050324 Debian/1.7.6-1'
HTTP_REFERER 
'http://myhost:9673/copy_of_plone/acl_users/manage_users?FORCE_ALL=1'
SERVER_NAME	'myhost.man.poznan.pl'
REMOTE_ADDR	'150.254.149.174'
PATH_TRANSLATED	'/copy_of_plone/acl_users'
SERVER_PORT	'9673'
CONTENT_LENGTH	'124'
HTTP_HOST	'myhost:9673'
HTTP_ACCEPT 
'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'
GATEWAY_INTERFACE	'CGI/1.1'
CONTENT_TYPE	'application/x-www-form-urlencoded'
REMOTE_HOST	'ldaphost.man.poznan.pl'
HTTP_ACCEPT_ENCODING	'gzip,deflate'
PATH_INFO	'/copy_of_plone/acl_users'
*

I get similiar error message when I try to assign a user to any group.
Another 

Re: [Zope] LDAPUserFolder and roles/groups assignment Problem

2005-05-11 Thread Jens Vagelpohl
On May 11, 2005, at 11:21, Bernard Lange wrote:
Traceback (innermost last):
* Module ZPublisher.Publish, line 101, in publish
* Module ZPublisher.mapply, line 88, in mapply
* Module ZPublisher.Publish, line 39, in call_object
* Module Products.GroupUserFolder.GroupUserFolder, line 1372,  
in changeOrCreateUsers
* Module Products.GroupUserFolder.GroupUserFolder, line 1110,  
in _updateUser
* Module Products.GroupUserFolder.GroupUserFolder, line 1057,  
in _doChangeUser
* Module Products.GroupUserFolder.LDAPUserFolderAdapter, line  
138, in _doChangeUser
* Module Products.LDAPUserFolder.LDAPUserFolder, line 1497, in  
manage_editUserRoles

AttributeError: 'NoneType' object has no attribute 'find'
That LDAPUserFolderAdapter thingamajig is feeding garbage to the  
LDAPUserFolder.manage_editUserRoles method.

These questions should probably go to Plone/GRUF lists.
jens
___
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] Re: ZODB question

2005-05-11 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Pascal Peregrina wrote:

 In a Zope / Zeo configuration (2.7.6), is there a way, on the Zope instance,
 to know when the database (Zeo) was last packed ?
 
 Thanks.

Repozo knows this for the underlying FileStorage:

  http://www.zope.org/Wikis/ZODB/FileStorageBackup

AFAIK, there is no wire-protocol-level way to check for it in the
ZEOClientStorage.

BTW, this question would get better-informed response on the zodb-dev
list (which I have CC'ed).

Tres.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCggzv+gerLs4ltQ4RAqkUAJ46baO6FeV2mKXpd9CQq7c7pvSSugCcDkU0
OJyFipH9BLTmy1mc31kb1to=
=4W8m
-END 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] Re: ZODB question

2005-05-11 Thread Pascal Peregrina
Thanks

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] la part de
Tres Seaver
Envoyé : mercredi 11 mai 2005 15:47
À : zope@zope.org
Cc : zodb-dev@zope.org
Objet : [Zope] Re: ZODB question




**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Pascal Peregrina wrote:

 In a Zope / Zeo configuration (2.7.6), is there a way, on the Zope
instance,
 to know when the database (Zeo) was last packed ?
 
 Thanks.

Repozo knows this for the underlying FileStorage:

  http://www.zope.org/Wikis/ZODB/FileStorageBackup

AFAIK, there is no wire-protocol-level way to check for it in the
ZEOClientStorage.

BTW, this question would get better-informed response on the zodb-dev
list (which I have CC'ed).

Tres.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCggzv+gerLs4ltQ4RAqkUAJ46baO6FeV2mKXpd9CQq7c7pvSSugCcDkU0
OJyFipH9BLTmy1mc31kb1to=
=4W8m
-END 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 )


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.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 )


[Zope] monitor / icp server

2005-05-11 Thread Sylvain Thénault
Hey !

I'm experiencing some problem trying to use the monitor server. I've
zope 2.7.6 running, with an emergency user defined in the instance's
access file, with password stored as clear text. When I try to run the
monitor_client.py script, I type my password and everything I get
(except a warning for using regsub instead of re) is :

warning: unhandled connect event

and the script ends.
Does anyone managed to access the monitor server with zope 2.7.6 ?


Non related question : is there some documentation about Zope's icp
capabilities ?

TIA
-- 
Sylvain Thénault   LOGILAB, Paris (France).

http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org

___
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] How to find out the full URL

2005-05-11 Thread Hong Yuan
I have a page template, say 'products.pt', which takes 
traverse_subpath[0] as one of the variables, so e.g. the URL:
 http://myserver/products/100
will actually call products.pt, which get 100 from the URL and displays 
it in the template.

Now my question is how can I get the full URL from within the tempalte 
'products.pt'? If I use 'request/URL' it will show 
'http://myserver/products' only, with the subpath somehow dropped. How 
can I get the '/100' part back?

Ideally, I'd like to get back the whole URL as entered in the browser as 
a string. From the REQUEST I have to put together URL and QUERY_STRING, 
and the section (#xxx) part of the url can not be found in REQUEST.

Thanks for helping.
Hong Yuan
___
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] How do I logout using DTML

2005-05-11 Thread Allen Huang
How do I logout current user using DTML
I used dtml-call expr="acl_users.logout(REQUEST)" but it didn't work and zope gave me this.


Site Error
An error was encountered while publishing this resource. 
Error Type: AttributeErrorError Value: logout

What did I do wrong??

		Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone.___
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] How do I logout using DTML

2005-05-11 Thread Dennis Allison
Looks like your userfolder does not support a logout method as an 
inspection of the code would have established.  In fact, the 
only logout method that appears to be supported is in the 
App manager for the ZMI.   You may want to look at the code
and adapt it for your purposes.




On Wed, 11 May 2005, Allen Huang wrote:

 How do I logout current user using DTML
 I used dtml-call expr=acl_users.logout(REQUEST) but it didn't work and 
 zope gave me this.
  
 Site Error
 An error was encountered while publishing this resource. 
 
 Error Type: AttributeError
 Error Value: logout
 
  
 What did I do wrong??
 
 
 
 
   
 -
 Yahoo! Mail Mobile
  Take Yahoo! Mail with you! Check email on your mobile phone.

-- 
Dennis Allison * Computer Systems Laboratory * Gates 227
   * Stanford University *  Stanford CA  94305
   * (650) 723-9213 * (650) 723-0033 fax
   * [EMAIL PROTECTED]
   * [EMAIL PROTECTED]


___
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] Zope Sybase database connection keeps closing

2005-05-11 Thread Dieter Maurer
Abhilasha Chaudhary wrote at 2005-5-10 14:14 -0400:
My zope Sybase database connections keep closing for no apparent reason.

This may happen when the DA instance is flushed from the ZODB.
Usually, it reopens automatically either when it is loaded
again or when used.

When I try to reopen the connections they sometimes give me the 
following error:

*Invalid connection string: *|database: , password: access, server: 
SYBTIGR, transactional: Y, user: access

This is a silly way to indicate problems during the connection.
Because usually the connection fails due to an invalid
connection string, the code thinks without check that it is
indeed this problem.

If you are lucky, the code has at least written a log entry
(look into your logfile!) which explains the true reason.
If not, you must change the code to get such a log entry.

-- 
Dieter
___
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] what are the dtml for logout and deleting a existing user??

2005-05-11 Thread Dieter Maurer
Allen Huang wrote at 2005-5-10 09:26 -0700:
what are the dtml for logout of an account  and deleting a existing user??

When you are using basic HTML authentication,
then logout is a browser operation (and not a server one).

You can use the following DTML Method to facilitate logout somehow

dtml-var standard_html_header
h2dtml-var title_or_id dtml-var document_title/h2
p
dtml-if AUTHENTICATED_USER.getUserName() != 'Anonymous User'
  dtml-raise Unauthorized/dtml-raise
/dtml-if
You have been logged out.
/p
dtml-var standard_html_footer

When you visit it, the browser login dialog appears.
When you enter wrong (!) login information, you get logged out.

As you see, not a very intuitive way (but the only one the
server can used without Javascript (and I do not know any Javascript
solution).


The deletion of a user is a UserFolder operation.
Look at the methods it provides (either look at the source
or use DocFinder or the DocFinder Tab).


-- 
Dieter
___
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] ValueError: I/O operation on closed file

2005-05-11 Thread Dieter Maurer
Brian Hickey wrote at 2005-5-10 21:09 +0100:
Relative newbie to Zope, trying to install Plone on FreeBSD.  Have run into 
the following problem:
- I have followed the instructions as per the guide at 
http://www.netvironments.org/laurazWiki/InstallingPlone
- After copying the directories into the lib/python/Products directory, I 
restart Zope, and it doesn't throw any errors.  However, on visiting my 
website installation (which had been working fine up to the file copy and 
subsequent restart), I get the message:
 ...
Module ZODB.FileStorage, line 620, in _load 
ValueError: I/O operation on closed file 

My setup is as follows:
OS - FreeBSD 4.7-RELEASE-p28 (Virtual Private Server setup)
Python - 2.3.4
Zope - 2.6.3

Do you really mean Zope 2.6.3?
This would be a bit old. Few of us could look at the code
mentioned in your traceback (as we have much newer versions).

On line 620 of your .../ZODB/FileStorage.py,
you perform an IO operation on a file which is closed.

Determine which file this is and where it gets closed.

-- 
Dieter
___
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] Underscoring Inaugural Address

2005-05-11 Thread Dan Pozmanter



Hello there 
Zopatistas,

 In my 
inaugural post, I should like to enquire about getting to a url like 
so:
http://myzopeserver.something.clever/a/path/to/a/file/named/__init__.py

Getting to the 
object "__init__.py" is difficult (it acts like it doesn't 
exist.)

Is there a way to 
muck about with getattr, traversal, or something related so
that, for a 
particular kind of object (eg with a particular attribute), Zope 
ignores
the "cannot start 
with a '_' "rule?

I notice that the 
cvs.zope.org seems to transparently solve this problem,
so presumably (if 
said interface is on a zope instance), this is solvable.

Cheers,
Dan
___
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] Underscoring Inaugural Address

2005-05-11 Thread Andreas Jung

--On Mittwoch, 11. Mai 2005 15:00 Uhr -0400 Dan Pozmanter 
[EMAIL PROTECTED] wrote:
Is there a way to muck about with getattr, traversal, or something
related so
that, for a particular kind of object (eg with a particular attribute),
Zope ignores
the cannot start with a '_'  rule?
I think it is a bad idea trying to be tricky :-)
I notice that the cvs.zope.org seems to transparently solve this
problem,
so presumably (if said interface is on a zope instance), this is
solvable.
cvs.zope.org does not run on Zope :-)
-aj

pgpE9319E8SAD.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] Underscoring Inaugural Address

2005-05-11 Thread J Cameron Cooper
Dan Pozmanter wrote:
Hello there Zopatistas,
 
   In my inaugural post, I should like to enquire about getting to a url 
like so:
http://myzopeserver.something.clever/a/path/to/a/file/named/__init__.py
 
Getting to the object __init__.py is difficult (it acts like it 
doesn't exist.)
 
Is there a way to muck about with getattr, traversal, or something 
related so
that, for a particular kind of object (eg with a particular attribute), 
Zope ignores
the cannot start with a '_'  rule?
 
I notice that the cvs.zope.org seems to transparently solve this problem,
so presumably (if said interface is on a zope instance), this is solvable.
Probably, but it would be difficult. I don't even know enough about 
screwing with traversal to advise. By file what exactly do you mean?

I wonder if LocalFS deals with this problem? If it allows _filenames, 
perhaps you can stead something from there.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.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: [Zope] Underscoring Inaugural Address

2005-05-11 Thread Paul Winkler
On Wed, May 11, 2005 at 03:00:02PM -0400, Dan Pozmanter wrote:
 Hello there Zopatistas,
  
In my inaugural post, I should like to enquire about getting to a url
 like so:
 http://myzopeserver.something.clever/a/path/to/a/file/named/__init__.py
  
 Getting to the object __init__.py is difficult (it acts like it
 doesn't exist.)

Objects whose names begin with underscores are not publishable.
The code is in lib/python/ZPublisher/BaseRequest.py
and there is no easy way to override this behavior.

-- 

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: [Zope] Underscoring Inaugural Address

2005-05-11 Thread Dan Pozmanter
Ugh.  I suppose I could ignore the '_' bit (and override
BaseRequest.traverse), but the problems are: 
1.  Keeping this thing synced with Zope.
2.  Accessing the object being traversed to to ensure it is of the
correct type.

There is no other way to do this?

Is there a way to have a path pretend it is different?
Could messing with __browser_default__ yield any useful results?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Paul Winkler
Sent: Wednesday, May 11, 2005 3:45 PM
To: zope@zope.org
Subject: Re: [Zope] Underscoring Inaugural Address

On Wed, May 11, 2005 at 03:00:02PM -0400, Dan Pozmanter wrote:
 Hello there Zopatistas,
  
In my inaugural post, I should like to enquire about getting to a 
 url like so:
 http://myzopeserver.something.clever/a/path/to/a/file/named/__init__.p
 y
  
 Getting to the object __init__.py is difficult (it acts like it 
 doesn't exist.)

Objects whose names begin with underscores are not publishable.
The code is in lib/python/ZPublisher/BaseRequest.py
and there is no easy way to override this behavior.

-- 

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 )
___
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] Underscoring Inaugural Address

2005-05-11 Thread Paul Winkler
On Wed, May 11, 2005 at 03:50:00PM -0400, Dan Pozmanter wrote:
 Ugh.  I suppose I could ignore the '_' bit (and override
 BaseRequest.traverse), but the problems are: 
 1.  Keeping this thing synced with Zope.
 2.  Accessing the object being traversed to to ensure it is of the
 correct type.
 
 There is no other way to do this?

Do you have to use URL traversal to reach the final object?
There's no such restriction on query parameters.

http://foo.com/get_file?name=__init__.py

-- 

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 )


[Zope] How to make a ZPT-based form that calls itself?

2005-05-11 Thread Ken Winter
Hi Zopers -

I'm trying to make a ZPT-based HTML form that:

1. Displays the records in a MySQL 'Person' table;
2. Offers a field for updating this table (in my simple test example, it
accepts the Id of a Person to delete);
3. When you push its 'Submit' button, updates the database; and then
4. Automatically redisplays itself, showing the updated 'Person' records.

After a lot of help from the folks on various Zope lists, I've made it
through steps 1-3, but I'm stuck on step 4 and I can't find an example or
tutorial telling me how to do it.

The relevant code snippets are:

The ZPT's body...

table width=100% height=100% border=0 cellpadding=6
cellspacing=0
  tr 
td width=1084 height=531 align=left valign=topfont
color=#00 face=Verdana, Arial, Helvetica, sans-serif!--
InstanceBeginEditable name=Base --
  h1 People (deletion test)/h1
  table tal:repeat=row here/dbobs/read_all_people width=100%
border=0 cellspacing=0 cellpadding=0font face=Verdana, Arial,
Helvetica, sans-serif
tr 
  td width=44% tal:content=string:${row/person_id} -
${row/first_name} ${row/middle_names} ${row/last_name}Filler/td
  td width=56%nbsp;/td
/tr
  /table
  p/p
  form action=dbobs/delete_person_py method=post
name=delete_form
pId of Person To Delete: 
  input type=text name=person_id:int /
/p
p 
  input name=do_delete type=submit id=do_delete value=Delete
this Person /
/p
  /form
  pThe quot;Idsquot; are the numbers in front of each person's
name./p
  pa href=deltest.htmRefresh This Page/a/p
  p tal:replace=python:here.dbobs.test1('MyParamValue')Junk/p 
  !-- InstanceEndEditable --/font/td
  /tr
/table

...The one-line Python script delete_person_py that the form's action
attribute calls...

container.delete_person(person_id=context.REQUEST.get('person_id'))

...The Z SQL method delete_person(person_id) that the Python script calls...

delete from person where dtml-sqltest person_id op=eq type=int

...And a URL to the test page in its current incarnation...

http://dhat.vega.zettai.net/clients/ridhwan/dhr3/deltest.htm 

What's wrong with this page is that you have to hit the Refresh This Page
link to get it to do what I want it to do automatically.

I suspect that what I'm missing is some basic HTML knowledge.  But whatever
it is, I'd appreciate your help in suggesting the missing piece.

- Thanks, Ken


___
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] How to find out the full URL

2005-05-11 Thread J Cameron Cooper
Hong Yuan wrote:
I have a page template, say 'products.pt', which takes 
traverse_subpath[0] as one of the variables, so e.g. the URL:
 http://myserver/products/100
will actually call products.pt, which get 100 from the URL and displays 
it in the template.

Now my question is how can I get the full URL from within the tempalte 
'products.pt'? If I use 'request/URL' it will show 
'http://myserver/products' only, with the subpath somehow dropped. How 
can I get the '/100' part back?
If you simply print the request object, you'll see everything available. 
The CGI environment variables are available: 
http://hoohoo.ncsa.uiuc.edu/cgi/env.html

You can use ACTUAL_URL or URL0 to get the full url+path.
You can use PATH_TRANSLATED or PATH_INFO to get just the path portion.
You can use QUERY_STRING to get the query string.
Ideally, I'd like to get back the whole URL as entered in the browser as 
a string. From the REQUEST I have to put together URL and QUERY_STRING, 
and the section (#xxx) part of the url can not be found in REQUEST.
Unfortunately the CGI vars don't make provision for the anchor component 
or the whole unaltered URL. Don't even know it that's possibly without 
modifying ZPublisher.

		--jcc
--
Building Websites with Plone
http://plonebook.packtpub.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: [Zope] How to make a ZPT-based form that calls itself?

2005-05-11 Thread J Cameron Cooper
Ken Winter wrote:
Hi Zopers -
I'm trying to make a ZPT-based HTML form that:
1. Displays the records in a MySQL 'Person' table;
2. Offers a field for updating this table (in my simple test example, it
accepts the Id of a Person to delete);
3. When you push its 'Submit' button, updates the database; and then
4. Automatically redisplays itself, showing the updated 'Person' records.
After a lot of help from the folks on various Zope lists, I've made it
through steps 1-3, but I'm stuck on step 4 and I can't find an example or
tutorial telling me how to do it.
The relevant code snippets are:
The ZPT's body...
table width=100% height=100% border=0 cellpadding=6
cellspacing=0
  tr 
td width=1084 height=531 align=left valign=topfont
color=#00 face=Verdana, Arial, Helvetica, sans-serif!--
InstanceBeginEditable name=Base --
  h1 People (deletion test)/h1
  table tal:repeat=row here/dbobs/read_all_people width=100%
border=0 cellspacing=0 cellpadding=0font face=Verdana, Arial,
Helvetica, sans-serif
tr 
  td width=44% tal:content=string:${row/person_id} -
${row/first_name} ${row/middle_names} ${row/last_name}Filler/td
  td width=56%nbsp;/td
/tr
  /table
  p/p
  form action=dbobs/delete_person_py method=post
name=delete_form
pId of Person To Delete: 
  input type=text name=person_id:int /
/p
p 
  input name=do_delete type=submit id=do_delete value=Delete
this Person /
/p
  /form
  pThe quot;Idsquot; are the numbers in front of each person's
name./p
  pa href=deltest.htmRefresh This Page/a/p
  p tal:replace=python:here.dbobs.test1('MyParamValue')Junk/p	
  !-- InstanceEndEditable --/font/td
  /tr
/table

...The one-line Python script delete_person_py that the form's action
attribute calls...
container.delete_person(person_id=context.REQUEST.get('person_id'))
...The Z SQL method delete_person(person_id) that the Python script calls...
delete from person where dtml-sqltest person_id op=eq type=int
...And a URL to the test page in its current incarnation...
http://dhat.vega.zettai.net/clients/ridhwan/dhr3/deltest.htm 

What's wrong with this page is that you have to hit the Refresh This Page
link to get it to do what I want it to do automatically.
I suspect that what I'm missing is some basic HTML knowledge.  But whatever
it is, I'd appreciate your help in suggesting the missing piece.
You submit to a script, going that url, and the script is responsible 
for providing the output of the page.

Since you write no output, you see no action in your browser. Some 
browsers may display a blank page, which probably would have been more 
helpful to you.

You want your script to do something. It might print out some text to 
form HTML, but that's nasty. It usually will either (a) call some other 
object, like a page template, to provide output, or (b) do a redirect.

Case A:
  return context.some_page()
Case B:
  context.REQUEST.RESPONSE.redirect('some_page')
In your case, since this is a destructive method, you probably want do a 
redirect, back to your listing.

A more advanced and flexible technique is to use FormController. With 
that, you specify by configuration if you want redirect or traverse and 
where to go based on the results of the script (success, failure, some 
other state.)

		--jcc
--
Building Websites with Plone
http://plonebook.packtpub.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: [Zope] what are the dtml for logout and deleting a existing user??

2005-05-11 Thread Andreas Pakulat
On 11.Mai 2005 - 20:32:33, Dieter Maurer wrote:
 Allen Huang wrote at 2005-5-10 09:26 -0700:
 what are the dtml for logout of an account  and deleting a existing user??
 
 When you are using basic HTML authentication,
 then logout is a browser operation (and not a server one).

Right.

 You can use the following DTML Method to facilitate logout somehow
 
 dtml-var standard_html_header
 h2dtml-var title_or_id dtml-var document_title/h2
 p
 dtml-if AUTHENTICATED_USER.getUserName() != 'Anonymous User'
   dtml-raise Unauthorized/dtml-raise
 /dtml-if
 You have been logged out.
 /p
 dtml-var standard_html_footer
 
 When you visit it, the browser login dialog appears.
 When you enter wrong (!) login information, you get logged out.

That's not necessary, look at the ZMI, there is a logout option in the
dropdown box. I never digged into zmi_logout (IIRC it has that name)
but I think it is not accessible by _any_ Zope-User even not the
Emergency User, so regardless of what you type in the Login-dialog you
get logged out. The only problem I find is that you get presented a
login dialog which always fails to login and this is a bit weird as
logout-action.

Andreas

-- 
Never be led astray onto the path of virtue.
___
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] Z SQL Methods and the SQL LIMIT clause

2005-05-11 Thread Asad Habib
Is there a reason why Z SQL methods do not allow the use of the LIMIT
clause? I am absolutely certain that my query has the right syntax since I
executed it against the MySQL server and it gave me the correct results.
FYI, I have provided the query below:

SELECT course_id FROM course
WHERE course_id  991000
ORDER BY course_id DESC LIMIT 1

Furthermore, Zope throws the following error when I try to test this query
via the ZMI and also when I use it in my application:

(1064, You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'LIMIT 1000' at line 3)

Any help would be appreciated. Thank you.

- Asad
___
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] what are the dtml for logout and deleting a existing user??

2005-05-11 Thread Jens Vagelpohl
On May 11, 2005, at 22:32, Andreas Pakulat wrote:
That's not necessary, look at the ZMI, there is a logout option in the
dropdown box. I never digged into zmi_logout (IIRC it has that name)
but I think it is not accessible by _any_ Zope-User even not the
Emergency User, so regardless of what you type in the Login-dialog you
get logged out. The only problem I find is that you get presented a
login dialog which always fails to login and this is a bit weird as
logout-action.
That's only as weird as basic HTTP auth itself. There *is* no other  
way to make the browser discard the credentials you typed in other  
than to tell the browser that an access is unauthorized, which will  
then always pop up the login box again.

This has nothing to do with Zope, it's just basic HTTP auth.
jens
___
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] Z SQL Methods and the SQL LIMIT clause

2005-05-11 Thread Andy Dustman
On 5/11/05, Asad Habib [EMAIL PROTECTED] wrote:
 Is there a reason why Z SQL methods do not allow the use of the LIMIT
 clause? I am absolutely certain that my query has the right syntax since I
 executed it against the MySQL server and it gave me the correct results.
 FYI, I have provided the query below:
 
 SELECT course_id FROM course
 WHERE course_id  991000
 ORDER BY course_id DESC LIMIT 1
 
 Furthermore, Zope throws the following error when I try to test this query
 via the ZMI and also when I use it in my application:
 
 (1064, You have an error in your SQL syntax; check the manual that
 corresponds to your MySQL server version for the right syntax to use near
 'LIMIT 1000' at line 3)

LIMIT is not a standard SQL clause. ZMySQLDA uses it internally, based
upon the max_row properties of the Z SQL Method. If you want to use
it, get rid of the LIMIT clause in your query, and set the max_rows
property accordingly. Also, you can trick ZMySQLDA into not adding a
LIMIT by putting a comment before your SQL statement.

http://www.zope.org/Members/adustman/Tips/no_limits
-- 
Computer interfaces should never be made of meat.
http://www.terrybisson.com/meat.html
___
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] How to make a ZPT-based form that calls itself?

2005-05-11 Thread Ken Winter
 -Original Message-
 From: J Cameron Cooper [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, May 11, 2005 4:27 PM
 To: [EMAIL PROTECTED]
 Cc: zope@zope.org
 Subject: Re: [Zope] How to make a ZPT-based form that calls itself?
 
 Ken Winter wrote:
  Hi Zopers -
 
  I'm trying to make a ZPT-based HTML form that:
 
  1. Displays the records in a MySQL 'Person' table;
  2. Offers a field for updating this table (in my simple test example, it
  accepts the Id of a Person to delete);
  3. When you push its 'Submit' button, updates the database; and then
  4. Automatically redisplays itself, showing the updated 'Person'
 records.
 
  After a lot of help from the folks on various Zope lists, I've made it
  through steps 1-3, but I'm stuck on step 4 and I can't find an example
 or
  tutorial telling me how to do it.
 
  The relevant code snippets are:
 
  The ZPT's body...
 
  table width=100% height=100% border=0 cellpadding=6
  cellspacing=0
tr
  td width=1084 height=531 align=left valign=topfont
  color=#00 face=Verdana, Arial, Helvetica, sans-serif!--
  InstanceBeginEditable name=Base --
h1 People (deletion test)/h1
table tal:repeat=row here/dbobs/read_all_people width=100%
  border=0 cellspacing=0 cellpadding=0font face=Verdana, Arial,
  Helvetica, sans-serif
  tr
td width=44% tal:content=string:${row/person_id} -
  ${row/first_name} ${row/middle_names} ${row/last_name}Filler/td
td width=56%nbsp;/td
  /tr
/table
p/p
form action=dbobs/delete_person_py method=post
  name=delete_form
  pId of Person To Delete:
input type=text name=person_id:int /
  /p
  p
input name=do_delete type=submit id=do_delete
 value=Delete
  this Person /
  /p
/form
pThe quot;Idsquot; are the numbers in front of each person's
  name./p
pa href=deltest.htmRefresh This Page/a/p
p tal:replace=python:here.dbobs.test1('MyParamValue')Junk/p
 
!-- InstanceEndEditable --/font/td
/tr
  /table
 
  ...The one-line Python script delete_person_py that the form's action
  attribute calls...
 
  container.delete_person(person_id=context.REQUEST.get('person_id'))
 
  ...The Z SQL method delete_person(person_id) that the Python script
 calls...
 
  delete from person where dtml-sqltest person_id op=eq type=int
 
  ...And a URL to the test page in its current incarnation...
 
  http://dhat.vega.zettai.net/clients/ridhwan/dhr3/deltest.htm
 
  What's wrong with this page is that you have to hit the Refresh This
 Page
  link to get it to do what I want it to do automatically.
 
  I suspect that what I'm missing is some basic HTML knowledge.  But
 whatever
  it is, I'd appreciate your help in suggesting the missing piece.
 
 You submit to a script, going that url, and the script is responsible
 for providing the output of the page.
 
 Since you write no output, you see no action in your browser. Some
 browsers may display a blank page, which probably would have been more
 helpful to you.
 
 You want your script to do something. It might print out some text to
 form HTML, but that's nasty. It usually will either (a) call some other
 object, like a page template, to provide output, or (b) do a redirect.
 
 Case A:
return context.some_page()
 
 Case B:
context.REQUEST.RESPONSE.redirect('some_page')
 
GREAT!!  Case B works perfectly (and it would have taken me forever to guess
this solution).  Case A didn't work when written as 

return context.deltest.htm()

but, who cares?

 In your case, since this is a destructive method, you probably want do a
 redirect, back to your listing.

Destructive means that the script has a side-effect (deleting the Person),
right?  Why in that case is a redirect better?

 A more advanced and flexible technique is to use FormController. With
 that, you specify by configuration if you want redirect or traverse and
 where to go based on the results of the script (success, failure, some
 other state.)

I'm looking into this - looks promising at first glance.  I note that the
Add dialog warns that these are normally useful only inside a CMF site.
Mine is not (at least currently) a CMF site.  Should I worry about that?

Anyway, thanks so much for getting me over this hurdle!

- Ken


___
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] How to find out the full URL

2005-05-11 Thread Phillip Hutchings
  Ideally, I'd like to get back the whole URL as entered in the browser as
  a string. From the REQUEST I have to put together URL and QUERY_STRING,
  and the section (#xxx) part of the url can not be found in REQUEST.
 
 Unfortunately the CGI vars don't make provision for the anchor component
 or the whole unaltered URL. Don't even know it that's possibly without
 modifying ZPublisher.

Just to add to this, it is not possible to get the #anchor section of
the URL. Web browsers strip it off before sending the request to the
web server, as it's a client side behaviour. I have confirmed this
with IE6 and FireFox 1.0.3.

-- 
Phillip Hutchings
http://www.sitharus.com/
[EMAIL PROTECTED] / [EMAIL PROTECTED]
___
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] How to make a ZPT-based form that calls itself?

2005-05-11 Thread Phillip Hutchings
  Case A:
 return context.some_page()
 
  Case B:
 context.REQUEST.RESPONSE.redirect('some_page')
 
 GREAT!!  Case B works perfectly (and it would have taken me forever to guess
 this solution).  Case A didn't work when written as
 
 return context.deltest.htm()

Of course it didn't, there's no object called deltest and the object
that's not there certainly doesn't have a method called htm. Think
about Python syntax - the . delimits a class containment hierarchy.
Zope allows you to have the . in object names, which I disagree with,
so you have to use getattr(context, 'deltext.htm')() to get the actual
object.

-- 
Phillip Hutchings
http://www.sitharus.com/
[EMAIL PROTECTED] / [EMAIL PROTECTED]
___
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] How to make a ZPT-based form that calls itself?

2005-05-11 Thread J Cameron Cooper
Ken Winter wrote:
-Original Message-
From: J Cameron Cooper [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 11, 2005 4:27 PM
To: [EMAIL PROTECTED]
Cc: zope@zope.org
Subject: Re: [Zope] How to make a ZPT-based form that calls itself?
Ken Winter wrote:
Hi Zopers -
I'm trying to make a ZPT-based HTML form that:
1. Displays the records in a MySQL 'Person' table;
2. Offers a field for updating this table (in my simple test example, it
accepts the Id of a Person to delete);
3. When you push its 'Submit' button, updates the database; and then
4. Automatically redisplays itself, showing the updated 'Person'
records.
After a lot of help from the folks on various Zope lists, I've made it
through steps 1-3, but I'm stuck on step 4 and I can't find an example
or
tutorial telling me how to do it.
The relevant code snippets are:
The ZPT's body...
...
...The one-line Python script delete_person_py that the form's action
attribute calls...
container.delete_person(person_id=context.REQUEST.get('person_id'))
...The Z SQL method delete_person(person_id) that the Python script
calls...
delete from person where dtml-sqltest person_id op=eq type=int
...And a URL to the test page in its current incarnation...
http://dhat.vega.zettai.net/clients/ridhwan/dhr3/deltest.htm
What's wrong with this page is that you have to hit the Refresh This
Page
link to get it to do what I want it to do automatically.
I suspect that what I'm missing is some basic HTML knowledge.  But
whatever
it is, I'd appreciate your help in suggesting the missing piece.
You submit to a script, going that url, and the script is responsible
for providing the output of the page.
Since you write no output, you see no action in your browser. Some
browsers may display a blank page, which probably would have been more
helpful to you.
You want your script to do something. It might print out some text to
form HTML, but that's nasty. It usually will either (a) call some other
object, like a page template, to provide output, or (b) do a redirect.
Case A:
  return context.some_page()
Case B:
  context.REQUEST.RESPONSE.redirect('some_page')
GREAT!!  Case B works perfectly (and it would have taken me forever to guess
this solution).  Case A didn't work when written as 

return context.deltest.htm()
but, who cares?
Look at your Python. It understands a dot as an attribute access. That's 
why Zope historically avoids dotted object names. Witness 'index_html'.

You may use dictionary lookup:
 context['deltest.htm']()
or getattr.
In your case, since this is a destructive method, you probably want do a
redirect, back to your listing.
Destructive means that the script has a side-effect (deleting the Person),
right? 
Correct.
Why in that case is a redirect better?
Because you don't end up on the script (no bad bookmark), and reload of 
that page won't carry the previous POST payload. See the very recent 
post about redirect-after-post.

A more advanced and flexible technique is to use FormController. With
that, you specify by configuration if you want redirect or traverse and
where to go based on the results of the script (success, failure, some
other state.)
I'm looking into this - looks promising at first glance.  I note that the
Add dialog warns that these are normally useful only inside a CMF site.
Mine is not (at least currently) a CMF site.  Should I worry about that?
A Plone site it a superset of a CMF site. But it you're outside a CMF 
framework entirely, formcontroller may not work, as it needs to install 
a tool. Dunno if it'll install standalone.

--jcc
--
Building Websites with Plone
http://plonebook.packtpub.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 )


[Zope] Running out of sockets

2005-05-11 Thread Gaute Amundsen

Coming out of lurk mode here with a really tricky one.

We had just moved our server from:
Zope Version (unreleased version, python 2.3.3, linux2)
Python Version 2.3.3 (#2, Feb 21 2004, 21:17:53) [GCC 3.2.2 20030222 (Red Hat 
Linux 3.2.2-5)] 

To:
Zope Version (Zope 2.7.5-1.fc3, python 2.3.4, linux2)
Python Version 2.3.4 (#1, Feb 2 2005, 11:44:49) [GCC 3.4.3 20041212 (Red Hat 
3.4.3-9.EL4)] 

The first thing we noticed was:

Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /xp/pub/topp/invest/.
Reason: Error reading from remote server
Apache/2.0.52 (Red Hat) Server at www.foo.bar Port 80

( We are running a homegrown virtual host product very similar to the 
virtual host monster behind apache via rewrites.  No ZEO.)

This seems to corespond to a lot of:
PROBLEM(100) ZServer warning: server accept() threw an exception
in the log.

Restarting zope has fixed it for now, but 
lsof -a -U -uzope and lsof -uzope | wc -l
Shows the number of open sockets steadily growing, 
and apparently none closing..

We have not seen the Proxy Error again yet, but it seems pretty certain 
sockets will run out at some point. What to do? Where to dig?

I have found quite a number of references to similar problems by googling 
parts of this, but nothing leading me closer to figuring it out.

ulimit -a shows the limit is 1024
( at 1004 now everything seems fine except the occasional 
PROBLEM(100) XPTopic
seemingly unrelated, not accept() )

netstat -axp gives me loads of lines like this:
unix  2  [ ] STREAM CONNECTED 2792969 572/python  

We have tried various combinations for config options, but without any luck:
force-connection-close on did not seem to make any difference
max-listen-sockets 500 did not keep lsof -a -U -uzope | wc -l from 
exceeding 500.

maximum-number-of-session-objects 1
session-timeout-minutes 90
This should not be related no?

I realize this is becoming a very rambling question, I just thought I would 
include as much info as possible right away :)

Regards

Gaute Amundsen

___
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] How to make a ZPT-based form that calls itself?

2005-05-11 Thread Paul Winkler
On Wed, May 11, 2005 at 04:51:33PM -0500, J Cameron Cooper wrote:
 Look at your Python. It understands a dot as an attribute access. That's 
 why Zope historically avoids dotted object names. Witness 'index_html'.
 
 You may use dictionary lookup:
 
  context['deltest.htm']()
 
 or getattr.

But note that they're not semantically equivalent.
getattr(foo, 'bar')  might use acquisition to find 'bar'.
foo['bar'] does not use acquisition, it only looks directly in foo.

I don't like this difference, but, whatever.

-- 

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 )