Re: [Zope] Efficiency of "Script (Python)" versus External Method
Andrew Hedges wrote: Is there a difference in the efficiency of a function as a "Script (Python)" Zope object versus an External Method? The use case is that I need to run a fairly simple function (an implementation of the Levenshtein distance algorithm) over a result set in the range of 30-40k records. Are the two implementations close enough that I should just not worry about it or would you expect I would see a significant difference between the two? Go for an external method. Python scripts have a lot of security checking which will slow you down... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ 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] transaction.begin() ??
in a unittest I use transaction.begin() as follows: import transaction transaction.get().begin() I then get the following error: AttributeError: 'Transaction' object has no attribute 'begin' when I look at the code I am unsure whether transaction should have a begin method. If it does not exist anymore, by what is the method replaced? thanks robert begin:vcard fn:robert rottermann n:rottermann;robert email;internet:[EMAIL PROTECTED] tel;work:031 333 10 20 tel;fax:031 333 10 23 tel;home:031 333 36 03 x-mozilla-html:FALSE version:2.1 end:vcard ___ 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] transaction.begin() ??
--On 16. Juni 2006 10:03:23 +0200 robert rottermann <[EMAIL PROTECTED]> wrote: in a unittest I use transaction.begin() as follows: import transaction transaction.get().begin() I then get the following error: AttributeError: 'Transaction' object has no attribute 'begin' when I look at the code I am unsure whether transaction should have a begin method. If it does not exist anymore, by what is the method replaced? Transaction.begin() was removed in ZODB 3.6 (and has been deprecated for a while). Possibly you're looking at different ZODB versions. -aj -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376 E-Publishing, Python, Zope & Plone development, Consulting pgp89VZxpZ4el.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] transaction.begin() ??
Andreas Jung wrote: --On 16. Juni 2006 10:03:23 +0200 robert rottermann <[EMAIL PROTECTED]> wrote: in a unittest I use transaction.begin() as follows: import transaction transaction.get().begin() I then get the following error: AttributeError: 'Transaction' object has no attribute 'begin' when I look at the code I am unsure whether transaction should have a begin method. If it does not exist anymore, by what is the method replaced? Transaction.begin() was removed in ZODB 3.6 (and has been deprecated for a while). Possibly you're looking at different ZODB versions. -aj thanks, in both transaction.__init__ and transaction.interfaces.ITransactionManager of Zope2.9 I found a begin method. robert begin:vcard fn:robert rottermann n:rottermann;robert email;internet:[EMAIL PROTECTED] tel;work:031 333 10 20 tel;fax:031 333 10 23 tel;home:031 333 36 03 x-mozilla-html:FALSE version:2.1 end:vcard ___ 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] transaction.begin() ??
--On 16. Juni 2006 10:17:18 +0200 robert rottermann <[EMAIL PROTECTED]> wrote: Andreas Jung wrote: --On 16. Juni 2006 10:03:23 +0200 robert rottermann <[EMAIL PROTECTED]> wrote: in a unittest I use transaction.begin() as follows: import transaction transaction.get().begin() I then get the following error: AttributeError: 'Transaction' object has no attribute 'begin' when I look at the code I am unsure whether transaction should have a begin method. If it does not exist anymore, by what is the method replaced? Transaction.begin() was removed in ZODB 3.6 (and has been deprecated for a while). Possibly you're looking at different ZODB versions. -aj thanks, in both transaction.__init__ and transaction.interfaces.ITransactionManager of Zope2.9 I found a begin method. THat's what the deprecation warning in ZODB 3.4/3.5 should have told you. -aj -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376 E-Publishing, Python, Zope & Plone development, Consulting pgpozlUXRzsy1.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Render DTML inslide ZPT slot
and how can we transfer the namespace of the current zpt doing : as we do in dtml writing : ? 2006/6/15, Dieter Maurer <[EMAIL PROTECTED]>: Jonathan Bowlas wrote at 2006-6-15 14:05 +0100: > ... >Is it possible to render DTML methods inside a slot of a ZPT? If so, how >would I achieve this? -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) -- Thomas Desvenain Junior Plone/Zope, Looking for a Job ! Now, trainee at Institut National de Recherche Agronomique Mathématiques, Informatique et Génôme laboratory 78350 Jouy en Josas 0134652943 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: Render DTML inslide ZPT slot
thomas desvenain wrote: and how can we transfer the namespace of the current zpt doing : as we do in dtml writing : If it doesn't automatically you can most likely just write: -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science Phone: +45 66 11 84 94 Mobile: +45 29 93 42 96 ___ 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] SSL Redirect for CookieCrumbler
Dear Zopers I need to redirect all my http requests to the login_form of the CookieCrumble to https, so, I wrote this rule in apache: RewriteRule ^/login/login_form(.*) https://server/login/login_form$1 [NE,L] It authenticates me through ssl, but then it cames back to http. I saw that the problem is that the came_from variable refers to the original http request; something like this: https://server/login/login_form?came_from=http%3A//server/page&retry=&disabl e_cookie_login__=1 Is there any way of writing something like this in apache? RewriteRule ^/login/login_form?came_from=http%3A(.*) https://server/login/login_form?came_from=https%3A$1 [NE,L] It is not working for me :-(. I even tried escaping the '%' with a backslash like this: RewriteRule ^/login/login_form?came_from=http\%3A(.*) https://server/login/login_form?came_from=https%3A$1 [NE,L] But Apache doesn't match the rule. What's wrong with that? Anyway, another thing that bothers me about the last approach is that I even don't know if there is always a "came_from" variable. Is this always the case? Is there any other way of achieving this? Regards Josef ___ 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] manage_changeProperties has strange side effect on response Content-Type.
This gave me such a headache today, that I thought I ought to mention it. All my pages normally have a content-type of ISO-8859-1 I have not spent much thought on this, it has just worked nicely like that. Today I had a page that called a python script, that even when I made it return an empty string, changed the content-type of my page to utf-8. I finally tracked it down to this difference: item.manage_changeProperties({'title':'Hustype'}) gives utf-8. item.manage_changeProperties(title='Hustype') leaves ISO-8859-1 intact. WTF is that? Now you have been warned :) Regards Gaute Amundsen ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] manage_changeProperties has strange side effect on response Content-Type.
--On 16. Juni 2006 13:05:09 +0200 Gaute Amundsen <[EMAIL PROTECTED]> wrote: item.manage_changeProperties({'title':'Hustype'}) gives utf-8. This makes less sense. You're passing an ASCII string which has the same representation in UTF-8..so why should this be a utf-8 string? item.manage_changeProperties(title='Hustype') leaves ISO-8859-1 intact. see above. WTF is that? Your example is just poor. Now you have been warned :) Another try? -aj -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376 E-Publishing, Python, Zope & Plone development, Consulting pgppSLtyyE1Nf.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] manage_changeProperties has strange side effect on response Content-Type.
On Friday 16 June 2006 13:14, Andreas Jung wrote: > --On 16. Juni 2006 13:05:09 +0200 Gaute Amundsen <[EMAIL PROTECTED]> wrote: > > item.manage_changeProperties({'title':'Hustype'}) gives utf-8. > > This makes less sense. You're passing an ASCII string which has the same > representation in UTF-8..so why should this be a utf-8 string? You ask me? I ask you! (I think the string is rather irrelevant here, It's the form of the agument..) > > item.manage_changeProperties(title='Hustype') leaves > > ISO-8859-1 intact. > > see above. > > > WTF is that? > > Your example is just poor. It's all there is. Deal with it. (if you like) > > Now you have been warned :) > > Another try? > Yes, please do. G. ___ 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] manage_changeProperties has strange side effect on response Content-Type.
--On 16. Juni 2006 13:31:35 +0200 Gaute Amundsen <[EMAIL PROTECTED]> wrote: On Friday 16 June 2006 13:14, Andreas Jung wrote: --On 16. Juni 2006 13:05:09 +0200 Gaute Amundsen <[EMAIL PROTECTED]> wrote: > item.manage_changeProperties({'title':'Hustype'}) gives utf-8. This makes less sense. You're passing an ASCII string which has the same representation in UTF-8..so why should this be a utf-8 string? You ask me? I ask you! Strange opionion. Again: an ASCII string will *never* mutate to something else. It's representation in ISO-X, UTF-8 or whatever is *always* the same as the ASCII representationin addition it is not reproducable. Another try? Yes, go ahead and file a bug report to the Zope Collector including a reasonable description of the problem and a description how to reproduce it. -aj -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376 E-Publishing, Python, Zope & Plone development, Consulting pgpcEvUiK93bG.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] manage_changeProperties has strange side effect on response Content-Type.
Gaute Amundsen schrieb: This gave me such a headache today, that I thought I ought to mention it. All my pages normally have a content-type of ISO-8859-1 I have not spent much thought on this, it has just worked nicely like that. Today I had a page that called a python script, that even when I made it return an empty string, changed the content-type of my page to utf-8. I finally tracked it down to this difference: item.manage_changeProperties({'title':'Hustype'}) gives utf-8. item.manage_changeProperties(title='Hustype') leaves ISO-8859-1 intact. WTF is that? My guess would be the dict-argument is used in place of REQUEST and therefore sets some default encoding in request - which it certainly acquires. But this is all looking into the crystal sphere because I not yet have time to actually look at the source - otoh it would be of great help if you provide: 1.) the excat zope version 2.) manage_page_charset settings 3.) default encodings set in zope.conf etc. Regards Tino Wildenhain ___ 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] manage_changeProperties has strange side effect on response Content-Type.
--On 16. Juni 2006 13:39:03 +0200 Tino Wildenhain <[EMAIL PROTECTED]> wrote: item.manage_changeProperties({'title':'Hustype'}) gives utf-8. item.manage_changeProperties(title='Hustype') leaves ISO-8859-1 intact. WTF is that? My guess would be the dict-argument is used in place of REQUEST and therefore sets some default encoding in request - which it certainly acquires. 'Hustype' is pure ASCII...this will *always* have the same encoding in almost all encodings (except in Klingon). -aj pgpNWAJ5Eutx5.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] manage_changeProperties has strange side effect on response Content-Type.
--On 16. Juni 2006 13:42:40 +0200 Andreas Jung <[EMAIL PROTECTED]> wrote: --On 16. Juni 2006 13:39:03 +0200 Tino Wildenhain <[EMAIL PROTECTED]> wrote: item.manage_changeProperties({'title':'Hustype'}) gives utf-8. item.manage_changeProperties(title='Hustype') leaves ISO-8859-1 intact. WTF is that? My guess would be the dict-argument is used in place of REQUEST and therefore sets some default encoding in request - which it certainly acquires. 'Hustype' is pure ASCII...this will *always* have the same encoding in almost all encodings (except in Klingon). Sorry, I was misreading your posting. But to some degree it looks odd..put it in the Zope bugtracker otherwise it will be forgotten! -aj pgpyt6rsUQgFo.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] manage_changeProperties has strange side effect on response Content-Type.
Hi Andreas, Andreas Jung wrote: > 'Hustype' is pure ASCII...this will *always* have the same encoding in > almost all encodings (except in Klingon). > [klingon] ghaH ghItlhta' Daq [ASCII] ;-) -- Regards, PhilK "Human language continually changes, innit." - Stephen Juan ___ 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] DeadlockDebugger revisited
I thought a recent operating system upgrade (FreeBSD 5.4 to 6.1) fixed my problems with Zope. Unfortunately, once I re-compiled Python et al (to remove dependencies on the old libraries), my problems with Zope deadlocking recurred. I tried to use a combination of tools to try to discover the root cause of this problem, but nothing seems to work. What am I missing, and what else can I try? This system is: Nokia IP440 (Pentium II-333MHz, 256 MB RAM) FreeBSD 6.1-RELEASE-p1 Python 2.3.5 Zope 2.8.6 Plone 2.1.2 Trace and event logs: I set up the trace log to save all messages, and the last few lines of the access, event, and trace logs are: Z2.log: 127.0.0.1 - Anonymous [15/Jun/2006:22:52:54 -0400] "GET /VirtualHostBase/http/web.irtnog.org:80/irtnog/VirtualHostRoot/irtnog/he lpcenter_icon.gif HTTP/1.1" 200 1322 "http://web.irtnog.org/howtos-orig/freebsd-pf-pppoe"; "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" event.log: 2006-06-15T22:40:28 INFO Plone Debug Error exceptions.AttributeError on getBeginAndEndTimes while rendering portlet here/portlet_simpleblog/macros/portletBlogFull_local trace.log: B 221198124 2006-06-15T22:52:54 GET /VirtualHostBase/http/web.irtnog.org:80/irtnog/VirtualHostRoot/Members/x enophon/photos/washdc-jan-2006/photoalbum_view?b_start:int=20 I 221198124 2006-06-15T22:52:54 0 DeadlockDebugger + threadframe: Once the Zope process deadlocks, it ceases to respond on port 8080 (the configured listener port). Thus it is not possible to obtain a thread dump from Zope using this package. Lsof: I checked the list of open files on the Zope process but didn't see anything out of the ordinary (attached as "zope-lsof.txt") Strace/Truss/Ktrace: I traced the process using ktrace, dumped it with "kdump -H" to get thread IDs, and got the following information: 7505 100075 python2.3 PSIG SIGSEGV SIG_DFL 7505 100075 python2.3 PSIG SIGSEGV SIG_DFL 7505 100075 python2.3 PSIG SIGSEGV SIG_DFL 7505 100075 python2.3 PSIG SIGSEGV SIG_DFL 7505 100075 python2.3 PSIG SIGSEGV SIG_DFL 7505 100075 python2.3 PSIG SIGSEGV SIG_DFL 7505 100075 python2.3 PSIG SIGSEGV SIG_DFL 7505 100075 python2.3 PSIG SIGSEGV SIG_DFL 7505 100075 python2.3 PSIG SIGSEGV SIG_DFL 7505 100075 python2.3 PSIG SIGSEGV SIG_DFL I traced the process using truss and got the following information: SIGNAL 11 (SIGSEGV) SIGNAL 11 (SIGSEGV) SIGNAL 11 (SIGSEGV) SIGNAL 11 (SIGSEGV) SIGNAL 11 (SIGSEGV) SIGNAL 11 (SIGSEGV) Strace showed the same information: --- SIGSEGV (Segmentation fault: 11) --- --- SIGSEGV (Segmentation fault: 11) --- --- SIGSEGV (Segmentation fault: 11) --- --- SIGSEGV (Segmentation fault: 11) --- --- SIGSEGV (Segmentation fault: 11) --- --- SIGSEGV (Segmentation fault: 11) --- --- SIGSEGV (Segmentation fault: 11) --- --- SIGSEGV (Segmentation fault: 11) --- GDB + attach + info threads (https://engineering.purdue.edu/ECN/Resources/KnowledgeBase/Docs/2006051 8104722): The faulting thread seems to be in the middle of pthread_mutexattr_init. (gdb) info threads * 7 LWP 100075 0x2820e5c2 in pthread_mutexattr_init () from /usr/lib/libpthread.so.2 6 Thread 0x8111000 (sleeping) 0x2820df0f in pthread_mutexattr_init () from /usr/lib/libpthread.so.2 5 Thread 0xa318a00 (LWP 100062) 0x2821546b in pthread_testcancel () from /usr/lib/libpthread.so.2 4 Thread 0x991ac00 (runnable) 0x in ?? () 3 Thread 0x9062400 (runnable) 0x0cea3a2c in ?? () 2 Thread 0x9a37a00 (sleeping) 0x2820df0f in pthread_mutexattr_init () from /usr/lib/libpthread.so.2 1 Thread 0x9a35800 (sleeping) 0x2820df0f in pthread_mutexattr_init () from /usr/lib/libpthread.so.2 None of the threads are in the sigsuspend, poll, select, or kill state, although it's possible that the sleeping state is equivalent to sigsuspend. At a whim, I tried stepping into the process, but this didn't do anything other than show the SEGV on the console. (gdb) call PyRun_SimpleString("import string,sys,os,ZServer; sys.stdout=open('/tmp/urls','w',0); print string.join(map(lambda a:str(getattr(a,'env',{}).get('PATH_INFO','')), sys.modules['asyncore'].socket_map.values()), '\\n')") Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x9062400 (LWP 100075)] 0x0cea3a2c in ?? () The program being debugged was signaled while in a function called from GDB. And: (gdb) call PyRun_SimpleString("import sys, traceback;sys.stderr=open('/tmp/tb','w',0); traceback.print_stack()") [Switching to Thread 0x9062400 (LWP 100114)] Cannot set lwp 100114 registers: Invalid argument Cannot set lwp 100114 registers: Invalid argument -- jsoffron: I'm generally pretty high on national defense... Mr. Bad Example: Careful...it's a gateway policy. Before you know it, you'll be mainlining the hard stuff like trade agreements. jsoffron: Too late...I've been freebasing Nafta all day... Sweet, sweet NAFTA. - As seen on Slashdot COMMANDPID USER FD TYPE DE
[Zope] Zope Recordset Object
Hello, I have a ZSQL Method, which is called by my python script. However, I am curious as to what type of object is returned when that call is made. It's some sort of a recordset (or resultset) object that behaves like a list...it doesn't seem to be a dictionary object though, but I can't find any object reference on it. I tried using rs.keys() but it says that method doesn't exist in that class. Does anyone have a member function list (object reference ) that's associated with this resultset or can tell me what kind of object is returned? I gave up on google, couldn't find anything on it. Thank you in advance! __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Zope Recordset Object
+---[ Alric Aneron ]-- | Hello, | I have a ZSQL Method, which is called by my python | script. | However, I am curious as to what type of object is | returned when that call is made. | It's some sort of a recordset (or resultset) object | that behaves like a list...it doesn't seem to be a | dictionary object though, but I can't find any object | reference on it. I tried using rs.keys() but it says | that method doesn't exist in that class. | Does anyone have a member function list (object | reference ) that's associated with this resultset or | can tell me what kind of object is returned? | I gave up on google, couldn't find anything on it. It's a 'Result' class; looking ${ZOPE}/lib/python/Shared/DC/ZRDB/Results.py Quickly; .dictionaries() will return it as a list of dicts .names() will return the field list -- Andrew Milton [EMAIL PROTECTED] ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Zope Recordset Object
- Original Message - From: "Alric Aneron" <[EMAIL PROTECTED]> To: Sent: Friday, June 16, 2006 10:19 AM Subject: [Zope] Zope Recordset Object Hello, I have a ZSQL Method, which is called by my python script. However, I am curious as to what type of object is returned when that call is made. It's some sort of a recordset (or resultset) object that behaves like a list...it doesn't seem to be a dictionary object though, but I can't find any object reference on it. I tried using rs.keys() but it says that method doesn't exist in that class. Does anyone have a member function list (object reference ) that's associated with this resultset or can tell me what kind of object is returned? I gave up on google, couldn't find anything on it. This example may point you in the right direction... (but substitue your own sql call) rstat=context.Users.SQL_GetRetailersbyName(rStart='A%', rEnd='N%') print 'rstat.names= ',rstat.names() print 'rstat.data_dictionary= ',rstat.data_dictionary() print 'rstat.dictionaries= ',rstat.dictionaries() return printed hth Jonathan ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] manage_changeProperties has strange side effect on response Content-Type.
On Friday 16 June 2006 13:39, Tino Wildenhain wrote: > Gaute Amundsen schrieb: > > > > item.manage_changeProperties({'title':'Hustype'}) gives utf-8. > > item.manage_changeProperties(title='Hustype') leaves > > ISO-8859-1 intact. > > > > WTF is that? > > My guess would be the dict-argument is used in place of > REQUEST and therefore sets some default encoding in > request - which it certainly acquires. > > But this is all looking into the crystal sphere because > I not yet have time to actually look at the source - > otoh it would be of great help if you provide: > > 1.) the excat zope version > 2.) manage_page_charset settings > 3.) default encodings set in zope.conf etc. > > Regards > Tino Wildenhain That's making more sense :) I was suspecting something like that. I should have learned to ignore Andreas Jung's arrogant misreadings last time. :( 1) Zope Version: (unreleased version, 2.7.0-based, python 2.3.3, linux2) 2) A few quick googles was not able to reveal where I can get hold of the manage_page_charset settings... 3) No mention of "char" or "encode" in zope.conf G. ___ 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 Recordset Object
http://mail.zope.org/pipermail/zope-dev/1999-September/001414.html The only auxiliary structure I ever use is names, i.e. n2i = {} res = container.foo_zsql() nms = res.names() for i in range(len(nms)): n2i[nms[i]] = i Then I can address by name as in res[i][n2i['column_name']] jim > Hello, > I have a ZSQL Method, which is called by my python > script. > However, I am curious as to what type of object is > returned when that call is made. > It's some sort of a recordset (or resultset) object > that behaves like a list...it doesn't seem to be a > dictionary object though, but I can't find any object > reference on it. I tried using rs.keys() but it says > that method doesn't exist in that class. > Does anyone have a member function list (object > reference ) that's associated with this resultset or > can tell me what kind of object is returned? > I gave up on google, couldn't find anything on it. > > Thank you in advance! > ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: SSL Redirect for CookieCrumbler
I need to redirect all my http requests to the login_form of the CookieCrumble to https, so, I wrote this rule in apache: RewriteRule ^/login/login_form(.*) https://server/login/login_form$1 [NE,L] It authenticates me through ssl, but then it cames back to http. I saw that the problem is that the came_from variable refers to the original http request; something like this: https://server/login/login_form?came_from=http%3A//server/page&retry=&disabl e_cookie_login__=1 Ok, finally I found a way of correcting this behavior without modifying my original RewriteRule. I added a new boolean attribute to the CookieCrumbler class: "ssl_redirect". If it is set, then the http Part in the came_from variable will be replaced by https. All this would be done inside the getUnauthorizedURL method of the CookieCrumbler class (See the attachment). If you think there is a better way of doing this, please let me know. Regards Josef Note: The patch was done for the CookieCrumbler v1.2 diff -Naur CookieCrumbler_old/CookieCrumbler.py CookieCrumbler_new/CookieCrumbler.py --- CookieCrumbler_old/CookieCrumbler.py2004-06-14 18:34:36.0 +0200 +++ CookieCrumbler_new/CookieCrumbler.py2006-06-16 17:34:04.0 +0200 @@ -83,6 +83,9 @@ 'label':'Use cookie paths to limit scope'}, {'id':'cache_header_value', 'type': 'string', 'mode':'w', 'label':'Cache-Control header value'}, + #SSL Redirection from Josef Meile + {'id':'ssl_redirect', 'type': 'boolean', 'mode':'w', +'label':'Use ssl after login'}, ) auth_cookie = '__ac' @@ -95,6 +98,9 @@ local_cookie_path = 0 cache_header_value = 'no-cache' +#Patch from Josef Meile +ssl_redirect = 0 + security.declarePrivate('delRequestVar') def delRequestVar(self, req, name): # No errors of any sort may propagate, and we don't care *what* @@ -315,6 +321,11 @@ came_from = req.get('came_from', None) if came_from is None: came_from = req.get('URL', '') + +#Patch from Josef Meile in order to redirect to ssl if using http +if self.ssl_redirect and came_from.startswith('http:'): +came_from = 'https' + came_from[4:] + query = req.get('QUERY_STRING') if query: # Include the query string in came_from @@ -371,6 +382,14 @@ return p.get('label', id) return id +#Patch from Josef Meile +def __setstate__(self,state): +#This method adds new attributes and deletes old ones each time +#that you view old instances of the class +Folder.__setstate__(self,state) +if not hasattr(self,'ssl_redirect'): +self.ssl_redirect = 0 + Globals.InitializeClass(CookieCrumbler) ___ 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: Render DTML inslide ZPT slot
Max M wrote at 2006-6-16 11:01 +0200: >thomas desvenain wrote: >> and how can we transfer the namespace of the current zpt doing : >> >> >> >> as we do in dtml writing : >> >> > > >If it doesn't automatically you can most likely just write: Path expressions do it automatically. -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] transaction.begin() ??
robert rottermann wrote at 2006-6-16 10:03 +0200: >in a unittest I use transaction.begin() as follows: > >import transaction >transaction.get().begin() > >I then get the following error: >AttributeError: 'Transaction' object has no attribute 'begin' > >when I look at the code I am unsure whether transaction should have a >begin method. > >If it does not exist anymore, by what is the method replaced? It moved from the transaction to the transaction manager (what is resonable, as "begin" starts a *NEW* transaction). -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] SSL Redirect for CookieCrumbler
Josef Meile wrote at 2006-6-16 12:54 +0200: >I need to redirect all my http requests to the login_form of the >CookieCrumble to https, so, I wrote this rule in apache: > >RewriteRule ^/login/login_form(.*) https://server/login/login_form$1 [NE,L] > >It authenticates me through ssl, but then it cames back to http. I saw that >the problem is that the came_from variable refers to the original http >request; something like this: > >https://server/login/login_form?came_from=http%3A//server/page&retry=&disabl >e_cookie_login__=1 > >Is there any way of writing something like this in apache? You rewrite "came_from" in your login form to use "https"... -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] manage_changeProperties has strange side effect on response Content-Type.
Gaute Amundsen wrote at 2006-6-16 13:05 +0200: >All my pages normally have a content-type of ISO-8859-1 >I have not spent much thought on this, it has just worked nicely like that. > >Today I had a page that called a python script, that even when I made it >return an empty string, changed the content-type of my page to utf-8. > >I finally tracked it down to this difference: > >item.manage_changeProperties({'title':'Hustype'}) gives utf-8. "manage_changeProperties" has two usage modes: one for programmatic use and one for ZMI use. As many other management functions, it distinquishes between the two mode by checking whether "REQUEST" is "None". When used from the ZMI, the ZPublisher passes in "REQUEST" which therefore is not None. You passed a positional argument to "manage_changeProperties" which it interprets as "REQUEST". Therefore, it thinks it were used from the ZMI and uses the "management_charset" (or something like that) as encoding. Use "manage_changeProperties(**dict)" instead of "manage_changeProperties(dict)" to avoid this problem. -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] DeadlockDebugger revisited
Matthew X. Economou wrote at 2006-6-16 09:10 -0400: >I thought a recent operating system upgrade (FreeBSD 5.4 to 6.1) fixed >my problems with Zope. Unfortunately, once I re-compiled Python et al >(to remove dependencies on the old libraries), my problems with Zope >deadlocking recurred. I tried to use a combination of tools to try to >discover the root cause of this problem, but nothing seems to work. >What am I missing, and what else can I try? Your description seems to match an error case, I have seen under Python 2.3.4 with Linux 2.4 kernel: When a SIGSEGV occurs, then Zope's main thread (the ZServer thread) dies (and Zope therefore stops responding) but the other threads remain alive and keep all sockets open. The primary culprit was Python, although the Linux thread implementation had to help to expose the bug in this way. I had thought that the problem were fixed in Python 2.3.5 (which you use). Thus, maybe, your problem is different from the one outlined above. Use OS means to check in what state the various Zope threads are and whether the primary thread still exists. If this is not the problem cause, you can attach your Zope process with "gdb" and analyse the state -- especially that of the main thread. There is a howto around how to do that. -- Dieter ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] acl_users in MySQL
Hello, I've been searching for a solution on how to integrate my actual database of users (in MySQL) with the Zope authentications machinery. I found some old instructions (2001) using LoginManager and zPatterns but I would like to hear from you about the alternatives. Currently I'm using my own authentication method but with this I'm loosing a lot of Zope features. Zope 2.9 MySQl 4.1 Using reverse proxy with Pound Any suggestions? Thanks in advance. -- Luiz Fernando B. Ribeiro Engenho Soluções para a Internet ___ 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] acl_users in MySQL
Suggestion: have a look at exUserFolder. It has a MySQL Authentication Source. The minimum requirement is a table with Username, Password and Roles fields. Cliff Luiz Fernando B. Ribeiro wrote: Hello, I've been searching for a solution on how to integrate my actual database of users (in MySQL) with the Zope authentications machinery. I found some old instructions (2001) using LoginManager and zPatterns but I would like to hear from you about the alternatives. Currently I'm using my own authentication method but with this I'm loosing a lot of Zope features. Zope 2.9 MySQl 4.1 Using reverse proxy with Pound Any suggestions? Thanks in advance. ___ 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] setting up fast_cgi
Hi,I just installed FastCGI-2.4.0-12 and add manually my mod_fastcgi.conf then restart apache. I got this error# /etc/init.d/apache2 restartSyntax error on line 1 of /etc/apache2/conf.d/mod_fastcgi.conf: Invalid command 'FastCgiIpcDir', perhaps misspelled or defined by amodule not included in the server configurationRight, as if the module hasn't been installed yet. Here's the configuration file: FastCgiIpcDir /tmpFastCgiExternalServer /srv/www/htdocs/zope \ -socket zope.soc\ -pass-header AuthorizationDid i miss something during installation? I know there's apache2-mod_fcgid package, but it's not fast_cgi, as the description said, "Alternative FastCGI module for Apache2". I need fast_cgi because i want to integrate zope to apache and there's no manual doing that with apache2-mod_fcgid. I'm using 10.1 on i686. Please help.Regards,Adinda Praditya ___ 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] setting up fast_cgi
Oops, of course I should have attached the file... On 6/17/06, Marco Bizzarri <[EMAIL PROTECTED]> wrote: I'm not sure it will be useful to you: here is the site configuration I use with Apache2, Fastcgi and Zope. Keep in mind: 1) virtual server name is emmebi.paflow.icube.it 2) server is running on port 81 3) Zope fastcgi server is running on port 12081 Regards Marco On 6/15/06, Adinda Praditya <[EMAIL PROTECTED]> wrote: > Hi, > > I just installed FastCGI-2.4.0-12 and add manually my mod_fastcgi.conf then > restart apache. I got this error > > # /etc/init.d/apache2 restart > Syntax error on line 1 of > /etc/apache2/conf.d/mod_fastcgi.conf: > Invalid command 'FastCgiIpcDir', perhaps misspelled or defined by a > module not included in the server configuration > > Right, as if the module hasn't been installed yet. Here's the configuration > file: > > > FastCgiIpcDir /tmp > FastCgiExternalServer /srv/www/htdocs/zope \ > -socket zope.soc\ > -pass-header Authorization > > > Did i miss something during installation? I know there's apache2-mod_fcgid > package, but it's not fast_cgi, as the description said, "Alternative > FastCGI module for Apache2". I need fast_cgi because i want to integrate > zope to apache and there's no manual doing that with apache2-mod_fcgid. I'm > using 10.1 on i686. Please help. > > Regards, > > Adinda Praditya > > > ___ > 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 ) > > > -- Marco Bizzarri http://notenotturne.blogspot.com/ -- Marco Bizzarri http://notenotturne.blogspot.com/ emmebi.conf Description: Binary data ___ 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] setting up fast_cgi
FastCGI on Zope is obsolete and deprecated. Follow the common way and use Apache or Squid as reverse proxy. -aj --On 15. Juni 2006 16:54:40 +0700 Adinda Praditya <[EMAIL PROTECTED]> wrote: Hi, I just installed FastCGI-2.4.0-12 and add manually my mod_fastcgi.conf then restart apache. I got this error # /etc/init.d/apache2 restart Syntax error on line 1 of /etc/apache2/conf.d/mod_fastcgi.conf: Invalid command 'FastCgiIpcDir', perhaps misspelled or defined by a module not included in the server configuration Right, as if the module hasn't been installed yet. Here's the configuration file: FastCgiIpcDir /tmp FastCgiExternalServer /srv/www/htdocs/zope \ -socket zope.soc\ -pass-header Authorization Did i miss something during installation? I know there's apache2-mod_fcgid package, but it's not fast_cgi, as the description said, "Alternative FastCGI module for Apache2". I need fast_cgi because i want to integrate zope to apache and there's no manual doing that with apache2-mod_fcgid. I'm using 10.1 on i686. Please help. Regards, Adinda Praditya -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: [EMAIL PROTECTED] - Phone +49 - 7071 - 793376 E-Publishing, Python, Zope & Plone development, Consulting pgpIRBienRWdn.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] About integrating zope with apache2
Hi,I read WEBSERVER.txt and failed to integrate zope with apache2 using FastCGI. Is there any alternative docs or manual doing so? There's apache-mod_fcgid package which comes from my distro. Can i use that instead? Thanks,Adinda P ___ 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] About integrating zope with apache2
--On 16. Juni 2006 10:39:42 +0700 Adinda Praditya <[EMAIL PROTECTED]> wrote: Hi, I read WEBSERVER.txt and failed to integrate zope with apache2 using FastCGI. Is there any alternative docs or manual doing so? There's apache-mod_fcgid package which comes from my distro. Can i use that instead? Once again: FastCGI is obsolete and deprecated. Use Apache/Squid as reverse proxy. This documented in multiple documentation including the Zope Book. The magic google words are "zope apache virtual hosting" or "zope apache reverse proxy"also plone.org and zope.org contain lots of documentations on this subject. -aj pgpjHy8HznCHL.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )