[Zope] Permissions on Z MySQL Database connection
I am trying to secure a Z MySQL Database connection. Specifically, I don't want anyone other than the Owner to be able to see the Properties page (since that contains database password details). I've tried changing various permissions but none do what I want. "Change Database Connections" controls changing the connection on the Properties page but doesn't prevent viewing. "View Management screens" controls access to the Status page. "View", "Manage properties", "Access contents information" have no obvious effect. Could anyone provide any suggestions? Thanks Cameron ___ 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] Accessing Zope REQUEST data from a Python module
hi ken, very often you can replace context with self. so instead of context.REQUEST you use self.REQUEST. robert Ken Winter schrieb: > I'm customizing a product. To do what I'm trying to do, I need to be able > to access REQUEST data from within a Python module (not a script; a .py file > containing class and method definitions). > >>From within a script, a line like > > req = context.REQUEST > > does the job just fine. But when I put that line into my product module, I > get a message like: > > Name "context" not defined > > and I don't see any way to import that into my module. > > At (http://www.plope.com/Books/2_7Edition/AppendixB.stx#0-8), the Zope API > Reference describes the module "HTTPRequest", which includes the class that > it calls "HTTPRequest(BaseRequest)", which apparently is the equivalent of > REQUEST as described above. I have put this line into my module: > > from ZPublisher.HTTPRequest import HTTPRequest > > but now I don't know how to reference the request's contents. I put in this > line: > > req = HTTPRequest > > and print "req" to a debug file, and it shows: > > ZPublisher.HTTPRequest.HTTPRequest > > which I don't understand. I have tried a half-dozen ways (suggested by the > Zope API Reference) to get an actual property of the current HTTPRequest, > but without success. Examples: > > req['URL'] -> "TypeError: unsubscriptable object" > req.get('URL') -> "TypeError: unbound method get() must be called > with HTTPRequest instance as first argument (got str instance > instead)" > req.keys() -> "TypeError: unbound method keys() must be called with > HTTPRequest instance as first argument (got nothing instead)" > > The last two suggest that, while I have successfully imported the > HTTPRequest *class*, I haven't successfully gotten the current HTTPRequest > *instance*. I don't know how to do that. > > So, I need an answer to any one of these questions: > > 1. How can the Zope global name "context" be defined or imported into a > non-script Python module? > > 2. How can one get the current instance of the class "HTTPRequest" into a > non-script Python module? > > 3. If I'm looking in the wrong direction, what is the right way to make the > current REQUEST's data available in a non-script Python module? > > ~ TIA > ~ Ken > > > ___ > Zope maillist - Zope@zope.org > http://mail.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://mail.zope.org/mailman/listinfo/zope-announce > http://mail.zope.org/mailman/listinfo/zope-dev ) > begin:vcard fn:Robert Rottermann n: Rottermann;Robert email;internet:[EMAIL PROTECTED] tel;work:++41 31 333 10 20 tel;fax:++41 31 333 10 23 tel;home:++41 31 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] temporary exclude page from ram-cache
(Wed, Dec 05, 2007 at 04:33:33PM +0100) Jaroslav Lukesh wrote/schrieb/egrapse: > I have RAM-cached page that looks for data from SQLdb. For error > suppression (yea, I use MSSQL which make sometime unbelievable SQL > error with the same errorless query) I use try-except wrapper, but in > some cases page is cached without db results for a long time. > > I know how to invalidate already rendered page from a ram cache, but > I does not know how to temporal disable RAM-cache during rendering of > that page. If with the ramcached "page" you mean a ZPT, the answer is "don't do this". Please refer to the RAM Cache documentation why not to cache complete ZPTs. The proper setup is to cache only the method that returns the data, if you do that you can look at the result and/or check if any exceptions were raised and decide if you update the cache or not. When you look at the example code on http://betabug.ch/blogs/ch-athens/635 you see immediately where you can decide to do self.ZCacheable_set or not. Regards, Sascha ___ 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] Accessing Zope REQUEST data from a Python module
(Wed, Dec 05, 2007 at 07:35:22PM -0500) Ken Winter wrote/schrieb/egrapse: > I'm customizing a product. To do what I'm trying to do, I need to be able > to access REQUEST data from within a Python module (not a script; a .py file > containing class and method definitions). Usually REQUEST is handed down to your method, as in: def mymethod(self, someparameter, REQUEST=None): and you then test for REQUEST not being None to determine if your method was called through a web browser or from another method. But... why don't you just follow one of the tutorials or sample products for making Zope Products? http://wiki.zope.org/zope2/DiskBasedProduct If I may say so myself, I'd recommend the newest one: http://papakiteliatziar.gr/BetaBoring Also very nice is the tutorial linked from the ZopeStarter page http://wiki.zope.org/zope2/ZopeStarter which is at http://www.upfrontsystems.co.za/courses/zope Regards, Sascha ___ 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 )