Re: [Zope-dev] Create Virtual DataSkin
At 08:34 PM 11/27/00 -0500, [EMAIL PROTECTED] wrote: >Thanks Phillip. Is there a way to pass my REQUEST info to the ADD >Trigger? > >I am under the impression that only "self" and some other ZPattern >specific properties are available to the trigger. You also have access to everything in the acquisition hierarchy of the trigger or SkinScript method itself, which of course includes REQUEST. So either REQUEST (which would look it up in the trigger's acquisition hierarchy) or self.REQUEST (which would look it up in the DataSkin's acquisition hierarchy) should work fine. Now that I've told you *how* to get at it, however, I should warn against making too much use of the request to get information that could've/should've been passed to the DataSkin by application or domain code. It makes sense to use the request if you want to log things about the request that caused the change, but it's probably not a good idea to be looking at form fields and such, since that would introduce an undesirable coupling between your application structure and your triggers. Ideally, triggers should only look to the DataSkin for anything other than methods or constants they need to carry out their job. In practice of course, if you want to do something like log the AUTHENTICATED_USER and whether they were logged in via SSL, then of course the REQUEST is the right way to do it. ___ 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] Create Virtual DataSkin
Thanks Phillip. Is there a way to pass my REQUEST info to the ADD Trigger? I am under the impression that only "self" and some other ZPattern specific properties are available to the trigger. Thanks. > Phillip J. Eby You can't have an ADDED and CHANGED both fire in the same subtransaction. ADDED, CHANGED, and DELETED are mutually exclusive. So your ADDED trigger has to perform the same operations to save data as your change trigger would. ___ 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] Create Virtual DataSkin
At 02:34 PM 11/27/00 -0800, Ben Schochet wrote: >Seems that way Steve. > >I have tried to do this in an external method with self.get_transaction.commit(1) before doing the changeProperties, but that didn't seem to work. You want get_transaction().commit(1), if you're doing it from Python. DataSkins also have a commitSubtransaction() method that can be used to do this. >Is there another way to do this? the CHANGE trigger works fine on its own. > >How are others creating new items with properties from an HTML FORM? Should I be doing this another way? > >I can't wait to figure out ZPatterns, I think it is the best way to create Zope applications! It seems to allow you to have the best of Zope objects along with your data secure and accessible from a RDBMS. (At least that is the value I see, there are probably others...) > You can't have an ADDED and CHANGED both fire in the same subtransaction. ADDED, CHANGED, and DELETED are mutually exclusive. So your ADDED trigger has to perform the same operations to save data as your change trigger would. One easy way to do this is to do: WHEN OBJECT ADDED ...stuff to do for adding only WHEN OBJECT ADDED,CHANGED ...stuff to do when changing or adding Since the triggers are fired in order, and both triggers fire on add, that should be pretty easy to set up. Note that in this case, you won't need to commit a subtransaction. Subtransaction commits are really pretty rarely needed. About the only time you should *normally* need a subtransaction commit is that if you have triggers you want to take effect before you move on, like triggers that update an index you're about to search. The normal assumption in Zope however is that you generally keep your read and write transactions seperate; i.e. a POST usually results in a redirect to the updated object, or something of that sort. ___ 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] Create Virtual DataSkin
Seems that way Steve. I have tried to do this in an external method with self.get_transaction.commit(1) before doing the changeProperties, but that didn't seem to work. Is there another way to do this? the CHANGE trigger works fine on its own. How are others creating new items with properties from an HTML FORM? Should I be doing this another way? I can't wait to figure out ZPatterns, I think it is the best way to create Zope applications! It seems to allow you to have the best of Zope objects along with your data secure and accessible from a RDBMS. (At least that is the value I see, there are probably others...) Please help. Thanks, -Ben >>> Hmm... since triggers are done at transaction commit time, could it be that the 'change' trigger doesn't happen if the change occurs on the same transaction as an 'add'? -steve > "bentzion" == bentzion <[EMAIL PROTECTED]> writes: bentzion> This simple issue is driving me crazy... I am trying to bentzion> create a DataSkin with some Properties in a MySQL bentzion> database. So I have an ID, NAME, and DESCRIPTION that is bentzion> in REQUEST and using: ___ Visit http://www.visto.com/info, your free web-based communications center. Visto.com. Life on the Dot. ___ 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] Create Virtual DataSkin
Hmm... since triggers are done at transaction commit time, could it be that the 'change' trigger doesn't happen if the change occurs on the same transaction as an 'add'? -steve > "bentzion" == bentzion <[EMAIL PROTECTED]> writes: bentzion> This simple issue is driving me crazy... I am trying to bentzion> create a DataSkin with some Properties in a MySQL bentzion> database. So I have an ID, NAME, and DESCRIPTION that is bentzion> in REQUEST and using: bentzion> nips="ni.propertysheets.get('Basic')"> "nips.manage_changeProperties(REQUEST=REQUEST)"> bentzion> bentzion> The item gets created but the Properties are not bentzion> changed. bentzion> Can someone please post the ADD/CHNAGE Trigger syntax bentzion> and accompanying ZSQL Methods for a simple creation of a bentzion> DataSkin ZClass. bentzion> Much appreciated. ___ 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] Create Virtual DataSkin
This simple issue is driving me crazy... I am trying to create a DataSkin with some Properties in a MySQL database. So I have an ID, NAME, and DESCRIPTION that is in REQUEST and using: The item gets created but the Properties are not changed. Can someone please post the ADD/CHNAGE Trigger syntax and accompanying ZSQL Methods for a simple creation of a DataSkin ZClass. Much appreciated. ___ 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 )