[Zope-dev] transaction support for ordering transactions.
As part of making SQLSession transaction-sane, I'd like to be able to specify that something can register itself to be committed or aborted earlier in the list of objects rather than just being put on the end of the list. The reason for this: I want SQLSession to just use a normal DB connection, and have the commits &c to "just work". The new code now only does the SQL statements in SQLSessionObj's _finish() method - unfortunately, by that time, the database's '_finish()' method has sometimes already been called (if there's a different database call before the Session object is created, then the database adaptor will be registered first). I thought about various ways of dealing with this, such as being able to say 'register me _before_ that object', but ended up going simply with a flag to say 'put me on the front of the list, rather than the back.' This way, anything that needs to say 'no, put me before the standard ones' can do so. Thoughts? Alternatives? Anthony Patch against current-cvs follows: --- lib/python/ZODB/Transaction.py 2000/05/30 19:03:27 1.22 +++ lib/python/ZODB/Transaction.py 2000/06/06 04:01:51 @@ -117,6 +117,9 @@ for c in self._connections.values(): c.close() del self._connections +def _prepend(self, object): + self._objects = [object] + self._objects + def sub(self): # Create a manually managed subtransaction for internal use r=self.__class__() @@ -315,9 +318,12 @@ del objects[:] # clear registered if not subtransaction and self._id is not None: free_transaction() -def register(self,object): +def register(self,object,early=0): 'Register the given object for transaction control.' -self._append(object) + if early: + self._prepend(object) + else: + self._append(object) def note(self, text): if self.description: -- Anthony Baxter <[EMAIL PROTECTED]> It's never too late to have a happy childhood. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ZPatterns ProperySheet usage example?
"Phillip J. Eby" wrote: > > At 05:07 PM 6/5/00 +0800, Mike wrote: > >Hello people, > > > >could anybode give an example (in code) on subject? > > > > This isn't exactly code, but... > > Set up a LoginManager with a GenericUserSource, and set up the GUS to have > users. Is there documentation on how to do this part available yet? ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Medusa and FTP PUT
Eventually, I found that NullResource is the top level class that handles this first (Objectmanager doesn't inherit off of it -- it inherits off of Resource, which would explain why I couldn't override the PUT method). It has a block of logic similar to ObjectManager.PUTer that checks the mime-types and instanciates DTMLDocuments, Files, Images appropriately. The docstring for NullResource says: Null resources are used to handle HTTP method calls on objects which do not yet exist in the url namespace so I'm assuming my overidden PUT method will never be called by the Medusa FTP server if I try to put a nonexisting file on the server. However, I tried to change the content of an existing file (an XMLDocument instance) using angle-ftp and xemacs and my overidden PUT was 'still' never invoked and a DTMLDocument with the new content was put in it's place. Go figure Chimezie Thomas-Ogbuji wrote: > > I tried hacking the ObjectManager.py code (specifically the PUTer helper > class), > however it seemed to have no effect when I upload a .xml file (it > creates > a DTMLDocument). I even tried removing the logic that creates > a DTMLDocument, but regardless, it still creates a DTMLDocument when I > upload a .xml file. I tried deleting the .pyc problem in case it was > caching the module, but to no avail. I even added a print statement > to the PUT method (which usually gives a display on stdout) but nothing > happened when I tried to put a new .xml file anywhere in the Zope > heirarchy. > > Do you have any idea? How is the content type determined anyways? Is > this determined > by the medusa server core, or is this set by the client (I don't think > it's the latter > because most ftp clients only allow you to set the file type as ascii or > binary only). > > -- > Chimezie Thomas-Ogbuji > Consultant > Fourthought Inc. > (303) 583 9900 ext 104 > [EMAIL PROTECTED] -- Chimezie Thomas-Ogbuji Consultant Fourthought Inc. (303) 583 9900 ext 104 [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Security is Hard (was Import from upload?)
At 12:05 PM 6/5/00 -0400, Evan Simpson wrote: > >Security is hard :-/ > No kidding. And just think, all the hard stuff that's been done to avoid trojans in a portal-ish site can be defeated simply by a user making a page that looks like the portal's login screen and asking the user to "verify" their password before accessing the "secure content" at that location... ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ZPatterns ProperySheet usage example?
At 05:07 PM 6/5/00 +0800, Mike wrote: >Hello people, > >could anybode give an example (in code) on subject? > This isn't exactly code, but... Set up a LoginManager with a GenericUserSource, and set up the GUS to have users. Make sure that the GUS has a "Persistent Sheet Provider" on the "Sheet Providers" tab. Then go to: /acl_users/someuser/propertysheets/manage_addPropertySheet?id=sheetname&ns= You should get a screen that says "OK". Then go to: /acl_users/someuser/propertysheets/sheetname/manage And you should see a propertysheet editor for your new sheet. (Unfortunately, it won't let you edit anything unless your user class is based on PropertyManager, due to an oversight in ZPatterns 0.3.0; the VirtualSheets class needs "def propertyLabel(self,id): return id" to work with the default Zope UI for a non-ZClass property sheet.) Or go to: /acl_users/someuser/propertysheets/manage And you should see your new propertysheet listed on the sheets management interface (which is somewhat broken, but that's because the basic one in Zope is, it's not ZPatterns' fault. ;) ) Anyway, this is all very primitive but should get better in later versions. 0.4.0 fixes the 0.3.0 and either it or 0.5.0 will replace the broken propertysheets/manage screen with one that will let you add/edit/delete sheets properly. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] The future of Zope with XML( XSLT revisited )
Well, the XSLT Method can process XMLDocuments, and should soon be able to process any ZDOM decendents. So once ZDOM becomes fully integrated with Zope we will have a fully integrated XSLT processor. Josh Zeidner wrote: > > Hi, > > It is great stuff! ( similar idea to Apache Cocoon )... now all we need is > someone to put in an XSLT( 4XSLT ) processor into the core Zope code- are > there any immediate plans for this? note: i realize this has been discussed > before :) . > > -thanks, Josh Z > > >Hi, Josh > > > > Thanks for the insight! I also just noticed that there is a whole lot > >of > >good information already up there in the Wiki. This does look like great > >stuff. I see how it complements Zope's current data storage capabilities. > >It > >provides good ways to move XML data in and out of the ZODB via XSLT and to > >store and manipulate XML data efficiently using XML Documents. These are > >excellent capabilities indeed. > > > > Have a great weekend! > > > >Kevin > > > >- Original Message - > >From: "Josh Zeidner" <[EMAIL PROTECTED]> > >To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > >Sent: Friday, June 02, 2000 10:54 AM > >Subject: Re: [Zope-dev] The future of Zope with XML( what does ZDOM do for > >us? ) > > > > > > > > > > Hi Kevin, > > > > > > What FourThought/DC are currently doing with Zope will allow for fast > > > transformations to memory-resident structured data( ZDOM or whatever ) > >to > > > exportable XML documents( which are simply strings of characters ). > >This > > > introduces( to the Zope world ) cutting edge metaphors in > >web-application > > > design. All data to be served to a client is some form of XML: > >including > > > HTML ( a better term: structured data ). The internal structure, or > > > representation( or "deep structure" if you are into Chomsky ), is the > > > data/knowledge as the web site managers see it- and most likely the most > > > accurate and flexible when dealing with the particular > >ormation-domain( > > > this is what theyre paid for :) ). Each user has custom needs- and > >wants to > > > see this information the way they( or the applications working on thier > > > behalf ) are accustomed to. So, architectually speaking, we need a way > >to > > > easily and quickly construct XML documents from some meta-type( our > >internal > > > structure ). This is what ZDOM is accomplishing for us. > > > > > > Parsing is a expensive endeavor. It is not practical to parse > >character > > > streams every time we want to get at our data. So the solution is to > > > represent the data as something more computationally digestible. Again > >: > > > this is > >what ZDOM is accomplishing for us. > > > > > > Does this answer your question? > > > > > > have a good weekend, > > > > > > Josh Zeidner > > > > > > > > > > > > -"zippa-dee-doo-da" , uncle remus > > > > > > >Hello, > > > > > > > > Thanks for getting this document going. It's good to see where XML > >is > > > >going in Zope. > > > > > > > > I do have a question, though. For me, the main value in XML has > >been > > > >in > > > >its usefulness as a flexible interchange format. Right now, I can store > > > >data > > > >as objects (either straight Python or ZClasses) in Zope and transform > >those > > > >into XML if I need to share it with the outside world (eg RSS). > >Similarly, > > > >though I haven't done this, I believe I can take XML from the outside > > > >world, > > > >parse it and store it in objects in the database. Are there advantages > >to > > > >storing the data in Zope as XML vs. storing my data as objects? > > > > > > > >Thanks, > > > >Kevin > > > > > > > >- Original Message - > > > >From: Glenn Gasmen > > > >To: [EMAIL PROTECTED] > > > >Cc: [EMAIL PROTECTED] > > > >Sent: Thursday, June 01, 2000 11:05 PM > > > >Subject: [Zope-dev] The future of Zope with XML > > > > > > > > > > > >http://www.zope.org/Wikis/zope-xml/Unified%20Vision > > > > > > > >___ > >Zope-Dev maillist - [EMAIL PROTECTED] > >http://lists.zope.org/mailman/listinfo/zope-dev > >** No cross posts or HTML encoding! ** > >(Related lists - > > http://lists.zope.org/mailman/listinfo/zope-announce > > http://lists.zope.org/mailman/listinfo/zope ) > > > > > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com > > ___ > Zope-Dev maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope-dev > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope ) -- Chimezie Thomas-Ogbuji Consultant Fourthought Inc. (303) 583 9900 ext 104 [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-
[Zope-dev] ZPatterns ProperySheet usage example?
Hello people, could anybode give an example (in code) on subject? Thanks, Mike ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope] HappySession 0.1.0 released!
>From: Itamar Shtull-Trauring <[EMAIL PROTECTED]> >I'd be very grateful for a description of how you built the session server >in combination with persistence, transactions, and the fact that each >thread >has it's own copy of data. > >If I understood correctly, the references to the server are stored in the >class (which I assume is global for all Zope threads.) I see some worries from, you, ha! Let me explain a little bit to calm down your worries. First of all, let me tell you that the long term plan goes way beyond what the innocent happy face may hide. :) HappySession is aimed at serving multiple copies of Zope running at multiple threads each, and with multiple session servers located at multiple machines! It's not doing that now, but I have laid out things so it can be extended that way. And I have separated client aspects from server aspects in my code, so eventually it can be hooked up to SQL server or File System server, not just RAM server. (1) Persistence: no need to worry about storing garbage in ZODB. No persistence at all for the session data. You are correct, the main session data is stored in the class, which is global to all Zope threads. (2) Transaction: per REQUEST transaction per thread, a copy of the session data pertinent to that particular REQUEST is created as volatile attribute inside the SESSION instance. The updated temporary copy is stored back to the main session data if and only if transaction completes without errors. (3) Thread safety: locking mechanim is in place to prevent simultaneous modification of the main session data dictionary from different threads. All is in the codes. Take a look and you'll see it's not too innocent at all. :) regards, Hung Jung Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Wrapper Interface
Hi, I've come across the need for this a few times now and I'm wondering if there is/should be a better/standard way of doing it. Basically, there seems to be a 'type' of object which basically does something and then calls another (specified per instance) method. Examples: Site Access Rule - Calls the specified method before traversal Mail-in Client - Calls a specified method when an incoming email is recieved for the appropriate address. There was another one too but I can't remember it :( The way SiteAccess did this wasn't pretty but seemed like the right idea. I'm more inclined to do this with a seperate object that has a dropdown list for you to choose the method from. Anyone know hwo I can do this? Any other comments? Chris ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Import from upload?
- Original Message - From: Toby Dickenson <[EMAIL PROTECTED]> > I dont think that's going to fly. It's perfectly ok for a persistant > object to contain something that shouldn't be creatable. True enough. Further thought has made me realize that a persistent object could contain only valid instances and values, yet still subvert security simply by playing with normally inaccessible instance attributes (eg. import an acl_users containing a user with roles you don't possess). Doing things right would involve inspecting each unpickled object minutely to make sure it didn't have a bomb in its guts. Security is hard :-/ Cheers, Evan @ digicool & 4-am ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope] HappySession 0.1.0 released!
Hung Jung Lu wrote: > I have been using RAM-based session management for a while, but never wrote > a product for it. Since Graham Chiu has mentioned it again about making a > real product, I have taken the time to make one, and called it HappySession. > :) Well, in short, it uses cookie for session id, you specify a maximum > session expiration time, and expired session data are automatically deleted. > It's Zope-transaction-aware. I'd be very grateful for a description of how you built the session server in combination with persistence, transactions, and the fact that each thread has it's own copy of data. If I understood correctly, the references to the server are stored in the class (which I assume is global for all Zope threads.) -- Itamar S.T. [EMAIL PROTECTED] "It don't get thingier than that!" ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )