Re: [Zope] dynamically creating zip file, returning to user
John Toews schrieb: > Thanks Tino, I'll definately give that a try too. The quick fix seemed > to be opening the file for read in binary mode... that should have been > obvious. Posting another dumb question to the list now. ;) no, dot use a regular file! Use the tempfile module! And dont reopen but seek to the start - f.seek(0) You just open it for "rw". ___ 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] Change object/role permissions w/ python?
On Thu, 5 Jan 2006 19:13:13 -0800 John Toews <[EMAIL PROTECTED]> wrote: > I have a need to restrict anonymous access to an object > until after a specific action occurs. For example, the > View permission by default is restricted to owner and > manager, but after a 'release' flag is checked, it is > viewable to anyone. I can't seem to find a way to do this > programatically, after googling for a few hours over the > past few weeks. Is it possible? I think the user running > the action would need 'change permissions' rights... is > there anyway to override that? 1) Provide a script that makes this change. 2) Give it the necessary permissions 3) Use the "proxy" feature to allow the script to run with its own permissions when called (look at the tabs available on the script editing view) 4) Call this script from the "action" on your release form. Cheers, Terry -- Terry Hancock ([EMAIL PROTECTED]) Anansi Spaceworks http://www.AnansiSpaceworks.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] Change object/role permissions w/ python?
John Toews wrote: Hi all, I have a need to restrict anonymous access to an object until after a specific action occurs. For example, the View permission by default is restricted to owner and manager, but after a 'release' flag is checked, it is viewable to anyone. I can't seem to find a way to do this programatically, after googling for a few hours over the past few weeks. Is it possible? I think the user running the action would need 'change permissions' rights... is there anyway to override that? Thanks again! John John, Here's a solution that at best will stimulate a better answer :-) tal:condition="python: request.get(releaseFlag,0)">some link or tal:condition="python: not request.get(releaseFlag,0)">some other link David ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Change object/role permissions w/ python?
Hi all, I have a need to restrict anonymous access to an object until after a specific action occurs. For example, the View permission by default is restricted to owner and manager, but after a 'release' flag is checked, it is viewable to anyone. I can't seem to find a way to do this programatically, after googling for a few hours over the past few weeks. Is it possible? I think the user running the action would need 'change permissions' rights... is there anyway to override that? Thanks again! John ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] migrating a zodb
At Thursday 5/1/2006 19:55, David Bear wrote: I installed zope 2.7.4 from FreeBSD packages. Trouble is that I already had python 2.4 installed. It appears the package just used that version of python since zope says it is using python 2.4. I've run in to a few wierd things and would like to get a zope instance a little more reliable. I was thinking of just making a copy of my zodb file, removing the zope pkgs, then do a source install with python 2.3. Is the zodb file plug and play transferrable? Can I just copy the zodb into the a new zope instance and go? Yes, usually. That depends a bit on the Products you have installed. When you remove a product, all its instances will become broken (your zodb might contain such old instances even if unused). Or, if the product does some not-so-portable things like storing a full path to an external file as an attribute (there are some examples...) you'll have some problems if you install into another directory. But in general, if no such odd things happen, it's just "plug and play". Gabriel Genellina Softlab SRL ___ 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] migrating a zodb
I installed zope 2.7.4 from FreeBSD packages. Trouble is that I already had python 2.4 installed. It appears the package just used that version of python since zope says it is using python 2.4. I've run in to a few wierd things and would like to get a zope instance a little more reliable. I was thinking of just making a copy of my zodb file, removing the zope pkgs, then do a source install with python 2.3. Is the zodb file plug and play transferrable? Can I just copy the zodb into the a new zope instance and go?-- David BearWhat's the difference between private knowledge and public knowledge? ___ 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] Cookie Crumbler
Yes, after reading the source code. However, my problem as I found out is that I do not know how to access the methods in CC from DTML. I am not well verse with Python (still learning though).Thank you.Dieter Maurer <[EMAIL PROTECTED]> wrote: Infor Gates wrote at 2006-1-4 20:14 -0800:>I have a trying time using Cookie Crumbler 1.2 with Zope2.8.4 (windows version).>I could NOT figure out how to log out a user. I have simplified to the orginal logged_out form to this:The "Cookie Crumber" has a "logout" method.You should use it for the logout (and not try to emulate it yourself).You can activate it via an URL of the form:url_to_your_cookie_crumbler/logoutIt will redirect to the "logout_page" (you can configure foryour "Cookie Crumbler".-- Dieter Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.___ 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: Cookie Crumbler
Hi Infor, I found that my weakness is that I am DTML scripter. After printing the Cookie Crumbler source code, > I need some help/advice as how to access the Cookie Crumbler methods or api from DTML. I have searched > the Zope documents however have found none that can help. I would appreciate some advice or pointers. Thank you. Infor Gates wrote: Dear zopist I have a trying time using Cookie Crumbler 1.2 with Zope2.8.4 (windows version). I could NOT figure out how to log out a user. I have simplified to the orginal logged_out form to this: logout Except for the "/manage_zmi_logout" part, I'm using some similar script. I'm using it on zope 2.6.4 and it works. I don't know if it works in 2.8.4. Anyway, here it is: Note: Yes, I expired the cookie twice. If I'm not wrong, I recall to have had problems with only one call (Not sure). 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 )
Re: [Zope] Cookie Crumbler
Infor Gates wrote at 2006-1-4 20:14 -0800: >I have a trying time using Cookie Crumbler 1.2 with Zope2.8.4 (windows >version). >I could NOT figure out how to log out a user. I have simplified to the >orginal logged_out form to this: The "Cookie Crumber" has a "logout" method. You should use it for the logout (and not try to emulate it yourself). You can activate it via an URL of the form: url_to_your_cookie_crumbler/logout It will redirect to the "logout_page" (you can configure for your "Cookie Crumbler". -- 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] Cookie Crumbler
I found that my weakness is that I am DTML scripter. After printing the Cookie Crumbler source code, I need some help/advice as how to access the Cookie Crumbler methods or api from DTML. I have searched the Zope documents however have found none that can help.I would appreciate some advice or pointers.Thank you.Infor Gates <[EMAIL PROTECTED]> wrote: Dear zopistI have a trying time using Cookie Crumbler 1.2 with Zope2.8.4 (windows version).I could NOT figure out how to log out a user. I have simplified to the orginal logged_out form to this: logoutHowever, neither this nor the original logged_out dtml seems to work. Is it because I am using frames in my dtml that causes it or I am getting the concept of how Cookie Crumbler works?Thank you. Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.___Zope maillist - Zope@zope.orghttp://mail.zope.org/mailman/listinfo/zope** No cross posts or HTML encoding! **(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) Yahoo! DSL Something to write home about. Just $16.99/mo. or less___ 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] dynamically creating zip file, returning to user
John Toews schrieb: > Zope 2.8.0, Python 2.3.5 > > I'm having a heck of a time figuring out how to zip up some files in my > zope instance and return them to the user. I can sucessfully create a > zip file on the local file system, but if I try to pass it back to the > user it is corrupted. Of course I'd rather not create this tmp3.zip > file, so if there's a way around that (which I'm sure there is!) please > do let me know. > > filename = 'test.zip' > response = self.REQUEST.RESPONSE > response.setHeader('Content-Type','application/zip') > response.setHeader('Content-Disposition','attachment; > filename=%s' % filename) > # tried zf = zipfile.ZipFile( response, 'w' ) but get error, > ZHTTP object doesn't have tell method > zf = zipfile.ZipFile( '/tmp3.zip', 'w' ) > zf.writestr( 'testfilename', str( self._getOb( testfileid ) ) ) > zf.close() > f = open('/tmp3.zip') > return f.read() > Try with zipefile.ZipFile(response,"a"), this should avoid the use of tell (untestet) otoh, If you'd use the tempfile module and dont return f.read() but use FileStreamIterator with it, you even have a win performance-wise. HTH Tino ___ 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: ZServer threads and pool-size question
I saw that once on Zope 2.8.4, cause I was using a connection in a independent thread not linked to any incoming request and had forgotten about it ;) Never since then, so it looks like threads = pool size is fine for my setup. Can you confirm this feature is included in Zope 2.8 ? Pascal -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Florent Guillaume Envoyé : mercredi 4 janvier 2006 15:43 À : Jens Vagelpohl Cc : zope@zope.org Objet : [Zope] Re: ZServer threads and pool-size question Jens Vagelpohl wrote: > On 4 Jan 2006, at 13:23, Pascal Peregrina wrote: >> Can anyone tell me why, by default in a zope instance config file, >> the connection pool size is 7 while the number of zserver threads is 4? >> Why not 4 and 4? > > > Because under some conditions you can actually have more than 4 > connections in use. Not having extra connections available has the > potential to block the server. That's not true anymore in recent ZODBs. Zope 2.9 will never block and always allocate new connections as needed. It will log warnings if the number grows too much though. Florent -- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D +33 1 40 33 71 59 http://nuxeo.com [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 ) ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] ZServer threads and pool-size question
Thanks, I will try that ;) -Message d'origine- De : Dieter Maurer [mailto:[EMAIL PROTECTED] Envoyé : mercredi 4 janvier 2006 19:52 À : Pascal Peregrina Cc : Jens Vagelpohl; zope list user Objet : RE: [Zope] ZServer threads and pool-size question Pascal Peregrina wrote at 2006-1-4 13:34 -: >I understand. > >So what is the typical value to use for pool-size given a certain threads >number: n+3 ? It depends on how intensively you are using additional (application level) threads: Each thread using persistent objects requires in general (at least) one ZODB connection. As such threads are relatively rare, additional 3 connections is not too bad for the general case. -- Dieter ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )