Re: [Zope-DB] ZSQL Question - Insert multiple rows in one statement?
Garry Saddington wrote: Andreas Jung wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I would assume that you can use DTML-IN for looping and generating multiple SQL statements of the same kind. You have to ensure that the statements having a proper delimiter (there was something in DTML?! DTML-SQLDELIMITER?...no idea, you need to checks the docs of this ancient technology). oops: dtml-var sql_delimiter code in snippets is correct though. sorry Garry Andreas is correct but the delimiter is dtml-sql_delimiter. Probably better to do this in python script, but here are some code snippets to help you: In the form: select name=seasons:list multiple=multiple In the ZSQL method: dtml-in seasons dtml-var sql_delimiter insert statement goes here, don't forget the ; at the end. /dtml-in Hope this is of some help, others may want to chip in with other suggestions, such as doing the same in python. Anyway good luck. Garry ___ Zope-DB mailing list Zope-DB@zope.org https://mail.zope.org/mailman/listinfo/zope-db ___ Zope-DB mailing list Zope-DB@zope.org https://mail.zope.org/mailman/listinfo/zope-db
Re: [Zope] Storing DTML in SQL
Justin Dunsworth wrote: I am currently working on a project where I am storing HTML within a MySQL database to display dynamic pages and content in sequences. I would like to be able to store DTML within the tables as well and be able to call them within the page to display that content. I tried mixing the DTML in with the HTML and it shows the HTML correctly but no DTML. Is it possible to even do this? Are there other suggestions on how to go about this? The closest I have found is on Zopelabs (http://www.zopelabs.com/cookbook/1078612026) Regards Garry ___ 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] Storing DTML in SQL
Garry Saddington wrote: Justin Dunsworth wrote: I am currently working on a project where I am storing HTML within a MySQL database to display dynamic pages and content in sequences. I would like to be able to store DTML within the tables as well and be able to call them within the page to display that content. I tried mixing the DTML in with the HTML and it shows the HTML correctly but no DTML. Is it possible to even do this? Are there other suggestions on how to go about this? The closest I have found is on Zopelabs (http://www.zopelabs.com/cookbook/1078612026) Sorry wrong recipe try this: http://www.zopelabs.com/cookbook/993850737/1011691351 Garry ___ 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] Storing DTML in SQL
Andrew Milton wrote: +---[ Garry Saddington ]-- | Garry Saddington wrote: | Justin Dunsworth wrote: | I am currently working on a project where I am storing HTML within a | MySQL database to display dynamic pages and content in sequences. I | would like to be able to store DTML within the tables as well and be | able to call them within the page to display that content. I tried | mixing the DTML in with the HTML and it shows the HTML correctly but no | DTML. | | Is it possible to even do this? Are there other suggestions on how to go | about this? | | The closest I have found is on Zopelabs | (http://www.zopelabs.com/cookbook/1078612026) | | Sorry wrong recipe try this: | | http://www.zopelabs.com/cookbook/993850737/1011691351 Do I really have to explain why that particular recipe is a bad idea? d8) Just trying to be helpful. I did say that it was the only thing I can find and I did not recommend it. If you would care to share the problems of the recipe on the list then I am sure all those reading who are new to Zope would benefit;) Garry ___ 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 )
[Zope] Placeless Translation service
I am using PTS to translate our application and it works perfectly in every browser except IE8. Can anyone cast any light on why IE8 may not work? Regards garry ___ 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 )
[Zope] run raw sql
Is there any way to run raw sql statements from within a python script? Any help at all much appreciated. Thanks Garry ___ 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 )
[Zope] cookie crumbler
I have just been reading a Z2 log and have noticed that when I am logged in as a manager my username is displayed in the log, however when logged in using cookie crumbler as a normal user only 'Anonymous' appears as the user name in the log. Is there some way to make the correct user name appear in the log? AUTHENTICATED_USER returns the correct user name. I am using Zope 2.9.0. Thanks Garry ___ 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 )
[Zope] javascript experts?
I am using some dynamic javascript to build form input controls and I have got everything working perfectly in all browsers except IE. The javascript uses square bracket notation to allow the phones.number:records to build multiple database input records for Zope. if (eval(document.forms.playlist['phones.number:records'][ + idx + ].value) 0) However,IE interprets it as: document.forms.playlist.phones.number:records and of course therefore does not find the element referenced. Can anyone suggest a workaround for IE in this respect. Thanks Garry ___ 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 )
[Zope] cron like service
Can anyone suggest the easiest way to automatically have a python script fire at set times of the day/month/year. Regards Garry attachment: garry.vcf___ 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] cron like service
Chris Withers wrote: Garry Saddington wrote: Can anyone suggest the easiest way to automatically have a python script fire at set times of the day/month/year. I just use Stepper and fire it from cron ;-) http://www.simplistix.co.uk/software/zope/stepper Chris Just got TimerService and ZopeScheduler working. Thanks for all the suggestions. Garry attachment: garry.vcf___ 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] javascript problem
Jaroslav Lukesh wrote: Did You have the number field in the hidden layer? - Original Message - From: Garry Saddington ga...@schoolteachers.co.uk I'm using the following javascript to gather phones:number values for form submission. for (var idx = 1; idx max; idx++) { if (eval(document.forms.playlist['phones.number:records'][ + idx + ].value) 0) Has anyone got any idea why it works fine in every browser (Safari,FF,Chrome,Webkit) but not in ie8 where I get this error: Message: 'document.forms.playlist.phones.number:records.1.value' is null or not an object The form fields are dynamically created in javascript as table rows as the user adds more options, the first row is in a hidden layer. Garry ___ 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] javascript problem
Jaroslav Lukesh wrote: - Original Message - From: Jaroslav Lukesh luk...@seznam.cz I think that you have bad code - see your error message. So try somethong like: document.forms.playlist.phones.number[1] instead of document.forms.playlist.phones.number:records.1.value Oh, sorry, javascript, not python :o) JL That's OK, thanks for trying. Garry ___ 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 )
[Zope] javascript problem
I'm using the following javascript to gather phones:number values for form submission. for (var idx = 1; idx max; idx++) { if (eval(document.forms.playlist['phones.number:records'][ + idx + ].value) 0) Has anyone got any idea why it works fine in every browser (Safari,FF,Chrome,Webkit) but not in ie8 where I get this error: Message: 'document.forms.playlist.phones.number:records.1.value' is null or not an object Any help appreciated, but I am not surprised that ie errors, it usually does. Garry ___ 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 )
[Zope] preventing form submission
Has anyone any suggestions as to how to prevent form submission by the using pressing the refresh or back buttons? Garry ___ 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 )
[Zope] python help needed
I am trying to upload a csv file (called data) using the following script: i=0 d=data.readlines() for row in d: i+=1 a=row.split(',') if i 1: subjectid=a[0] entry=a[1] type=a[2] studentid=a[3] try: context.insertestimatesandtargets(subjectid=subjectid,entry=entry,type=type,studentid=studentid) except: continue return something good (email editor messed up indentation) insertestimatesandtargets() is a ZSQLmethod. When the call to this method results in an error the script stops and not all data is inserted. Without an error all the data is inserted. So how can I make this script skip over errors and continue? The reason is that there may already be some data in the database table that I want to preserve. regards Garry ___ 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] python help needed
Andrew Milton wrote: +---[ Garry Saddington ]-- | I am trying to upload a csv file (called data) using the following script: | | i=0 | d=data.readlines() | for row in d: | i+=1 | a=row.split(',') | if i 1: | subjectid=a[0] | entry=a[1] | type=a[2] | studentid=a[3] | try: | | | context.insertestimatesandtargets(subjectid=subjectid,entry=entry,type=type,studentid=studentid) | except: | continue | return something good | | (email editor messed up indentation) | | insertestimatesandtargets() is a ZSQLmethod. When the call to this | method results in an error the script stops and not all data is | inserted. Without an error all the data is inserted. | So how can I make this script skip over errors and continue? The reason | is that there may already be some data in the database table that I want | to preserve. The try/except block should prevent the script from failing when calling the ZSQL method (assuming your indenting *is* correct in the python script [look for mixed tabs/spaces, since in the email some of your indents are 8 and some are 4]). No all correct - Thunderbird not allowing me to edit the text. Your other option is to do transaction sub-commits manually (there's plenty of google links for how to do this). You probably can't do this directly from a python script, you'll have to setup an External Method to do it (or alter the security for the transaction machinery). Yes, thanks I thought that was the problem. I've already sorted it with external methods. Garry ___ 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 )
[Zope] dynamically call zsqlmethod
I am passing a variable named 'column' to the following script and trying to fill a select box with the result of a zsqlmethod chosen dynamically using this variable. print select name=nonboolean method=post command=context.column() for row in command: code=row.code meaning=row.meaning print option value=%s%s/option (code,meaning) print /select return printed I can not work out how to substitiute the command with the variable, any help much appreciated. Regards Garry ___ 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] dynamically call zsqlmethod
Jeff Peterson wrote: IF it's a variable passed to the script wouldn't you simply access it as 'column'? Also, is it a variable or a function? Or is the variable the name of a function somewhere? If it's the former just call it: column(). If it's the latter, Andreas should be correct, getattr(context, column)() or possible context[column] if you like that better. Thanks, Andreas' solution works for me. Regards Garry ___ 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] zope2.zope.org launched
Andreas Jung wrote: I am pleased to announce the launch of a new website dedicated to the Zope 2 application server: zope2.zope.org This site gives the Zope 2 application a much better representation on the web (which was more than necessary after having lived for years with the current old www.zope.org site). Nice work and thank you. Garry attachment: garry.vcf___ 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 )
[Zope] moving a zope install
Before I investigate any further perhaps someone here may be able to save me a little time. Is it possible to move a zope installation from one directory to another and have zope.conf pick up the correct paths dynamically? I've looked at the zope on a cd but I want the db to be writeable. Thanks 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 )
Re: [Zope] external method
Chris Withers wrote: Garry Saddington wrote: I have the following external method to back up a postgres database, using the following software versions. Why on earth would you not just do this in a cron job?! Chris Because I want the backup to be done manually, through the web from anywhere. 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 )
Re: [Zope] external method
Garry Saddington wrote: Chris Withers wrote: Garry Saddington wrote: Because I want the backup to be done manually, That doesn't seem like such a hot idea. Something that's easilly forgotten. Thanks, I've sorted it. Turns out that pg_dump was being run by SYSTEM and not by the Zope effective user as I thought. Changed the command to include -U scholarpack and all works fine. Thanks for help. 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 )
[Zope] external method
I have the following external method to back up a postgres database, using the following software versions. Zope Version (Zope 2.9.0, python 2.4.2, win32) Python Version 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] System Platform win32 Zope is running as user scholarpack who is an administrator on win server 2008. / import subprocess def backup(): try: p=subprocess.Popen(c:/scholarpack/postgres/bin/pg_dump scholarpack,shell=True,stdout=subprocess.PIPE) data=p.communicate()[0] f=open('c:/scholarpack/ancillary/scholarpack.sql','w') w=f.write(data) f.close() except OSError: print There was a problem opening the file for writing /When I run this through Zope I get an empty file. There are no errors reported. However, if I use the same python that is running zope in an interactive shell and run these commands then it works as expected. Can anyone spot what I am obviously missing? 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 )
[Zope] appending paths in zpt
I have this: tal:attributes=href here/getUserName in a link that works but I want to append a hard coded extension to it. How would I turn it into this and get it to work ? tal:attributes=href here/getUserName/listview?page=1000 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 )
Re: [Zope] appending paths in zpt
On Monday 12 January 2009 20:45, Thibaud Morel l'Horset wrote: Sounds like you need to use a string: tal:attributes=href string:${here/getUserName}/listView?page=1000 Thanks that's done it 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 )
[Zope] cron or time server
Does anyone know of a time/cron server for Zope that works. I want to be able to schedule a script to run every hour or so? 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 )
Re: [Zope] problem with a form in IE 7
On Monday 15 December 2008 15:04, Peter Bengtsson wrote: 2008/12/15 ga...@schoolteachers.co.uk: Quoting Peter Bengtsson pete...@gmail.com: Has nothing to do with Zope but... Use Firefox to debug it and you'll get to see the error. put method=post on form tag and the submission won't be visible in the URL. I've had this happen with method=get in the past. Changing to post fixed it but... May be worth checking zope.conf: Directive: http-header-max-length # # Description: # Maximum number of bytes allowed within a HTTP request header. The request # is discarded and considered as a DoS attack if the header size exceeds # this limit. # # Default: 8192 # # Example: # # http-header-max-length 16384 No. Don't fiddle with that. Get the form right. That's the basics. It might be worth reading up and understanding the basic difference between POST and GET and which to use when. I wasn't suggesting that he fiddles with it, but that someone else may have already fiddled, so therefore to check that the default was still extant. 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 )
Re: [Zope] sorting ids in python
On Tuesday 09 December 2008 03:15, Andreas Jung wrote: On 08.12.2008 21:11 Uhr, robert rottermann wrote: Garry Saddington schrieb: Can anyone help me sort the following by id in a python script? for object in context.objectValues(['Folder', 'DTML Document','ZipFolder','File','Image']): objs=context.objectValues(['Folder', 'DTMLDocument','ZipFolder','File','Image']) objs.sort() for o in objs: .. huh? Afaik there is no sort order defined on a per-object basis. This is my final working solution: ids = context.objectIds(['Folder', 'DTMLDocument','ZipFolder','File','Image']) ids.sort() for object in ids: object=context.restrictedTraverse(object) path=object.absolute_url() ... . Thanks everyone 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 )
[Zope] sorting ids in python
Can anyone help me sort the following by id in a python script? for object in context.objectValues(['Folder', 'DTML Document','ZipFolder','File','Image']): Import of sequence is not authorised in my python scripts, I am presuming (probably wrongly) that sequence is needed for sort. 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 )
[Zope] Obtaining user name in python
I can do this in DTML: dtml-var _.SecurityGetUser().getUserName() but I want to do it from a Python script, where the use of the underscore is not allowed. Can anyone point me in the correct direction? 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 )
Re: [Zope] Was Problem using nested dtml-in with zsql
On Saturday 08 November 2008 21:59, Tim Nash wrote: +1 Well spoken. It is painful to see all the cheers for django templates when dtml has been around longer and is just as good, maybe better. Just had a look. They do the same as dtml but with less functionality. Amusing that something that is dead in one system is the best thing since sliced bread in another! I too appreciate all the work that goes into maintaining Zope, thanks Andreas, long may you continue your contributions. 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 )
Re: [Zope] Was Problem using nested dtml-in with zsql
On Saturday 08 November 2008 06:21, Andreas Jung wrote: Any particular reason for using DTML instead of ZPT? DTML is dead. Firstly let me say that I do not wish to relight the ZPT vs DTML argument, only to make a few points. I find this an extraordinary attitude coming from someone so important to this community. I am sure there are many developments out there relying on DTML and I am also sure that the developers are earning a living from those developments. Will employers be happy that the technology used for their sites is dead ? Will they continue to pay these developers? Can you give one reason why DTML is bad that is not based on personal preference, presentation tools or the cognitive ability of developers to understand where variables are coming from? Does it not work if used properly? If someone comes to Zope and prefers to use DTML then let him, don't criticise instead of help him. Zope is a fantastic piece of software, however it is used, and its use should be encouraged. I prefer DTML and always have done and always will, no matter what this list says and I am sure there are many more like me. DTML is available and is used, let's support it properly on this list. While I was learning Zope I had many questions, but I had to work most of them out myself, not wanting to get lambasted again on this list for using DTML. If help was more forthcoming I'm sure that I would have learned more quickly rather than in relative isolation. Is the ZMI going to be re-written using ZPT? 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 )
[Zope] zope's clipboard
Is there a way to programmatically remove items from the clipboard. 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 )
Re: [Zope] zope's clipboard
On Monday 27 October 2008 17:37, Andreas Jung wrote: On 27.10.2008 18:05 Uhr, Garry Saddington wrote: Is there a way to programmatically remove items from the clipboard. There nothing like a clipboard. The information you consider as clipboard is stored as __cp cookie on the client side. OK, so how do I expire it? expireCookie('__cp') is not working for me 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 )
Re: [Zope] zope's clipboard(solved)
On Monday 27 October 2008 18:35, Garry Saddington wrote: On Monday 27 October 2008 17:37, Andreas Jung wrote: On 27.10.2008 18:05 Uhr, Garry Saddington wrote: Is there a way to programmatically remove items from the clipboard. There nothing like a clipboard. The information you consider as clipboard is stored as __cp cookie on the client side. OK, so how do I expire it? expireCookie('__cp') is not working for me Regards Garry Found it : expireCookie('__cp',path='/') 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 )
Re: [Zope] .html from python
On Friday 17 October 2008 21:30, Andrew Milton wrote: +---[ Garry Saddington ]-- | How would I do this: | | dtml_method = context.singleitemview.html | s = | return s dtml_method = getattr(context, 'singleitemview.html') return dtml_method(client=context, REQUEST={}, foo='bar') Thanks, works great. 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 )
[Zope] changing permissions in python
I have been searching everywhere for the correct syntax to use to change permissions on a dtml method from a python script. I know it could be using manage_changePermissions() but exactly how can I call it on any method. 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 )
[Zope] remote authentication
Is there a way to have two separate zope instances on different machines and have them both authenticate against one acl_users folder on only one of these machines? 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 )
Re: [Zope] remote authentication
On Sunday 31 August 2008 15:10, Andreas Jung wrote: --On 31. August 2008 15:01:24 +0100 Garry Saddington [EMAIL PROTECTED] wrote: Is there a way to have two separate zope instances on different machines and have them both authenticate against one acl_users folder on only one of these machines? By using ZEO? No because I want to use different ZODB's. I have a management information system(MIS) used by teachers where the ZODB does not grow and all data is stored in a Postgres DB. The teachers authenticate against this machine. The students have an eportfolio system that runs on a different Zope server where the ZODB grows when students add work. I would like teachers to be able to log into the MIS and seemlessly visit the other student machine to grade work. As I have it, I would have to duplicate the acl_users folder for the teachers to both machines. It is this duplication that I am trying to do without. 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 )
Re: [Zope] remote authentication
On Sunday 31 August 2008 15:31, Andreas Jung wrote: --On 31. August 2008 15:38:38 +0100 Garry Saddington [EMAIL PROTECTED] wrote: On Sunday 31 August 2008 15:10, Andreas Jung wrote: --On 31. August 2008 15:01:24 +0100 Garry Saddington [EMAIL PROTECTED] wrote: Is there a way to have two separate zope instances on different machines and have them both authenticate against one acl_users folder on only one of these machines? By using ZEO? No because I want to use different ZODB's. What is the problem? You share a common ZODB containing the acl_users folder in the root through ZEO and mount different other ZODBs using ZEO into the mounted main storage. Thanks that sounds perfect, I didn't think about it like that! 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 )
[Zope] iterating over result sets in python
I am trying to iterate over a result set from a zsql method in a python script in Zope 2. In the results is a date field. What I want to do is test whether a date is younger than the date in the previous row by at least 30 days but I am having problems working out how, not coming from a pythonic background. Could anyone point me in the correct direction? 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 )
[Zope] python split
Is it possible to split a string at the first occurence of a non-digit character using a python script in zope, or does this need an external method for security purposes? 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 )
Re: [Zope-DB] Calling SQL Query in DTML Method with a string argument
On Monday 28 July 2008 15:59, Matylda Sawicka wrote: Hello, I am a fresh Zope Explorer. I was trying to call an SQL Query that requires an argument in a DTML Method that would be called with an argument passed in the URL. The Query looks more or less like this: SELECT Uni_Name, Uni_Latitude, Uni_Longitude FROM universities WHERE Uni_Code = dtml-sqlvar givenCode type=string AND Uni_Latitude != NULL whilst the DTML Method consists of: TRY: markers dtml-in expr=uniSingleByCode(givenCode=_['uni_id']) mrk nm=dtml-var Uni_Name lat=dtml-var Uni_Latitude lng=dtml-var Uni_Longitude/ /dtml-in /markers or just let the ZSQL get the argument from the REQUEST: markers dtml-in uniSingleByCode mrk nm=dtml-var Uni_Name lat=dtml-var Uni_Latitude lng=dtml-var Uni_Longitude/ /dtml-in /markers HTH regards Garry ___ Zope-DB mailing list Zope-DB@zope.org http://mail.zope.org/mailman/listinfo/zope-db
[Zope] CMF content types
I would like to use ZipFolder as an addable type in a CMF site. All the documentation I can find is either out of date or confusing. Can anyone help by pointing me to some accurate documentation on this subject. 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 )
Re: [Zope] Bug in ZSQL test?
On Thursday 10 July 2008 20:47, Allen Schmidt Sr. wrote: I know, I know...too old to worry about... Zope 2.8.9.1 on RedHat and MySQL5 In the Test tab of a ZSQL method, where the query has parameters, when we enter parameters that generate a result of more than 20 rows, we get the link for next 20 results. However, the parameters are not getting passed in and the next page shows all the rows as if no parameters passed. Anyone else seen this? Yes Zope 2.9 gives error for the missing parameters on second page. I have just lived with it having seen the error before on this list. 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 )
Re: [Zope] zope stops responding
Thanks for all your help. I have solved the problem with the Deadlock Debugger which showed up threads locked by a call to Aspell. Re-installing Aspell was the solution. I was very impressed with this product and all your assistance. Thanks again 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 )
[Zope] zope stops responding
Following a hard disk crash 2 weeks ago we have installed Zope onto a new server and all was fine until yesterday morning when Zope stopped responding and required a restart to get it working. It did the same at 3-30pm today. We are using Zope 2.9.0 on Centos 5.1 on a quad Zeon server with 4gb. Ram. At the moment the server is in quite heavy use with teachers trying to write reports for a deadline tomorrow. These are sent to a Postgres DB via psycopg. There is nothing in Z2.log or event.log to point me to the problem. I am therefore asking for advice on the sorts of things that can cause Zope to stop responding and whether there is anything we can do to mitigate against such an event. Thanks and 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 )
Re: [Zope] unicode support
On Friday 27 June 2008 00:23, Peter Bengtsson wrote: I would advice against relying on default-zpublisher-encoding. I never used that. By specifying the encoding like this variablename:utf8:ustring you override whatever default-zpublisher-encoding was set to. If you rely on default-zpublisher-encoding your product isn't installable somewhere in another zope without explicit instructions and it might clash with other things installed. Remember, it's just a default. Yes, I know but none of the recommended ways of overriding the default worked for me. Thanks for all your help. I do not intend my product to be installed in any Zope that I do not setup/specify and not with any other product. It will be distributed with its own custom Zope/Postgres distribution. Kind regards and thanks again 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 )
Re: [Zope] unicode support
On Friday 27 June 2008 05:38, Andreas Jung wrote: --On 26. Juni 2008 22:05:06 + Garry Saddington [EMAIL PROTECTED] wrote: On Thursday 26 June 2008 15:12, Andreas Jung wrote: --On 26. Juni 2008 14:09:50 + Garry Saddington [EMAIL PROTECTED] wrote: I am using Zope 2.9 connected to a Posgres DB via psycopg. My database encoding is UTF8. I am getting the following error when users try to insert text in the database containing £ signs: ERROR: invalid byte sequence for encoding UTF8: 0xa3 This is due to the encoding of a £ sign in the text being sent to the DB. My question then is how do I make sure that all encodings submiitted from forms are in the correct UTF8 format? Regards Use ensure that the HTML page uses UTF-8 as encoding (either using meta-equiv... within the HTML page or by sending content-type: text/html; charset=utf-8 as HTTP header. I have taken this a little further after trying all suggestions in the thread with no success and looked into zope.conf, specifically: # Directive: default_zpublisher_encoding # # Description: # This controls what character set is used to encode unicode # data that reaches ZPublisher without any other specified encoding. # # Default: iso-8859-15 # # Example: # #default_zpublisher_encoding utf-8 As my pages all report as iso-8859-15 I thought a change here would help, but this happens: from OFS.content_types import guess_content_type Error: 'default_zpublisher_encoding' is not a known key name It works on this: Zope Version (Zope 2.9.0, python 2.4.2, win32) And fails on this: Zope Version (Zope 2.9.0-, python 2.4.5, linux2) Totally wrong approach modifying the zpublisher encoding here. As said you have two options: - meta http-equiv=Content-Type content=text/html; charset=utf-8 / with in your HTML . tal:call define=dummy python: request.RESPONSE('content-type', 'text/html;; charset=utf-8') / within your template And if I were to use DTML? 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 )
Re: [Zope] unicode support
On Friday 27 June 2008 07:42, Andreas Jung wrote: --On 27. Juni 2008 06:42:28 + Garry Saddington [EMAIL PROTECTED] wrote: On Friday 27 June 2008 05:38, Andreas Jung wrote: --On 26. Juni 2008 22:05:06 + Garry Saddington [EMAIL PROTECTED] wrote: On Thursday 26 June 2008 15:12, Andreas Jung wrote: --On 26. Juni 2008 14:09:50 + Garry Saddington [EMAIL PROTECTED] wrote: I am using Zope 2.9 connected to a Posgres DB via psycopg. My database encoding is UTF8. I am getting the following error when users try to insert text in the database containing £ signs: ERROR: invalid byte sequence for encoding UTF8: 0xa3 This is due to the encoding of a £ sign in the text being sent to the DB. My question then is how do I make sure that all encodings submiitted from forms are in the correct UTF8 format? Regards Use ensure that the HTML page uses UTF-8 as encoding (either using meta-equiv... within the HTML page or by sending content-type: text/html; charset=utf-8 as HTTP header. I have taken this a little further after trying all suggestions in the thread with no success and looked into zope.conf, specifically: # Directive: default_zpublisher_encoding # # Description: # This controls what character set is used to encode unicode # data that reaches ZPublisher without any other specified encoding. # # Default: iso-8859-15 # # Example: # #default_zpublisher_encoding utf-8 As my pages all report as iso-8859-15 I thought a change here would help, but this happens: from OFS.content_types import guess_content_type Error: 'default_zpublisher_encoding' is not a known key name It works on this: Zope Version (Zope 2.9.0, python 2.4.2, win32) And fails on this: Zope Version (Zope 2.9.0-, python 2.4.5, linux2) Totally wrong approach modifying the zpublisher encoding here. As said you have two options: - meta http-equiv=Content-Type content=text/html; charset=utf-8 / with in your HTML . tal:call define=dummy python: request.RESPONSE('content-type', 'text/html;; charset=utf-8') / within your template And if I were to use DTML? DTML? In a similar way...You know dtml-let or something like that. You know that stuff like 'request' 'context' etc. is available in PythonScripts, ZPT and DTML is some way...everything is the same object. Yes, thanks for your help. Kind 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 )
[Zope] unicode support
I am using Zope 2.9 connected to a Posgres DB via psycopg. My database encoding is UTF8. I am getting the following error when users try to insert text in the database containing £ signs: ERROR: invalid byte sequence for encoding UTF8: 0xa3 This is due to the encoding of a £ sign in the text being sent to the DB. My question then is how do I make sure that all encodings submiitted from forms are in the correct UTF8 format? 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 )
Re: [Zope] unicode support
On Thursday 26 June 2008 15:12, Andreas Jung wrote: --On 26. Juni 2008 14:09:50 + Garry Saddington [EMAIL PROTECTED] wrote: I am using Zope 2.9 connected to a Posgres DB via psycopg. My database encoding is UTF8. I am getting the following error when users try to insert text in the database containing £ signs: ERROR: invalid byte sequence for encoding UTF8: 0xa3 This is due to the encoding of a £ sign in the text being sent to the DB. My question then is how do I make sure that all encodings submiitted from forms are in the correct UTF8 format? Regards Use ensure that the HTML page uses UTF-8 as encoding (either using meta-equiv... within the HTML page or by sending content-type: text/html; charset=utf-8 as HTTP header. I have taken this a little further after trying all suggestions in the thread with no success and looked into zope.conf, specifically: # Directive: default_zpublisher_encoding # # Description: # This controls what character set is used to encode unicode # data that reaches ZPublisher without any other specified encoding. # # Default: iso-8859-15 # # Example: # #default_zpublisher_encoding utf-8 As my pages all report as iso-8859-15 I thought a change here would help, but this happens: from OFS.content_types import guess_content_type Error: 'default_zpublisher_encoding' is not a known key name It works on this: Zope Version (Zope 2.9.0, python 2.4.2, win32) And fails on this: Zope Version (Zope 2.9.0-, python 2.4.5, linux2) Any further help would be appreciated. regards Garry ps. just noticed the typo (not mine) in zope.conf - default_zpublisher_encoding should be default-zpublisher-encoding all sorted ___ 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] UTF8 encoding
On Wednesday 18 June 2008 07:56, Tino Wildenhain wrote: Hi Garry, Garry Saddington wrote: I am getting a few of this type of error only coming from Windows machines, does anyone know how to sort this out? ProgrammingError: ERROR: invalid byte sequence for encoding UTF8: 0xa3 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by client_encoding. insert into departmentplanning (planningcategoryid, taskid, subtasks, moneval, timescale, budget, success, subjectid, teacherid) VALUES (1 , 186 , 'Identify suitable tasks and activities for all G+T pupils and students ' , 'ADE- liaise with HS and GE' , 'JUL08 on' , 'SOme activities could be bought in ~£50' , 'All G+T pupils and students given opportunity for enhanced work' , 1787, 41 ) You give us very little to base our suggestions on. From what I see it looks like you are using a RDBMS, seems to be Postgres, and the python binding (psycopg?) reports you this exeption. It also gives you hints about the reasons. Maybe you see if you can follow that? IIRC, recent ZSQL-driver for postgres allow for setting the encoding, you should use that, also setting this in the database for the user you are connecting with should be possible if everything else fails. In any case please try do give more details about your setup. Thanks I traced it to a Postgres client_encoding problem. 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 )
[Zope] UTF8 encoding
I am getting a few of this type of error only coming from Windows machines, does anyone know how to sort this out? ProgrammingError: ERROR: invalid byte sequence for encoding UTF8: 0xa3 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by client_encoding. insert into departmentplanning (planningcategoryid, taskid, subtasks, moneval, timescale, budget, success, subjectid, teacherid) VALUES (1 , 186 , 'Identify suitable tasks and activities for all G+T pupils and students ' , 'ADE- liaise with HS and GE' , 'JUL08 on' , 'SOme activities could be bought in ~£50' , 'All G+T pupils and students given opportunity for enhanced work' , 1787, 41 ) 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 )
[Zope] dtml-tree documentation
Is there a complete documentation of the dtml-tree tag anywhere? The dtml reference of the Zope book has the following for some options: This attribute is for advanced usage only Where can I find out about this 'advanced usage'? 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 )
[Zope] centos
Does anyone have any experience running Zope on Centos 5. I have some Python scripts which just will not work. They work on Windows, Ubuntu, and SuSe but just don't do anything on Centos. I have tried various Zope 2.9.0 and 2.9.6-final, various psycopg connectors and Postgres 8.1 and 8.3. Here is an example script that works everywhere except Centos(excuse email formatting): request=context.REQUEST datefrom=request.datefrom dateto=request.dateto today = DateTime(datefrom) end = DateTime(dateto) auth=request.auth year=request.year while today = end: for result in context.getstudentsbyyear(year=year): studentid=result.studentid if context.getday(today=today): #picks out non-weekend days only if context.checkholidays(today=today): #picks out holidays pass else: context.insertabsence(entered=today,auth=auth,studentid=studentid) today += 1 return b class=redAbsences entered/b Any ideas because I am getting very frustrated here. 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 )
Re: [Zope] centos
On Tuesday 13 May 2008 08:09, Andreas Jung wrote: --On 13. Mai 2008 08:14:05 +0100 Garry Saddington [EMAIL PROTECTED] wrote: Does anyone have any experience running Zope on Centos 5. I have some Python scripts which just will not work. They work on Windows, Ubuntu, and SuSe but just don't do anything on Centos. I have tried various Zope 2.9.0 and 2.9.6-final, various psycopg connectors and Postgres 8.1 and 8.3. Here is an example script that works everywhere except Centos(excuse email formatting): Such functionality should be (and is) basically independent of the OS. If there is an issue, debug the script step-by-step using pdb. I have now traced it to the wrong datestyle in zope.conf - a new server and only half the brain awake!. It was set to US and we use international so the method did not do anything because the entered dates were presented wrongly to the database. Thanks anyway 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 )
[Zope] disappearing external methods
I have recently moved our Zope installation over to a centos server. Since the move all the external methods periodically stop working for no apparent reason and the error is returned as: external method can not be called because it is none The thing is that it works well and then stops. Does anyone have any ideas about this? The installation was not initially compiled on centos as I have a large collection of software as part of the application which can be moved between servers with the Zope installation. The reason for the move to Centos is that DTMLTex fails when trying to run pdflatex on Ubuntu and this seems to be distro specific, with no apparent way to fix it, unless anyone knows any better? Kind 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 )
Re: [Zope] disappearing external methods
On Wednesday 07 May 2008 16:54, Jonathan wrote: - Original Message - From: Garry Saddington [EMAIL PROTECTED] To: zope@zope.org Sent: Wednesday, May 07, 2008 11:52 AM Subject: [Zope] disappearing external methods I have recently moved our Zope installation over to a centos server. Since the move all the external methods periodically stop working for no apparent reason and the error is returned as: external method can not be called because it is none The thing is that it works well and then stops. Does anyone have any ideas about this? The installation was not initially compiled on centos as I have a large collection of software as part of the application which can be moved between servers with the Zope installation. The reason for the move to Centos is that DTMLTex fails when trying to run pdflatex on Ubuntu and this seems to be distro specific, with no apparent way to fix it, unless anyone knows any better? We use centOS and have a lot of external methods (all working happily). Have you tried deleting the .pyc files associated with the external methods and then restarting zope? There are no .pyc files in any of our installations. Have you used the Zope that comes with Centos or from Zope.org? 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 )
Re: [Zope] Re: disappearing external methods
On Wednesday 07 May 2008 18:13, Josef Meile wrote: Garry Saddington schrieb: Have you tried deleting the .pyc files associated with the external methods and then restarting zope? There are no .pyc files in any of our installations. Have you used the Zope that comes with Centos or from Zope.org? Tried, as somebody say, to open the external method on the ZMI, then press save, and test if it works. If you have a lot of them, you could try Dieter's advice here: http://mail.zope.org/pipermail/zope/2002-July/119101.html Check also that you move all .py files from your external methods and that file and folder permissions allow the user running zope to access them. I'm not sure but I think this problems with the external methods only happen with old zope versions. Which version you have? 2.9.6 I am re-compiling on Centos to see if that helps 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 )
[Zope] try clause in external method
I have the following external method which takes an input .csv file and enters the data into a database by calling a ZSQL method. There may be errors in the input file and so I am trying to catch them and insert each bad row in a different table. The errors are detected by table constraints on the table definition and should be reported by the Psycopg connector. However no correct rows are entered and only the last error row is entered. Can anyone see what I am doing wrong in this script? def timetabler(self,REQUEST): import csv,string f=REQUEST.form[TTEXPORT.CSV] from cStringIO import StringIO filebody=StringIO(f.read()) r = csv.DictReader(filebody(day,periodstart,periodend ,year,teachgroup,teacher ,subject ,set ,room)) for row in r: try: self.insertintoiclasses(**row) except: self.insertimporterrors(**row) dtmlMethodName=manage_import_from_timetabler return self[dtmlMethodName](self,self.REQUEST) 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 )
[Zope] type checking
Is there any way to do data type checking in dtml-if, for example to check that a variable is an integer? 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 )
[Zope] how many zope instances
I have tried to find information on how many Zope instances can be run on a single machine but all searches have failed to be definitive. Is there any information on this, because I would like to have a separate instance for each of my customers running on a different port number and it would be useful to be able to predict the number of servers I would need. 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 )
Re: [Zope] how many zope instances
On Friday 04 April 2008 16:38, Andreas Jung wrote: --On 4. April 2008 16:33:48 +0100 Garry Saddington [EMAIL PROTECTED] wrote: I have tried to find information on how many Zope instances can be run on a single machine but all searches have failed to be definitive. Is there any information on this, because I would like to have a separate instance for each of my customers running on a different port number and it would be useful to be able to predict the number of servers I would need. As you might imagine: everything depends on the resources: Ram, diskspace, CPU. A Zope instance might take as little as 80MB Ram or up to 2GB per process. A site might consume no CPU, a Zope-based p0rn site might require several machines...so basically we can not give a valid answers..everything depends on a lot of parameters and there is no Zope formula. Andreas OK, so does the amount of RAM needed depend mainly on the size of the data.fs or is there another major component? 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 )
Re: [Zope] silly DTML question: in test
if foo in (select foo_col from table where x=y) then z='t' else z='f' I tried putting the simple SELECT query into a zSql and then calling it like: dtml-call REQUEST.set('foo_list',IfShowNextDoor()) dtml-if expr=foo in foo_list dtml-call REQUEST.set('z','t') dtml-else dtml-call REQUEST.set('z','f') /dtml-if How about checking the database table for foo rather than the result set: ZSQL method name=select argument=foo select foo_col from table where foo_col =dtml-sqlvar foo type=string then do: dtml-in select dtml-call REQUEST.set('z','t') dtml-else dtml-call REQUEST.set('z','f') /dtml-in If the variable is in table then dtml-in returns a result set and the dtml-call REQUEST.set('z','t') is called, if not the dtml-else is called. HTH 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 )
Re: [Zope] Frustrated with Python and Frameworks. Zope, Grok, Django, CherryPy
On Tuesday 27 November 2007 17:19, Martijn Faassen wrote: We need to identify some targets and see what resources we have to accomplish them. Of course this shouldn't degenerate into a long wishlist discussion, but let's see what kind of steps can be taken. I came to Zope as a newbie about 4 years ago. I used DTML from the word go because I wanted to use databases extensively and therefore ZSQL. Of course, when I started to get into difficulty I asked on this list. I got lambasted firstly for using DTML and secondly for seemingly wanting answers! I therefore became afraid of the list and the response I may get from questions so much so that I stopped asking. I learned the hard way - trial and error and reading whatever I could find -usually hard to find. I was therefore pleasantly surprised when I first asked a question on the Postgresql users list. Not only was the response friendly and helpful but many responders actually wrote code to solve my problem or to show me how to solve it. It is this sort of attitude that we should try to foster on this list. Everyone has to learn sometime - how about helping them with a little more kindness. 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 )
[Zope] bounties
How would I go about offering bounties to Zope developers? 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 )
Re: [Zope] running pg_dump on windows as external method
On Friday 26 October 2007 05:24, Andreas Jung wrote: --On 25. Oktober 2007 22:48:42 +0100 Garry Saddington [EMAIL PROTECTED] wrote: I am using zope on windows with an external python method to backup my database. I am struggling to run the following command: pg_dump.exe database file I have tried using os.popen - no luck and also subprocess.Popen. eg: import subprocess subprocess.Popen(['c:/dir/dir/pg_dump.exe','database','','c:/dir/dir/out put file']) - play with the shell=True|False parameter of Popen() - why do you use redirection since Popen() provides a proper mechansim for reading stderr/stdout - where is your code where you are calling wait()??? I have done this. I can get the database dump written to a file using subprocess and os.popen by using python on the command line or by using the python interpreter of the same python that runs zope. eg. this works outside zope: import os os.popen('pg_dump.exe database outfile.txt') The same code in an external method does nothing. (Zope 2.9.0, python 2.4.2, win32) 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 )
[Zope] running pg_dump on windows as external method
I am using zope on windows with an external python method to backup my database. I am struggling to run the following command: pg_dump.exe database file I have tried using os.popen - no luck and also subprocess.Popen. eg: import subprocess subprocess.Popen(['c:/dir/dir/pg_dump.exe','database','','c:/dir/dir/output file']) The command string works perfectly in a terminal. Does anyone know how I should be doing this? I get no errors or traceback when I try the method through Zope. 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 )
Re: [Zope] sql and auto generated forms
On Sun, 2007-09-16 at 09:24 +0200, Dieter Maurer wrote: Jaroslav Lukesh wrote at 2007-9-14 19:50 +0200: I looking for such a tool, for which I define table columns and this tool generates SQL create,insert, update, select ZSQL methods and generate forms with methods for insert, update and show records. It exists, or some similar, please? I have bunch of tables... We used (for some time) a product with a name similar to ZSolkWizzard for this (the name is definitely different, but I do not know the correct one). Znolk SQL Wizard http://www.zope.org/Members/zwork/Znolk_SQL_Wizard 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 )
Re: [Zope-DB] case insensitive ZSQL queries
On Wed, 2007-09-05 at 16:16 -0700, onsombal wrote: is there an easy way to make the following ZSQL query case-insensitive? select * from clients dtml-sqlgroup where dtml-sqltest firstname op=like type=string optional dtml-or dtml-sqltest lastname op=like type=string optional dtml-or dtml-sqltest client op=like type=string optional /dtml-sqlgroup Thanks... Jim If you use Postgresql then change the 'like' to 'ilike'. Regards Garry ___ Zope-DB mailing list Zope-DB@zope.org http://mail.zope.org/mailman/listinfo/zope-db
[Zope] dtml method contents
I found this method on Zopelabs to get the contents of all ZSQL methods. dtml-in ZopeFind(restrictedTraverse(['']), obj_metatypes=['DTML Method'], search_sub=1) h2dtml.-id; (dtml.-title_or_id;)/h2 pidtml-var absolute_url/i/p blockquotepredtml-var template/pre/blockquote /dtml-in Is it possible to do the same with all dtml methods? I have tried replacing template with document_src but this gives a mixture of part rendered methods and error messages which is completely jumbled. 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 )
[Zope] htmldoc problem
I am using the following external method to write pdf files. import subprocess def html2pdf(self,source): f=open('/opt/scholarpack/ancillary/pdf.html','w') f.write(source) f.close p=subprocess.Popen(['htmldoc', '--webpage', '/opt/scholarpack/ancillary/pdf.html','-f', '/opt/scholarpack/ancillary/mypdf.pdf']) p.wait() When I do this the html is truncated and an incomplete pdf is generated. However, if I rum htmldoc in a terminal on the same html file then the ouput is perfect. Can anyone see where the external method may be going wrong, apart from the formatting that kmail is enforcing on this code snippet!? 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 )
[Zope] html2pdf
I am trying to use html2pdf and htmldoc to generate pdfs on the fly. I can get it to work perfectly if I set all view permissions for anonymous. However, this is not suitable for a member only site. Can anyone point me in the right direction for such use? I am using: (Zope 2.9.0, python 2.4.2, win32) and latest version of html2pdf. 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 )
Re: [Zope] Re: html2pdf
On Thursday 12 July 2007 18:19, Maurits van Rees wrote: Garry Saddington, on 2007-07-12: I am trying to use html2pdf and htmldoc to generate pdfs on the fly. I can get it to work perfectly if I set all view permissions for anonymous. However, this is not suitable for a member only site. Can anyone point me in the right direction for such use? I am using: (Zope 2.9.0, python 2.4.2, win32) and latest version of html2pdf. I would simply say: set the view permissions to Member and not to Anonymous. Then report back here with any errors you get. In the html2pdf howto at Zope it says 'Only works with anonymous permissions' -- just read it properly!. Probably because the htmldoc process accesses the web page via a URL passed to it by html2pdf. So I guess I will have to pass the rendered page to the script and hence to htmldoc. When I use it now all I get is a nice PDF of the cookiecrumbler login screen and no error messages in the error_log. Thanks for replying, am I on the right lines? 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 )
[Zope] datetime format
I have 'datetime-format international' set in zope.conf but the date output is still rendered in the format (y,m,d) when using ZopeTime or when returning dates from python scripts. How can I change this behaviour? My server config is: Zope Version (Zope 2.9.0, python 2.4.2, win32) Python Version 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] System Platform win32 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 )
Re: [Zope] datetime format
On Sunday 04 March 2007 13:32, Andreas Jung wrote: --On 4. März 2007 12:45:20 + Garry Saddington [EMAIL PROTECTED] wrote: I have 'datetime-format international' set in zope.conf but the date output is still rendered in the format (y,m,d) Reading helps.. Yes, indeed it does, how did you suppose I knew how to set the format in the first place. I presume that I will have to explicitly format the date output then, or is there a way for Zope to automatically do this? 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 )
[Zope] frameset problems
I have this page: frameset rows=75%,25% frame src=dtml-var page frame src=dtml-call expr=getproperty(page=_['page']) /frameset The 'page' variable is in the request but no matter what I try I am having problems passing it the the python script 'getproperty'. Can anyone point me in the correct direction? 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 )
[Zope] add user from python problem
The following script adds a new folder with a user folder inside it and then adds a user to the user folder. It works fine but the new user is unable to log in until I go to the ZMI and go to change the user password. I do not need to do anything more than press the change button on this page for the user to be then able to log in using the password specified in the script. Given that I will be adding up to 2000 users at a time with an ammended version of this script, this could become a little inconvenient. Am I doing something wrong? Zope Version (Zope 2.9.0, python 2.4.2, win32) Python Version 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] System Platform win32 roles='Manager' domains=[] password='go' confirm='go' name='BogeySmith' forms='7L' forms_obj = getattr(context, forms) forms_obj.manage_addFolder(name) path = str(forms+'/'+name) path_obj = context.restrictedTraverse(path) path_obj.manage_addUserFolder() path2 = str(forms+'/'+name) path_obj2 = context.restrictedTraverse(path2) userfolder = getattr(path_obj2, 'acl_users') userfolder.userFolderAddUser(name, password,roles,domains) 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 )
Re: [Zope] add user from python problem
On Thu, 2007-02-15 at 18:58 +0100, Andreas Jung wrote: --On 15. Februar 2007 17:34:10 + garry saddington [EMAIL PROTECTED] wrote: roles='Manager' As the name 'roles' indicates you have to specify a sequence of roles and not a *single* one. -aj Thanks this has fixed it but I still have questions: 1/Why can I specify only one when adding a user in the ZMI? 2/What if I only want one role for the user? 3/Why does it accept the one role from my script - it is highlighted when I go to the ZMI? 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 )
Re: [Zope] add user from python problem
On Thu, 2007-02-15 at 19:35 +0100, Andreas Jung wrote: --On 15. Februar 2007 18:31:46 + garry saddington [EMAIL PROTECTED] wrote: On Thu, 2007-02-15 at 18:58 +0100, Andreas Jung wrote: --On 15. Februar 2007 17:34:10 + garry saddington [EMAIL PROTECTED] wrote: roles='Manager' As the name 'roles' indicates you have to specify a sequence of roles and not a *single* one. -aj Thanks this has fixed it but I still have questions: 1/Why can I specify only one when adding a user in the ZMI? Isn't ['Manager'] a sequence of roles? A sequence of one role? Of course - sorry 2/What if I only want one role for the user? See above. 3/Why does it accept the one role from my script - it is highlighted when I go to the ZMI? What is confusing me is that with the problem script the user seems to be added with the correct role but only activated after the change user button is pressed. ie. The script does not report any errors and appears to complete. Anyway thanks for your help 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 )
Re: [Zope-DB] Please help me about driver adapter
On Fri, 2007-02-16 at 07:38 +0100, robert rottermann wrote: I do not think any one of us can help you unless you tell us what exactly your problem with installing pymssql ist. by the way: do you mean MySQLdb? there is very good documentation on using Z SQL in the zope book: http://www.plope.com/Books/2_7Edition/RelationalDatabases.stx there you find examples how to use a query with like. robert Here's an example of how to use like and wildcards in sqlvar's select * from students where surname ilike dtml-sqlvar expr='%'+surname+'%' type=string Regards Garry ___ Zope-DB mailing list Zope-DB@zope.org http://mail.zope.org/mailman/listinfo/zope-db
[Zope] python script syntax
I want to do something like this in a script: forms='7L' context.forms.manage_addFolder('filey') ie. substitute the variable 'forms' for the correct value but I can not get the syntax correct, can anyone help? 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 )
Re: [Zope] zope sql_delimiter windows
On Sun, 2006-12-24 at 21:00 +0100, Dieter Maurer wrote: garry saddington wrote at 2006-12-23 22:26 +: I have a Zope application that runs perfectly on Linux. However, my target audience is likely to use Windows so I am trying to port my app. to that platform. Whenever I use a multiple insert Zsql method that includes sql_delimiter, python.exe crashes. There is no issue with sql_delimiter on Windows. You are correct, after some pointers from the list, I chased down the problem to the psycopg2 adapter. After downgrading to the last stable version in the 1 series the problem has gone away. Thanks to all who offered help. 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 )
Re: [Zope] zope sql_delimiter windows
On Sat, 2006-12-23 at 23:39 +0100, Jaroslav Lukesh wrote: Does run your multiple INSERT queries at Database Adapter Test tab? None of them run (and I have many) from the test tab as I collect the data from a web form using the :records structure. 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 )
Re: [Zope] zope sql_delimiter windows
Andreas Jung wrote: Please read this: http://opensource.zopyx.com/helpcenter/misc/writing-smart-and-reasonable-postings-or-how-to-use-a-mailinglist/view If there had been anything else to send I would have. I thought the question was quite clear: Is there an issue with sql_delimiter on windows? There is nothing in the error log. There is nothing in the Event log. There is nothing in the Z2 log. Windows event log just says that Python.exe exited abnormally. I was quite clear on which versions of Zope had been tested. I gave the code which caused the crash. I have searched Google and I have searched the mailing list. My last resort is always to ask on this list simply because of the sort of answer you have just given. 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 )
Re: [Zope] zope sql_delimiter windows
On Sun, 2006-12-24 at 16:10 +0100, Andreas Jung wrote: -BEGIN PGP SIGNED MESSAGE- OK, sorry for the lack of info. What happens is that Zope stops responding when I fire off a ZSQL method containing a 'sql_delimiter' and then I get the standard Windows message: python.exe has encountered a problem and needs to closeetc. All I can say is that it has something to do with msvcr71.dll which is in the detail of the above error message. There is no other hint in any logs as to what is happening and when I close the above dialogue, Zope comes back to life and the offending ZSQL has not run. Only ZSQL methods which rely on sql_delimiter are affected. I have repeated the error on XP pro sp2 and XP home SP2 with Zope versions 2.8,.2.9 and 2.10 using the Pythons that ship with these versions (ie standard Windows installs). DA is psycopg2 and database is Postgresql. Any Ideas, can I provide any further information? 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 )
[Zope] zope sql_delimiter windows
I have a Zope application that runs perfectly on Linux. However, my target audience is likely to use Windows so I am trying to port my app. to that platform. Whenever I use a multiple insert Zsql method that includes sql_delimiter, python.exe crashes. eg. dtml-in att dtml-var sql_delimiter dtml-if absent insert into attendance (absent,timeperiod,studentid ) values ( dtml-sqlvar absent type=string, dtml-sqlvar timeperiod type=string, dtml-sqlvar studentid type=int ) /dtml-if /dtml-in The above ZSQL method works on Linux any Zope version but causes the crash on Windows, Zope versions - 2.8, 2.9, 2.10 have been tested and all fail, is there an issue with this? 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 )
Re: [Zope] external method strangeness
On Wed, 2006-10-18 at 15:07 -0400, Paul Winkler wrote: On Wed, Oct 18, 2006 at 06:13:38PM +0100, garry saddington wrote: Can anyone explain what is happening here. I am using Saxon to transform an xml file(source) using a stylesheet(style) the result is then written to Postgres. The contents of source are uploaded in Zope and passed to the external method as a string. When I run this external method: import psycopg, string, re, subprocess def scholarpack_xml_transform(source): f=open('/opt/scholarpack/ancillary/source.xml','w') f.write(source) I have no idea what's causing your problem, but this raises red flags for me: if two people upload sources at the same time, you'll have problems here. There is no chance of this as it is a one-off populate the db exercise. If you really really must read/write files on the filesystem, either use locks or use python's tempfile module. f.close source= '/opt/scholarpack/ancillary/source.xml' style='/opt/scholarpack/ancillary/style.xml' source1=source.replace('apos;','`') source2=source1.replace('NLPGaddress','BS7666address') p=re.compile(\') source3=p.sub( '`' , source2) r = subprocess.Popen(['/opt/scholarpack/ancillary/jre/bin/java','-jar','./saxon.jar',source3,style], stdout = subprocess.PIPE,cwd = '/opt/scholarpack/ancillary/') Are you just using saxon for xslt processing? If so, IMO using an external process for that is severe overkill. Get lxml and try something like this: from lxml import etree style = etree.XSLT(etree.parse(some_file_object)) transformed = style.apply(source_data) Thank you I've never heard of this, I'll give it a try. I was using 4suite but it started to misbehave in the way that I wanted to use it. regards Garry but again, this doesn't address your immediate problem :) ___ 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] external method strangeness
Can anyone explain what is happening here. I am using Saxon to transform an xml file(source) using a stylesheet(style) the result is then written to Postgres. The contents of source are uploaded in Zope and passed to the external method as a string. When I run this external method: import psycopg, string, re, subprocess def scholarpack_xml_transform(source): f=open('/opt/scholarpack/ancillary/source.xml','w') f.write(source) f.close source= '/opt/scholarpack/ancillary/source.xml' style='/opt/scholarpack/ancillary/style.xml' source1=source.replace('apos;','`') source2=source1.replace('NLPGaddress','BS7666address') p=re.compile(\') source3=p.sub( '`' , source2) r = subprocess.Popen(['/opt/scholarpack/ancillary/jre/bin/java','-jar','./saxon.jar',source3,style], stdout = subprocess.PIPE,cwd = '/opt/scholarpack/ancillary/') r.wait() transformed = r.stdout.read() transformed1=transformed.replace(',)',')') conn = psycopg.connect(dbname=scholarpack user=scholarpack) curs = conn.cursor() do=curs.execute(transformed1) do conn.commit() conn.close I get a programming error thrown from the conn.commit() line and the method fails. However when I run the following script externally to Zope after the Zope failure (so that source.xml exists) the DB write is successful. #!/opt/scholarpack/python/bin/python import psycopg, string, re, subprocess source='source.xml' style='style.xml' source1=source.replace('apos;','`') source2=source1.replace('NLPGaddress','BS7666address') p=re.compile(\') source3=p.sub( '`' , source2) r = subprocess.Popen(['/opt/scholarpack/ancillary/jre/bin/java','-jar','./saxon.jar',source3,style], stdout = subprocess.PIPE,cwd = '/opt/scholarpack/ancillary/') r.wait() transformed = r.stdout.read() transformed1=transformed.replace(',)',')') conn = psycopg.connect(dbname=scholarpack user=scholarpack) curs = conn.cursor() do=curs.execute(transformed1) do conn.commit() conn.close Can anyone point me in the correct direction? 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 )
[Zope] zope 3 psycopda
I am trying to install psycopda for zope 3 by following the instructions in the readme file with the svn checkout of this product and I get the following error when starting Zope. I have tried searching for rdb module but have not found anything of use. I am using Zope 3 as installed by Ubuntu. Any ideas please? regards garry from zope.rdb import ( zope.configuration.xmlconfig.ZopeXMLConfigurationError: File /var/lib/zope3/instance/sandbox/etc/site.zcml, line 7.2-7.55 ZopeXMLConfigurationError: File /var/lib/zope3/instance/sandbox/etc/package-includes/psycopgda-configure.zcml, line 1.0-1.31 ZopeXMLConfigurationError: File /var/lib/zope3/instance/sandbox/lib/python/psycopgda/configure.zcml, line 6.2 ImportError: No module named rdb ___ 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] os module on different os's
I have a Zope application that runs on WinXP and Debian sarge without problems. I am using os.popen and popen2 to run locally installed applications and use their output in Zope (particularly aspell and diction). On Ubuntu Dapper and FC5 however, these os calls fail. Is there a problem with recent Distros and this module? Python version is 2.3 on all systems but I tried 2.4 on FC5 and that failed too. 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 )
Re: [Zope] windows python differences
On Fri, 2006-05-19 at 06:06 +0200, Andreas Jung wrote: --On 18. Mai 2006 23:21:50 +0100 garry saddington [EMAIL PROTECTED] wrote: hrows a string index out of range at the sentence[0] constructs. the popen command on windows is: ispell=os.popen(echo +word+ \scholarpack\ancillary\ispell\bin\ispell -a) Anyone know what the difference is on the two platforms? Is this a serious question? Window and Unix use completely different path names (\ vs /). I know this as you can see. It is the returned value from readline that seems to be different. 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 )
Re: [Zope] windows python differences
On Fri, 2006-05-19 at 09:01 +0200, Tino Wildenhain wrote: garry saddington wrote: This code on linux works without a problem ispell = os.popen(echo + word + | /opt/scholarpack/ancillary/ispell/bin/ispell -a) ispell.readline sentence = ispell.readline() What if the word is like `rm -rf /` It is impossible for this to happen because of other controls in place. for example? Doing something like that above is completely creazy :( There are actually 3 different popen() variants - 2 of them give you stdin too so you better use this to write the word to ispells stdin. Don't use echo or something like this! ... however on windows it throws a string index out of range at the sentence[0] constructs. the popen command on windows is: ispell=os.popen(echo +word+ \scholarpack\ancillary\ispell\bin\ispell -a) Anyone know what the difference is on the two platforms? As Andreas already said (and you can easily see by comparing the strings, can you? ;) Python has os.path.join() to construct paths for the actual platform. (And since this is a 3rd party tool anyway, you might want to make it configurable - of course not via ZMI) I am not bothered about the paths, that is not the question. Both commands work in their respective environments. It is the sequence[0] that throws the error so I am looking at differences in the way the results are returned from ispell.readline() 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 )
[Zope] windows python differences
This code on linux works without a problem ispell = os.popen(echo + word + | /opt/scholarpack/ancillary/ispell/bin/ispell -a) ispell.readline sentence = ispell.readline() if (sentence[0] == ''): parts = string.split(sentence, : ) gluedwords = parts[1] words = string.split(gluedwords,, ) length = len(words) words[length-1] = words[length-1][0:len(words[length-1]) - 1] return [word] + words elif (sentence[0] == '#') or (sentence[0] == '?'): return [word] else: return [] however on windows it throws a string index out of range at the sentence[0] constructs. the popen command on windows is: ispell=os.popen(echo +word+ \scholarpack\ancillary\ispell\bin\ispell -a) Anyone know what the difference is on the two platforms? 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 )
Re: [Zope] now learning zpt
Chris Withers wrote: Hi Gary, Garry Saddington wrote: Having had a bit of a lambasting over my use of dtml, I have started to learn zpt. Congratulations, welcome to the zLight ;-) However, I am curious about the following: How do you do the equivalent of name=comp.name:records to submit multiple values to zsql or to a python script, Well, that works exactly as it did before. That stuff is part of Zope's publisher machinery and has nothing to do with DTML or ZPT. I now realise this after some reading, sorry for the rubbish question. especially when the initial list is generated dynamically. Not sure what you mean... Again irrelevant now;-) Chris Would you also stop using dtml in zsql methods and do the processing of multiple records in python? 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 )
[Zope] now learning zpt
Having had a bit of a lambasting over my use of dtml, I have started to learn zpt. However, I am curious about the following: How do you do the equivalent of name=comp.name:records to submit multiple values to zsql or to a python script, especially when the initial list is generated dynamically. 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 )
Re: [Zope] selected in select lists
Chris Withers wrote: Garry Saddington wrote: DTML: select name=groupabbrev dtml-in getpastoralgroups option value=dtml-var thisgroupabbrev dtml-if expr=groupabbrev==_.str(thisgroupabbrev) selected/dtml-if dtml-var thisgroupabbrev/option /dtml-in /select And just for comparison, here's the ZPT: select name=groupabbrev tal:define=abbrev context/groupabbrev tal:i repeat=group context/getpastoralgroups option tal:define=thisAbbrev group/thisgroupabbrev tal:attributes=value thisAbbrev; selected python:abbrev==thisAbbrev tal:content=thisAbbrev/ /select Stop using DTML ;-) Chris This code does not work;-). If I always work in the ZMI and do not collaborate with designers on database web applications where the data is more important than the presentation, can you give me a good reason for not using DTML. I find DTML more intuitive than ZPT and once you get the hang of the namespace magic thing it is not that bad. The ZPT code above seems to me more complex and it has defined two new variables, whereas the DTML only has two variables and a string conversion. Regards Garry ps. I would use ZPT if I could see a valid reason to do so. ___ 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] selected in select lists
Tino Wildenhain wrote: Am Freitag, den 14.10.2005, 20:03 +0100 schrieb Garry Saddington: Chris Withers wrote: Garry Saddington wrote: DTML: select name=groupabbrev dtml-in getpastoralgroups option value=dtml-var thisgroupabbrev dtml-if expr=groupabbrev==_.str(thisgroupabbrev) selected/dtml-if dtml-var thisgroupabbrev/option /dtml-in /select And just for comparison, here's the ZPT: select name=groupabbrev tal:define=abbrev context/groupabbrev tal:i repeat=group context/getpastoralgroups option tal:define=thisAbbrev group/thisgroupabbrev tal:attributes=value thisAbbrev; selected python:abbrev==thisAbbrev tal:content=thisAbbrev/ /select Stop using DTML ;-) Chris This code does not work;-). If I always work in the ZMI and do not collaborate with designers on database web applications where the data is more important than the presentation, can you give me a good reason for not using DTML. I find DTML more intuitive than ZPT and once you get the hang of the namespace magic thing it is not that bad. The ZPT code above seems to me more complex and it has defined two new variables, whereas the DTML only has two variables and a string conversion. Regards Garry ps. I would use ZPT if I could see a valid reason to do so. The example above is unfortunatly a bit bad from app design view. You should either do the comparison in your ZSQL Method or wrap the call to the ZSQL method in a simple python script. Then all your ZPT reduces to: select name=groupabbrev option tal:repeat=group here/getpastoralgroups tal:attributes=value group/groupabbrev; selected group/selected tal:content=thisgroupabbrev Example /option /select Which is imho much better to read then the code above. All you need to do is to deliver True/False, None/Something for the selected field. Not doing the comparison in your Template (no matter if DTML or ZPT) really makes live easier. You should try to get your Application right independend of any HTML output. (e.g. you can call the scripts/ZPTs directly to find out whats going on) HTH Tino Wildenhain The comparison is dynamic. The user selects an option, that option is passed to a formhandler and hence back to the referring method. How could I not do the comparison in this method? If it could be done in a python script as you say, why should I inject another layer of complexity into my application when the one dtml method will do the job? imho such a problem as selected in selects should have a well documented solution as many developers will need it and why should each one have to find the solution for themselves? I think Zope is the most important technology on the Internet at present, with the possibility to become really huge, but if every developer has to search so hard for solutions as I have had to, it will forever be a niche product. 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 )
[Zope] selected in select lists
I have a variable called 'groupabbrev' in the REQUEST. I am trying to automatically select an option in a select list based on this variable. I have tried this code and many others, and many googles but have not found anything that works. Can anyone see what I am doing wrong? select name=groupabbrev dtml-in getpastoralgroups option value=dtml-var groupabbrev dtml-if expr='groupabbrev'==_['sequence-item'] selected/dtml-if dtml-var groupabbrev/option /dtml-in /select 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 )