Re: [Zope] string formatting
Something like: dtml-call REQUEST.set('signumfix2', signum[0:1] + _.str(_.int(signum[1:4])+1) wont work because you will turn B006 into B7 If you want to retain the leading zeros you will need to pad them. As Andreas said, this would be better done using a python script (which you can call from dtml you dont have to use zpt). Jonathan From: zope-boun...@zope.org [mailto:zope-boun...@zope.org] On Behalf Of Ebbe Kvist Sent: August-13-10 12:17 PM To: zope@zope.org Subject: [Zope] string formatting Hi all, I want to process a variable, signum2, which is picked up from a MySQL database. The content of the variable is B006. The aim is to process this variable so the result will be B007 and it will then be saved as part of a new record in the database. The core process is to increment the integer part of the variable 006 with 1. I have successfully done this incrementation but I have not been able to create a new correct content for the new varable new_xyz. dtml-call REQUEST.set('signumfix2',signum2[1:4]) dtml-call REQUEST.set('signumfix2', _.int(signumfix2)+1) How can I from here create the correct content of the new variable? I need to bring the B part with me and then the incremented integer part formatted with two preceeding zeroes. Does anyone know? Best regards, Ebbe Kvist Stockholm ___ Hitta kärleken med hjälp av vårt matchningstest - Klicka här! http://spray.matchaffinity.se/?mtcmk=614114 ___ Zope maillist - Zope@zope.org https://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] unable to acquire commit lock
Just a guess, but it looks like you are trying to get a transaction lock on a mysql table, so does the mysql table you are using have a storage engine that supports transactions (eg. InnoDB)? Jonathan From: zope-boun...@zope.org [mailto:zope-boun...@zope.org] On Behalf Of iarly selbir | ski0s Sent: February-24-10 8:12 AM To: zope@zope.org Subject: [Zope] unable to acquire commit lock few days ago my I'm getting this errors when trying logging on /manage, googling I don't found any reasonable solution and/or information about, only thing was, restarting zope instances works, thats true Traceback: 2010-02-24T09:43:09 ERROR Zope.SiteErrorLog http://www.mywebsite.com/login_form Traceback (innermost last): Module ZPublisher.Publish, line 125, in publish Module Zope2.App.startup, line 238, in commit Module transaction._manager, line 96, in commit Module transaction._transaction, line 395, in commit Module transaction._transaction, line 498, in _commitResources Module ZODB.Connection, line 726, in tpc_vote Module relstorage.relstorage, line 711, in tpc_vote Module relstorage.relstorage, line 686, in _vote Module relstorage.relstorage, line 593, in _prepare_tid Module relstorage.adapters.mysql, line 506, in start_commit Module relstorage.adapters.mysql, line 672, in _hold_commit_lock StorageError: Unable to acquire commit lock I looked at the code and this function _hold_commit_lock has the following SELECT statement: SELECT GET_LOCK(CONCAT(DATABASE(), '.commit'), %s) I tried to reproduce it querying manually but it looks like an unknown command, and other point, I don't know what Zope put in %s variable. Does anybody already had this problem? Thanks for any reply. Regards, - - iarlyy selbir | ski0s :wq! ___ Zope maillist - Zope@zope.org https://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] generate unique user id, without cookies
after having some weird issues with Sessions and ZEO usage I've found out part of the problem. It turns out certain browsers (IE6 mostly) save the session ID cookies, but sometimes these disappear. This results in a new _ZopeId being generated and thus the new session is empty. At first i thought it was a session product problem, but in recreating this with my own session management (mysql based) the same issue arises. I don't know why this happens, the only obstacle I'm facing now is to create an adequate solution ;) The cookie approach should work. You should be able to set persistent cookies on the client browsers (unless the browser has cookies disabled, in which case you should tell the user that they must enable cookies if they want to proceed). If you can't set persistent cookies then it could be due to a cross-browser scripting problem (ie. you are setting a cookie within an iframe that is loaded from a third-party site) or you are not setting the appropriate fields in the cookie to make it persistent. You should try to investigate the cause of the cookie disappearance (use a tool to look at the http headers that are sent/received). If you can't get cookies to work then you need to give users unique links (ie. embed their id in an html link) or force the users to log in. Jonathan ___ Zope maillist - Zope@zope.org https://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Finding unused products
- Original Message - From: Tres Seaver tsea...@palladion.com To: zope@zope.org Sent: Sunday, November 29, 2009 4:05 PM Subject: Re: [Zope] Finding unused products -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gaute Amundsen wrote: On Sun, 2009-11-29 at 12:32 +0100, Jens Vagelpohl wrote: On Nov 29, 2009, at 11:59 , Gaute Amundsen wrote: Quick question before I reinvent. Is there some established way of finding products which have no instances in zodb, and can be safely removed? No there isn't. You may have to invest some time writing a script that visits all objects to find out what products they belong to. It may not be worth the effort. jens Unfortunately it has not been worth the effort for a number of years, but now it has become unavoidable. Walking the tree it is then. You could probably work directly with the pickles way faster than activating every object in a large site: look at the 'fsdump' script for clues. You could also write a stand-alone python routine to access the zodb (.fs file) directly (should be faster than running a script through a running zope instance and maybe easier than working with pickles). Jonathan ___ Zope maillist - Zope@zope.org https://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Prevent a logger from writing to event.log
- Original Message - From: Bert Vanderbauwhede batlock...@gmail.com To: zope@zope.org Sent: Friday, October 16, 2009 8:07 AM Subject: [Zope] Prevent a logger from writing to event.log Hi, Is it possible to have a logger in Zope that doesn't write to the event.log? All the other loggers can write to the event.log, but just this one logger should not. You can easily build your own: we use an external method that any routine can call to log an event. In one use case we log user actions/activity and the log file is actually a MySQL database (we do this so that we can retrieve, in real-time, previous user actions which we then use to customize what is presented to the user). The advantage of rolling your own is that you can log whatever you want, in whatever format you need, whenever/wherever you need it. Jonathan ___ Zope maillist - Zope@zope.org https://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] apache rules with zope
- Original Message - From: Thomas Bennett bennet...@appstate.edu To: zope@zope.org Sent: Friday, September 04, 2009 2:58 PM Subject: [Zope] apache rules with zope I can access two directories in /var/www but not two others. I have this rule in httpd.conf before the rewrite rules for Zope: RewriteCond %{REQUEST_URI} !^/(usage|zusage|ead2002|asu_ead) The usage and zusage directories work, that is /usage goes to the /var/www/usage directory not looking on Zope/ZODB. Same with the zusage directory. But ead2002 and asu_ead directories give a Not Found error from Zope. The Alias and Directory tags in httpd.conf are the same for all four. You don't usually access underlying file directories directly from zope unless you are using external methods or an add-on product like ExtFile. How are you trying to access these directories? Jonathan ___ Zope maillist - Zope@zope.org https://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] apache rules with zope
- Original Message - From: Thomas Bennett bennet...@appstate.edu To: Jonathan (dev101) dev...@magma.ca Sent: Friday, September 04, 2009 4:09 PM Subject: Re: [Zope] apache rules with zope I'm trying to serve the files on the underlying directories straight through apache with no zope interaction. My main site has all content on zope. I now have content also on the filesystem I want to server without leaving the site. From http://wiki.zope.org/zope2/ZopeAndApache I found I could supposedly use a rewrite condition to do such. So usiing the rewrite condition: RewriteCond %{REQUEST_URI} !^/(usage|zusage|ead2002|asu_ead) I thought would work. I have found why the usage and zusage directories work, there is a usage and zusage directory on the zope system so it hasn't been using the file system at all for any of them. Below is the excerpt from wiki.zope.org that explains how to do this, which doesn't work for me. A lot of site content is in Zope, some parts are served directly by apache For this, we use the RewriteRule? where everything is inside Zope, but slap a RewriteCond? in front of it: RewriteCond %{REQUEST_URI} !^/(stats|manual|static_images) RewriteRule ^(.*) \ http://127.0.0.1:8080/VirtualHostBase/\ http/%{SERVER_NAME}:80/www_example_com/VirtualHostRoot$1 [L,P] Make sure you are directing zope requests to port 8080 and apache (direct file access) requests to port 80 (assuming you have zope listening on 8080). Jonathan ___ Zope maillist - Zope@zope.org https://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Problem with POST and text/xml (work-around)
Problem: zope interprets POST requests with a Content-Type of text/xml to be xmlrpc requests. Work-around (requires Apache as a reverse proxy): use Apache to re-write the Content-Type header of the incoming request before it gets to zope using the following directives: SetEnvIfNoCase Content-Type text/xml XMLFLAG RequestHeader set Content-Type application/xml env=XMLFLAG Zope then sees text/xml requests as application/xml requests and the xml data can then be accessed via REQUEST['BODY']. Thanks to Michael H. for the assistance! 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] Problem with POST and text/xml
- Original Message - From: Andreas Jung li...@zopyx.com To: Jonathan (dev101) dev...@magma.ca Cc: zope@zope.org Sent: Friday, July 10, 2009 4:30 PM Subject: Re: [Zope] Problem with POST and text/xml https://bugs.launchpad.net/zope2/+bug/373663 -aj On 10.07.09 21:24, Jonathan (dev101) wrote: I need to support a third party web service (which is not within my control) that wants to send xml data to my zope server (Zope 2.9.2 running on Redhat linux). When Zope receives a POST request with a Content-Type of text/xml it assumes that it is an xmlrpc call (which it is not - it is just passing xml data within the POST request). Is there a way to get Zope to turn off this xmlrpc assumption so that my zope external method can process the xml data that is being passed? Thanks, Jonathan Thanks for the link! There were some differences between my Zope 2.9.2 installation and the patch instructions: 1) There was no interfaces.py file in the ZPublisher source directory (so I created a new one) 2) There were some differences in the HTTPRequest.py file, but it was still possible to make the changes indicated in the patch instructions. I restarted Zope via the ZMI, and ran a test (which generated a 500 response error). I noticed that there were no pyc/pyo files for interfaces.py and HTTPRequest.py, so I created them manually using py_compile. I restarted Zope and ran another test (using wget to simulate a POST request containing xml data) and got a 503 response: ---response begin--- HTTP/1.0 503 Service Unavailable Server: Zope/(Zope 2.9.2-, python 2.4.2, linux2) ZServer/1.1 Date: Sat, 11 Jul 2009 14:04:08 GMT Bobo-Exception-Line: 402 Content-Length: 995 Bobo-Exception-Value: See the server error log for details Content-Type: text/html; charset=iso-8859-15 Bobo-Exception-Type: NameError Connection: Keep-Alive Bobo-Exception-File: HTTPRequest.py There were no entries in Z2.log or event.log. Other than manually creating pyc/pyo files and re-starting zope, is there anything else I need to do to implement the changes to interfaces.py and HTTPRequest.py? If not, any ideas as to what could be causing this error or how I could go about debugging it? Thanks, 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] Problem with POST and text/xml
- Original Message - From: Michael Haubenwallner mich...@d2m.at To: zope@zope.org Sent: Saturday, July 11, 2009 9:51 AM Subject: Re: [Zope] Problem with POST and text/xml -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jonathan (dev101) wrote: I need to support a third party web service (which is not within my control) that wants to send xml data to my zope server (Zope 2.9.2 running on Redhat linux). When Zope receives a POST request with a Content-Type of text/xml it assumes that it is an xmlrpc call (which it is not - it is just passing xml data within the POST request). Is there a way to get Zope to turn off this xmlrpc assumption so that my zope external method can process the xml data that is being passed? Did you think of using 'application/xml' instead of 'text/xml' ? Everything should work as expected. Regards Michael The POST requests are coming from a third party web service (which we don't control, and they have lots of other users) and they won't change the content-type just for us to work around a zope bug (sigh). ___ 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] Problem with POST and text/xml
As a quick test I modified HTTPRequest.py to turn off the zope assumption that all POST requests with content-type of text/xml are xmlrpc requests. This had the effect of eliminating the xmlrpc error that zope was raising, but a side effect is that the xml data is not available within the REQUEST object. I don't think the patch submitted for bug 373663 will fix this behaviour (ie. it will resolve the xmlrpc error, but it won't make the xml data contained within the POST request available). Any ideas on how to get access to the xml data?! (and re-writing the entire app with Grok is not something I really want to do!) Thanks, 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 )
[Zope] Problem with POST and text/xml
I need to support a third party web service (which is not within my control) that wants to send xml data to my zope server (Zope 2.9.2 running on Redhat linux). When Zope receives a POST request with a Content-Type of text/xml it assumes that it is an xmlrpc call (which it is not - it is just passing xml data within the POST request). Is there a way to get Zope to turn off this xmlrpc assumption so that my zope external method can process the xml data that is being passed? Thanks, Jonathan P.S. details of a wget session that illustrate the error being generated follows: Setting --header (header) to Content-Type: text/xml Setting --post-data (postdata) to ?xml version=1.0 encoding=ISO-8859-1 ? bulkMtNotification transactionId235006/transactionId triggerId1160/triggerId messagetest #27/message date2007-09-14 15:52:59/date phoneNumber+11234567890/phoneNumber carrierId26/carrierId carrierNameSprint/carrierName shortCode5/shortCode /bulkMtNotification DEBUG output created by Wget 1.10.2 (Red Hat modified) on linux-gnu. --16:12:28-- http://192.168.123.2:8080/Coz/Process3Ci = `Process3Ci.1' Connecting to 192.168.123.2:8080... connected. Created socket 3. Releasing 0x00638c60 (new refcount 0). Deleting unused 0x00638c60. ---request begin--- POST /Coz/Process3Ci HTTP/1.0 User-Agent: Wget/1.10.2 (Red Hat modified) Accept: */* Host: 192.168.123.2:8080 Connection: Keep-Alive Content-Type: text/xml Content-Length: 390 ---request end--- [POST data: ?xml version=1.0 encoding=ISO-8859-1 ? bulkMtNotification transactionId235006/transactionId triggerId1160/triggerId messagetest #27/message date2007-09-14 15:52:59/date phoneNumber+11234567890/phoneNumber carrierId26/carrierId carrierNameSprint/carrierName shortCode5/shortCode /bulkMtNotification] HTTP request sent, awaiting response... ---response begin--- HTTP/1.0 500 Internal Server Error Server: Zope/(Zope 2.9.2-, python 2.4.2, linux2) ZServer/1.1 Date: Fri, 10 Jul 2009 20:12:28 GMT Bobo-Exception-Line: 742 Content-Length: 849 Bobo-Exception-Value: See the server error log for details Content-Type: text/html; charset=iso-8859-15 Bobo-Exception-Type: ResponseError Connection: Keep-Alive Bobo-Exception-File: xmlrpclib.py ---response end--- 500 Internal Server Error Registered socket 3 for persistent reuse. ___ 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] Error packing database
- Original Message - From: Fabian Schoeck fabian.scho...@physik.uni-erlangen.de To: zope@zope.org Sent: Wednesday, May 27, 2009 4:08 AM Subject: [Zope] Error packing database I searched the web for help, but did not find anything really helpful. Is this due to some timeout of the web browser? The Data.fs is quite large (7 GB). Should I rather pack the data base via shell and not using the ZMI? What is the command to do so? Google manage_pack. 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] define library path for python external method
snip I use python script as an external method, Do you know how to define the python libraries path. I get an error No module named . /snip Here is something I use in external methods: EXTDIR = '/apps/zope/Extensions' import sys if EXTDIR not in sys.path: sys.path.append(EXTDIR) hth 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] auto login user
If you are using a form-processor routine (ie. some routine which examines login id/pwd entered by user on a form), then you could send the demo-ee a link, which contains the id/pwd as url parameters, and directly calls the form processor routine. - Original Message - From: ga...@schoolteachers.co.uk To: zope@zope.org Sent: Thursday, April 30, 2009 7:14 AM Subject: [Zope] auto login user How could I automatically/programmatically log in an existing user when anyone visits a zope site? I am doing this because I want to demo an application on the web without needing a login. I am using an authenticated user in the application to retrieve data from a database that is specific to that user. Regards Garry ___ 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 ) No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.12.8/2086 - Release Date: 04/29/09 06:37:00 ___ 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 prevent URL access to an external method?
Within the ExternalMethod you could check the ACTUAL_URL variable (in REQUEST) and if the name of the external method is found you could redirect the user to a you're a baaad user page. Jonathan - Original Message - From: Pedro LaWrench pedrolawre...@yahoo.com To: zope@zope.org Sent: Tuesday, April 28, 2009 11:04 AM Subject: [Zope] how to prevent URL access to an external method? I need to do something on the filesystem, which requires unrestricted python, so I created an external method. The problem is that anyone can call that directly via URL, so I added a permission check. Even then, users with the sufficient permissions can call this via URL, which I don't want them to do. I only want them to have access indirectly from other pages (such as a page template that will pass sane parameters). Is there anyway to do this? Thanks, PL ___ 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 ) No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.12.6/2084 - Release Date: 04/28/09 06:15:00 ___ 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-dev] Defining Zope 3.
How about starting with Zope 3 Toolkit and then moving to Zope Toolkit after a year or so. This evolutionary approach may address some of the issues that have been raised: - there would be no sudden disappearance of Zope 3, eliminating the idea that the Zope 3 concept is an evolutionary dead-end - it would use the Zope 3 brand to introduce the concept of the Toolkit This approach is used in the retail industry whenever a brand is being repositioned and the brand owner wants to move as many customers as possible to the new brand. It retains the value/goodwill associated with the old brand while building value/goodwill for the new brand. Jonathan - Original Message - From: Lennart Regebro rege...@gmail.com To: srich...@cosmos.phy.tufts.edu Cc: Tres Seaver tsea...@palladion.com; Martijn Faassen faas...@startifact.com; zope-dev@zope.org Sent: Sunday, April 19, 2009 5:00 AM Subject: Re: [Zope-dev] Defining Zope 3. On Sun, Apr 19, 2009 at 04:43, Stephan Richter srich...@cosmos.phy.tufts.edu wrote: On Thursday 16 April 2009, Tres Seaver wrote: I would rather that we stop pushing the Zope 3 brand now, I would rather keep the name Zope 3. That's too bad, as it means that after all this discussion were are back to status quo on the branding situation: Complete and utter confusion. Except possibly that we now with the toolkit are in an even worse position, as it is evident from this thread that we get confusion not only between Zope 2 and Zope 3, Zope and Zope corp, but also between Zope 3 and the Zope Toolkit. If we keep the name Zope 3, we are still in that confused situation. It will make it hard to get more people to use the Zope technologies, no matter which variant we are talking about. Obviously, as the Zope 3 release manager it is ultimately up to you do decide what you call the releases, but I thought I would just do this last pleading for getting us out of the branding swamp we are in. -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64 ___ 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 ) No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.12.0/2066 - Release Date: 04/18/09 09:55:00 ___ 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 )