[Zope-dev] what transaction does get_transaction().commit() really commit?
hello, I have a method that reads: 8 def do_something(self): from Zope import DB conn = db.open() conn.root()['name'] = 'value' get_transaction().commit() conn.close() 8 the method can be called from everywhere, and that's the reason why I have to open a connection, in case one is not available. the question is: what transaction is commited with get_transaction().commit() ? It is only the one associated with the connection, or also the transaction in which is the caller? I mean, if my method is called from within Zope, is the transaction of the caller commited? thanks for any response regards, [EMAIL PROTECTED] __ Boîte aux lettres - Caramail - http://www.caramail.com
[Zope-dev] Re: AW: jcNTUserFolder
Thank you for the tip with the access file. The remote user mode with challenge\response works perfect if I delete the Password of the access file. But, if I delete the Password of the access file I get a Zope Error when I am not using the challenge\response mode. that is the point :-) As far as I know, it is not possible for Zope to run in remote user mode and normal mode together (they are mutually exclusive) I think that the solution is to run two Zope instances in a ZEO cluster (on the same machine), one which talks with PCGI (and so is in remote user mode) and one which serves directly the requests (and is not in remote user mode) perhaps someone on the list can give his opinion (note that i am not on the zope-dev list, so cc: any answer) The error gets raised in your NTUserFolder.py in line 79 ( return string.lower(login) ) when login is None. (Anonymous login) I changed it to def _normalize(self, login): normalize a login name. Currently, it is made lowercase if login is None: # modification login = 'Anonymous User' # modification return string.lower(login) This is a very ugly hack, but it works. You normally cannot login directly with Zope if it is running in remote user mode. At least, with your patch, one can browse the site anonymously regards, [EMAIL PROTECTED] -Ursprüngliche Nachricht- Von: Jephte Clain [mailto:[EMAIL PROTECTED]] Gesendet: Freitag, 8. Juni 2001 14:25 An: Roesch, Alexander Betreff: Re: jcNTUserFolder we are using your product jcNTUserFolder in challenge/response mode together with IIS on NT4 with Zope 2.2.2. It works perfect. what version? is it 0.0.8 or 0.1.0? Because of bugs in Zope 2.2.2 we want to migrate to Zope 2.3 and jcNTUserFolder 0.1.0 note that 0.1.1 have been released I managed to set up the the NT User Folder as acl_user folder in the root level. Now I still have the problem that the users don't get recognized by zope. They always get prompted for Username / Password / domain. And even if they apply the correct Username / Pwd / domain they get rejected. Could you give me a tip what is going wrong? I need your answer to above questions. if migrating from 0.0.x to 0.1.x, you have to follow the instructions given on http://www.zope.org/Members/jephte/jcNTUserFolder/installation note: for remote user mode to work with zope 2.3.x, you *must* have the access file. it is not installed by default for Zope 2.3.x regards, [EMAIL PROTECTED] __ Boîte aux lettres - Caramail - http://www.caramail.com
[Zope-dev] first zope-2.3.0a2 bug :-)
well, this one is easy. 8-- --- lib/python/Shared/DC/ZRDB/Aqueduct.py.origThu Jan 11 10:59:42 2001 +++ lib/python/Shared/DC/ZRDB/Aqueduct.py Thu Jan 11 10:58:01 2001 @@ -272,7 +272,7 @@ custom_default_report_src=DocumentTemplate.File( -os.path.join(dtml_dir,'customDefaultReport.dtml')) +os.path.join(dtml_dir,'dtml/customDefaultReport.dtml')) def custom_default_report(id, result, action='', no_table=0, goofy=regex.compile('[^a-zA-Z0-9_]').search 8-- without this patch, sql methods cannot we tested because customDefaultReport cannot be found (it moved in the dtml subfolder) ___ 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: how to invalidate the attributecache?
"Phillip J. Eby" wrote: I don't see a need for a mass invalidation operation, just more documentation on these inner workings. :) or the lack of an attribute depencies mechanism :-) if attribute x depends on attribute y from another generic attribute provider, invalidation of y doesn't make y to be recomputed. ___ 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] zpatterns: how to invalidate the attribute cache?
Hello, I feel a need to invalidate a dataskin attribute cache after it has been edited, because other objects might want to use the just modified dataskin, but with the new values. Of course, these values come from some attribute providers that should be re-queried. Any thoughts? It seems that the only way is to redefine _v_attrCache. Please comment this patch: --- DataSkins.py.orig Thu Aug 10 17:20:53 2000 +++ DataSkins.pyThu Aug 10 17:21:47 2000 @@ -97,6 +97,11 @@ """Return attribute cache""" return self._v_attrCache +def _invalidateCache(self): +"""invalidate the current attribute cache""" +v = self._v_attrCache = {} +return v + def _v_readableSlot(self,_v_dm_=_v_dm_): return self.__dict__[_v_dm_]._readableSlotFor(self) regards, [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 )
[Zope-dev] Re: zpatterns-0.4.0a5: problem with unregistering transactionals
Jephte CLAIN wrote: I have a case where Transactional._unregister is called without Transactional._register being called, raising an exception in Transaction._unregister and then in ZODB.Transaction.Transaction.__del__, causing Zope to dump core when it is run as a daemon (because python notifies of the unhandled exception by writin to stderr) I have not yet found why (and how?) an object is Transactional._unregistered without being Transactional._registered before. (I even did not know about the existence of these methods!) But until I understand, this patch allow me to stay alive: Ok, so ZPatterns.Transactional._unregistered method is called twice for a ZPatterns.Transactional object when an exception is raised and the ZPatterns.Transactional object has not be freed: once from the ZODB.Transaction.abort method, once from the ZODB.Transaction.__del__ method which call abort if objects to be aborted remain in the zodb transaction aware object The call is made twice for DataSkins and for TransientMapping (as far as I know, they are at the moment the only Transactional objects in zpatterns) for example, try this DTML code in a specialist: dtml-with "getItem(key='whatever key you have in the specialist')" dtml-raise /dtml-raise /dtml-with without my patch, Zope should display 'uncatched exceptions in Transation object' so what now? I'm lost. Is this normal or not? Is my patch sufficient (ignore attempts to abort the object twice by trapping exceptions in _unregister). What about Transactional.abort which check for tpc_entered? Why is tpc_entered never set to 0? please help regards, [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 )
[Zope-dev] zpatterns-0.4.0a5: problem with unregistering transactionals
hello, I have a case where Transactional._unregister is called without Transactional._register being called, raising an exception in Transaction._unregister and then in ZODB.Transaction.Transaction.__del__, causing Zope to dump core when it is run as a daemon (because python notifies of the unhandled exception by writin to stderr) I have not yet found why (and how?) an object is Transactional._unregistered without being Transactional._registered before. (I even did not know about the existence of these methods!) But until I understand, this patch allow me to stay alive: --- Transactions.py.origThu Jul 20 09:58:00 2000 +++ Transactions.py Wed Jul 26 11:12:25 2000 @@ -45,7 +45,8 @@ self._v_registered = 1 def _unregister(self): -del self._v_registered +try: del self._v_registered +except: pass # From here down, override as you see fit... more to come when I have the time to figure out the problem. it might be a bug in zpatterns :-) regards, [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 )
[Zope-dev] several permissions for the same method
Hello, is it possible for a single method, under Zope 2.1.6, to have several permissions? ie __ac_permission__ = ( ('edit my data', 'edit_data'), ('edit others\'s data', 'edit_data'), ) I have the scenario where a user can edit *its* data but not other users's data, unless he has a special role. however, the method used to edit one's data is the same. So I make sure inside the edit_data method that the user has the adequate permissions if he tries to edit another one's data. this does not work. indeed, lib/python/AccessControl/Permission.py reads: # Attribute names which appear in a # permission may not appear in any other permission defined # by the object. thanks in advance for any advices. regards, [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] zpatterns-0.4: defaults attributes, more...
"Phillip J. Eby" a écrit : Try: data=(self.which_one and [self.second_data] or [self.first_data])[0] wow. what a *clever* idea to use [] around self.???_data. I used to write: data=self.which_one and self.second_data or self.first_data but this failed because sometimes self.second_data is a "false" value (eg 0, '', instead of None that I use for empty values), causing self.first_data to be returned instead. one learns about python every day. thanks for the tip. As I wrote in an earlier post, my initial problem was solved using class_defaut_for_X trick Offhand, I'd guess that there is probably a lot easier way to do what you're doing, and that you probably don't even need/want "id" to be a sequence, let alone some of the other things you're doing here. But without knowing what your app is actually trying to do, I can't suggest anything further. I'm writing an application to track issues. I can not just use DC's tracker product, because my customer's needs are very specials. Well, various entities in my application have a so called 'location'. I wish to be able to re-use the application I'm writing, so I abstracted the concept of 'location'. i have then a specialist to manage locations got from a location rack. The rack I wrote for my customer deals with two-headed locations: (site, subdivision). Each part of the location is managed in a different way, but I need the two to identify one's location. Later, when I install that program for a different customer, I want to be able to rip out the old location rack and put another location rack which can be more 'normal' (ie, one-headed) No one will notice except the key to get the location is now an integer (or a string) instead of a tuple. So, I think I'm doing right to have an id which is a sequence. Thanks for your great help. I'm still fighting to acquire the principle behind zpatterns, but once I get it, I wish I could help others to understand it as well. regards, [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] zpatterns: how to specify default values?
"Phillip J. Eby" a écrit : Yes. Name the attributes "class_default_for_X" where X is the attribute name. Thanks very much. This works with the currently release ZPatterns, but alpha5 will go one better and let you create ZClass property sheets that transparently implement this. That is, if you add a "DataSkin Property Sheet" to your ZClass instead of the standard "Common Instance Property Sheet", that sheet's attributes will be translated to/from the "class_default_for_X" names on the ZClass. I don't use ZClass as I wrote only in Python. I really have to understand how do propery sheets work. What I don't understand is where the properties are stored. This is not clear when I read the PropertyManager source. I guess property sheets are for grouping some related attributes, but the actual work of storing/retrieving the attribute is done by the attribute providers, right? If so, so be it :-) By the way, - is the python programmer have to mix PropertyManager in with DataSkin to use property sheets? I guess so, but what, I seem to be the only one who use zpatterns directly from python. All the ZClass junkies out there do have all the mixin classes ready even before they start :-) - I sometimes have a dataskin that is willing to get something from its context. What is the preferred way to do this: try to acquire the attribute from self._v_rack, wich is guaranteed to be wrapped in the specialist's context, or just mix Acquisition.Implicit in with DataSkin? regards, [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 )
[Zope-dev] zpatterns-0.4: creating an item in virtual mode
Hello, I use virtual attribute access to provide access to my SQL database. However, I want to use the Rack.newItem facility to create new records in the database. But it fails because in virtual mode, an item always exists. This patch solves the problem, at least for me --- Rack.py.origMon Jun 26 11:35:25 2000 +++ Rack.py Wed Jul 5 11:13:04 2000 @@ -125,7 +125,8 @@ # Create a new object, identified by key -item = self.getItem(key) +a = self.loadAttrib +item = not a and self.getItem(key) or None # XXX What if all items potentially exist? @@ -134,7 +135,6 @@ item = self._RawItem(key) -a = self.loadAttrib if not a: slot = self._writeableSlot(key) slot[SelfKey] = item.aq_base# strip acquisition wrapping comments? regards, [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] bug in zpatterns-0.4 ?
"Phillip J. Eby" wrote: Nope. The two levels of methods (get/retrieve and new/create) are there to seperate Rack-level concerns from implementation concerns. getItem() and newItem() handle maintenance of Rack-level invariants such as the retrieval cache, while retrieveItem() and createItem() deal with object-level invariants. If you called retrieveItem() instead of getItem(), the code would bypass the rack-level invariants managed by getItem(), which would mean in this case that the per-transaction cache would be bypassed. yes, this is a bit more clear to me now. Hm. Seems to me that you should just use two GAP's, one for each DB table, each using "self.id[0]" and "self.id[1]" respectively to determine their primary keys. (cough) why didn't I think about it??? Also, my racks are specialized to have a searchResults method, and a editItem method (until I can find the time to write a decent SQL Attribute setter provider) A reasonable approach. Although, in the case of SQL attribute setting, see my other e-mail from this evening about the use of Generic Triggers to do SQL attribute setting. btw, the genericattributeprovider has saved me a great deal of time. thanks very much! No problem. Did you ever try re-casting your CatalogAwareness replacement to use GenericTrigger instead of a specific Agent plug-in? I did not have the time to do so. I still stick to Zope-2.1.6 for now, and I was afraid of the issues with transaction commit order. and the motto is 'if it ain't break, don't fix it'. I have a contract to upgrade the product in august though. I will look at it at that time. regards, [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 )
[Zope-dev] bug in zpatterns-0.4 ?
hello, Rack.createItem (low level method) first calls Rack.getItem (higher level method) to check the existence of the item. This causes infinite loop in certain cases. It should (IMHO) call Rack.retrieveItem instead regards, jephte clain [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] zpatterns-0.4a4
mike wrote: I also think so, Jephte. But I thought 'for rack ...' was just a shorter form of if len( rackList) 0) : return rackList[0].__of__( self).getItem( key) else : return None The intended behavior (at least in zpatterns-0.3) was to get an item from one of the racks. This is why I think this is a bug. It changes the behavior of zpatterns-0.3 because it returns the value from the first rack, and ignore the others. I wonder then of what use is the other racks... (or is this intended? I don't think so) If a rack returns None, then we assume the rack is not responsible for storage of that element, and go on with the next rack in the list Better you, Phillip, replace it with one of more clear forms - Jephte's or mine. By the way, I do not like this Rack list at all. Racks and Specialists are both DataManagers with compatible interfaces (getItem, newItem). IMHO, Specialists should have list of DataManagers. This make much sense in context of combining Specialists - ZSession and ClientManager, for example. It is not sufficient just to tune ZSession using ClientManager's rack and ZClass, because in this case we are losing the ClientManager's aspect in sessions. Of course, one always can create delegating rack (and even rack-to-specialist bridge), but what do this for if simple replacing rackList with dataManagerList will solve all such problems? I believe RackMountable/Racks/Specialist are not the same as DataSkin/DataManagers (in the spirit at least) They are used for different things. Or it is kept for compatibilty with old applications (at least, LoginManager use the Specialist/Rack paradigm) (Oh Gott, help mine improvink mie English :-) itoo :-) regards, jephte clain [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 )
[Zope-dev] DA for postgresql?
Hello, Can anyone tell me about the various Postgresql DA currently available? I don't know which to take between ZPoPyDA and ZPyGreSQLDA. I installed both of them, and I can't tell the difference between the two... This will be for a production server. Is PostgreSQL a good choice? Actually, I don't have the choice -- I have to use PostgreSQL. thanks for any input regards, jephte clain [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 )
[Zope-dev] zpatterns: win32 dll for DynPersist?
Hello, Has someone compiled the DynPersist dll for win32? if someone has done so, it would be glad to send me a copy by tomorrow. it will help me greatly. TIA, jephte clain [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 )
[Zope-dev] zpatterns: rackmountables must be of-wrapped
Hello, I believe items got from a rack have to be wrapped in context of the rack. I've been bitten by this (and it hurts!). When I try to use items from DTML, only the superuser can use it, even managers can't access the objects. When I wrap the items in the context of the rack, everything is fine. So: retrieveItem, createItem use vanilla objects getItem, newItem wrap objects before returning them regards, jephte clain [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 )
[Zope-dev] catlogged specialist and rack
Hello, for those who are in a need for search and enumeration capabilities for specialist and racks in ZPatterns-0.3.0 right now like I am, the following could be interesting. Searchable.py defines: CatalogAwareAttributeProvider, CatalogAwareAcquiredAttributeProvider Attribute providers that recatalog the object when its attributes are changed CatalogAwareRack Rack that has a catalog inside it, and index the object created with newItem, and modified afterward. by default, only the id is catalogged. this can be changed in _setup for derived classes CatalogAwareSpecialist Specialist that has support for CatalogAwareRack. A tab 'Contents' provide support for enumerating the objecs in the racks. www/contents can be customized to allow, editing, adding, and/or deleting objects if you like. This, in fact, is a quick hack. remember that all these will be useless when ZPatterns-0.4.0 is out. But I'm fool enough to use evolving software still in infant stage... hope this is useful like it is for me. regards, jephte clain [EMAIL PROTECTED] Searchable.tgz