Re: [Zope-dev] Future of ZPatterns
Hi Marcello, Wow.. sounds like a neat book. ;-) Seriously, Phil Eby has suggested that there will be some sort of migration helpers to move from ZPatterns to TransWarp (www.eby-sarna.com): http://www.eby-sarna.com/mailman/listinfo/transwarp http://cvs.eby-sarna.com/TransWarp/ Also.. Zope3 will have a some kind of Zope2 compatability layer, so in principal, it should be possible to move ZPatterns apps to Zope2 using the compatability layer. I, for one, have a slew of ZPatterns apps out there, so I will be motivated to do something about migration. -steve On Monday, April 15, 2002, at 02:11 PM, Marcello Parra Martins wrote: Hello, I'm new to Zope. I'm studing 'Zope Web Application Develepment and Content Management' book. Many of the examples of the book uses ZPatterns. I saw in past messages that ZPatterns will not be supported in Zope3. Is this true ?? If I create a product based on it, will it be a lost of time ??? Thanks, Marcello Parra ___ 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] Separate staging and development areas for a product
I think it's worth having a completely separate Zope. Otherwise there's no way to separate development and staging versions of filesystem based products. You might be interested in ZSyncer, or ZCVSFolder for synchronization. -steve On Monday, April 15, 2002, at 12:12 PM, Ted Skolnick wrote: Hi, I have a Zope product in development. I want to setup a staging area for stable releases and I am not sure how to go about it. I could install another Zope in a different directory, but it seems like I should be able to do it with the Zope instance I've got. Any thoughts, or pointers? My project contains ZSQL methods and external methods, if that is significant. It seems like the external methods could be a rub, since they exist as files in the Zope installation directories (specifically in the Extensions directory). I don't know how I could have multiple versions of these files, one for development, one for staging all within one instance of Zope. One lesser question, newbie question... how do I control the URL to reach the methods exposed in my project. For example, I have a product called myproj, with my method. The only URL I can get to work is this http://myserver/Control_Panel/Products/myproj/mymethod I'd like to have a URL that looks like this... http://myserver/myproj/mymethod without the Control_Panel bit. thanks, Ted ___ 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 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] Manual object-to-relational persistency framework
Thanks Dieter, I think ZPatterns is certainly worth a look. It allows you to slice-and-dice what you want to store in ZODB or RDBMS. The best part is you can develop totally in ZODB, then migrate to RDB a bit at a time (if you like) without changing your app, or your data classes. We have multiple instance of the same app mixing up ZODB, RDB, LDAP etc.. since all the wiring of data-objects is done in configurable data managers on an instance by instance basis. http://www.zope.org/Members/pje/ZPatterns for Zope-2.[45].x see also: http://www.cat-box.net/steve/TransactionAgents Three chapters of our book (www.zopeonarope.com) are devoted to implementing ZPatterns based apps. good luck! -steve On Friday, March 8, 2002, at 02:56 PM, Dieter Maurer wrote: Bjorn Stabell writes: I'm trying to use Zope without storing everything in ZODB while still having the perception of an object-oriented database. I want to control the object-to-relational mapping layer, but would like the loading and saving of objects to be automatic. Is there some way to do that using Zope? Maybe ZPattern? Dieter ___ 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 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] Dataskin Zclass + Folder subclassing problem
Hi Jean, You might get more feedback from the ZPatterns list on something like this. My gut reaction is that subclassing in python 2.1/1.5 traverses the classes to find methods in a way that makes the *order* of classes very important. IIUC Python 2.2 has a much more sophisticated attribute searching scheme, so that this will be easier to get right.. but so far Zope and 2.2 don't mix so well. You are no doubt getting the wrong class/attributes when you call objectIds etc. Can you try making ZClass1 a simple class and ZClass2 subclassing from DataSkin, Folder and *then* ZClass1? good luck! -steve On Tuesday, November 27, 2001, at 12:36 PM, Jean Lagarde wrote: Hi all, A ZClass inheriting from both DataSkin and Folder seems to work as expected (so much has been discussed in other messages, at least with ObjectManager). However, instead of inheriting directly from DataSkin, I want to inherit from another Zclass which is itself based on DataSkin, i.e. (not showing Zobjects): DataSkin ZClass1Folder | \ / | \ / v v v ZClass1ZClass2 After its creation, the new Zclass ZClass2 seems to have some management issues: - The views are initialized to those of ZClass1; no big deal, for now, I just added a new view tab named Contents for manage_main - When I create an instance of ZClass2 (in a Folder w/Customizer Support), the instance does show its Contents tab, but it does not quite know it's folderish: - It does not show in the left pane of the ZMI - If I add an object from the contents tab interface of the instance, say a dtml method, it adds OK, but does not show in the contents tab (the contents view is always empty no matter what I add) - The objects I added are there; I can traverse to them and their management interfaces, and I have also checked the ZODB directly using the wonderful pyTree.py. I'm afraid that I know just enough about Zope to be dangerous ;-) I basically just have the time to learn about the stuff that I need to get the job done, and I'm sure that the current version of what I'm working on will need some refactoring later on. So I have two questions: 1) Anybody can think of a quick fix to get the folderish behavior working as it should? 2) In its current state (if there is no quick fix), ZClass2 seems usable enough for my needs; I just need to add a couple of objects for each instance, and I can reach their management screens through explicit traversal. So I'm tempted to plug along and keep on experimenting with that setup for now. Any other more important consequences that I'm missing that should have me fix this more adequately before I proceed? Cheers, Jean ___ 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 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] validate() trouble in Zope-2.5.0a1
I don't know if I'm doing something wrong, but when I try to unpack and run Zope-2.5.0a1 I can't seem to authenticate manage_workspace. I haven't snooped much, but it seems that options in Management.py comes back empty: /usr/local/etc/Zope2d/lib/python/App/Management.py(147)manage_workspace() - try: (Pdb) print options [] (Pdb) l 142 143 import pdb 144 pdb.set_trace() 145 146 options=self.filtered_manage_options(REQUEST) 147 - try: 148 m=options[0]['action'] 149 if m=='manage_workspace': raise TypeError 150 except: 151 raise Unauthorized, ( 152 'You are not authorized to view this object.') When I look into self.filtered_manage_options(REQUEST) it seems that getSecurityManager.validate always throws an exception this function takes no keyword arguments /usr/local/etc/Zope2d/lib/python/App/Management.py(130)filtered_manage_options( ) - if validate(container=self, value=o): (Pdb) n TypeError: 'this functio...ord arguments' /usr/local/etc/Zope2d/lib/python/App/Management.py(130)filtered_manage_options( ) - if validate(container=self, value=o): (Pdb) n /usr/local/etc/Zope2d/lib/python/App/Management.py(132)filtered_manage_options( ) - except: (Pdb) l 127 if o is None: continue 128 129 try: 130 if validate(container=self, value=o): 131 result.append(d) 132 - except: 133 if not hasattr(o, '__roles__'): 134 result.append(d) 135 136 return result (Pdb) print __exception__ (class exceptions.TypeError at 0x80ec60c, 'this function takes no keyword arguments') (Pdb) Anyway.. no more time to play now.. any idea what's up? thanks, -steve ___ 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] zope redistibution
Hi Lukas, Have you tried a simple export/import? -steve On Thursday, October 18, 2001, at 07:44 PM, Lukas Maag wrote: hi, i use zope 2.4.1 and the redistribution fuction works not. i can not distribute a product under allowance of redistribution. if i want to distrbute on another zope installation it says, that this is not redistributable, although i marked explicitely 'allow redistribution' on the other distribution! it's now a problem for me, because i relied on this. i can not reuse my improved product! can anyone help me, please. thanx lukas ___ 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 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] Curiously Zope Hanging
Hi Andre, What OS? I've had lots of trouble with Postgres and threads on FreeBSD. Have you tried starting Zope with '-D' to see if threads are an issue? -steve Andre Schubert wrote: Hi all, I have a problem with my Zope, he hangs unexpectly if i view a special Method which generates Diagrams with data from a PostgresDB. The data are selected by a timespan( default is 24 Hours ). The Method works as descripted bellow: First when i call foo, then the HTML-Code is rendered with some images-tags, which are generated by selects. The image tags are calling the method foo which returns image data. If i want my diagrams from 2001-06-01 5:00 to 2001-06-01 12:05 everything works fine. If i want my diagrams from 2001-06-01 5:00 to 2001-06-01 12:10 Zope hangs, no exception no log entry, Zope only hangs. If i want my diagrams from 2001-06-01 5:05 to 2001-06-01 12:10 which is the same timespan as example 1 Zope hangs too, no exception no log entry, Zope only hangs. If i view the postgres logs the nothing happens. Could anyone help me to find the problem or the place Zope is hanging thanks as P.S.: Exact the same problem occurs when i you another PostgresDA ___ 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 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] Curiously Zope Hanging
Well, the good news is you have a reproducable symptom! Some suggestions: 1) Try the quer(y/ies) that cause the hang separately to make sure they return OK. 2) Create a Python script/Tiny table/Gadfly query that returns data that looks just like the result of your postgresql query to test the rest of your system. (these two just isolate the problem to postgres or Zope) 3) Get out the debugger and step through the publisher to see where it's hanging.. (in -D mode you can also 'print' in python and the results will appear on stdout of the 'start -D' process. 4) Post some real code so we can see what you're really up to (!?) -steve Andre Schubert wrote: Hi Steve, Immunix Redhat 6.2 Zope 2.3.3 Postgres 7.1.2 I'am running Zope with -M -D and with Stupid_log_file. But i don't find a problem. When Zope hangs, then there is one Thread Running and if i trace this Thread nothing happens. as Steve Spicklemire schrieb: Hi Andre, What OS? I've had lots of trouble with Postgres and threads on FreeBSD. Have you tried starting Zope with '-D' to see if threads are an issue? -steve Andre Schubert wrote: Hi all, I have a problem with my Zope, he hangs unexpectly if i view a special Method which generates Diagrams with data from a PostgresDB. The data are selected by a timespan( default is 24 Hours ). The Method works as descripted bellow: First when i call foo, then the HTML-Code is rendered with some images-tags, which are generated by selects. The image tags are calling the method foo which returns image data. If i want my diagrams from 2001-06-01 5:00 to 2001-06-01 12:05 everything works fine. If i want my diagrams from 2001-06-01 5:00 to 2001-06-01 12:10 Zope hangs, no exception no log entry, Zope only hangs. If i want my diagrams from 2001-06-01 5:05 to 2001-06-01 12:10 which is the same timespan as example 1 Zope hangs too, no exception no log entry, Zope only hangs. If i view the postgres logs the nothing happens. Could anyone help me to find the problem or the place Zope is hanging thanks as P.S.: Exact the same problem occurs when i you another PostgresDA ___ 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 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 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] Curiously Zope Hanging
Hi Andre, Andre Schubert wrote: No, the problem is not reproduceable, because if move the timespan 5 minutes earlier then Zope crashes. And thats the problem. Hmm.. my point was only that if you can *predict* correctly when Zope will hang.. then it is at least 'reproducable'. If i call my diagrams in the order that a is the same and b is changing everything works well and there are absolutely no hangs, but if i call my diagrams the other way that a is changing and b is the same then Zope works if i select data from 2001-06-01 5:00 to 2001-06-20 12:05 and Zope hangs if i select data from 2001-06-01 5:00 to 2001-06-20 12:10 or from 2001-06-01 5:05 to 2001-06-20 12:10 I hope you understand my explanations in my bad german-english. I think I get the basic picture... but as Steve Spicklemire schrieb: Well, the good news is you have a reproducable symptom! ___ 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] Curiously Zope Hanging
Sorry.. got distracted and forgot where I was! I think I get the basic picture... but I think maybe we need more details of your system to be of any more help.. -steve as Steve Spicklemire schrieb: Well, the good news is you have a reproducable symptom! ___ 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 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] SQL/ZPatterns examples posted to Zope.org
I've had several folks ask for some ZPatterns examples with SQL. I've *finally* gotten around to providing them. They're at: http://www.zope.org/Members/sspickle The first is a school attendance application 'skeleton' with the following description: An example of ZPatterns using SQL. Gadfly is the database so everyone can use it. There are a couple of novel aspects 1) a 'generic' object management UI that is acquired by all the Specialists and 2) levers to manage all the SQL and SkinScript. After you have the products and folder installed, you'll need to create the database tables (run createAllTables_html) and then add some data. There is a very crude admin UI for each Specialist that you can get to from the main 'view' page by clicking on the link for that Specialist. Follow the object model:attendanceModel.gif to see how to hook things up. If you change any of the ZClass propertysheets you'll need to rerun the levers to create all the SQL queries and SkinScript. (You'll probably also need to drop/re-create the relevant database tables) The second is a school lunch application 'skeleton' which is 99% similar, except that it uses a filesystem base class for the 'Lunch' object, just to show how it can be done. Feedback most welcome! thanks, -steve ___ 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] HowTo: Make an Image/File a DataSkin ???
Hi Ulrich, Hmm.. can you just call DataSkin.__init__(self, id) in the File's constructor? -steve Ulrich Eck wrote: Hello .. sorry I bother you again with my ZPatterns related Questions .. I just try it once again ;-) I have a Folder w/Customizer in that I want to store Objects of type Image or File (CMFDefault.Image to be correct) in it. The inline doku of CMFDefault.File/Image says the following: -- class File(OFS.Image.File , PortalContent , DefaultDublinCoreImpl ): A Portal-managed File # The order of base classes is very significant in this case. # Image.File does not store it's id in it's 'id' attribute. # Rather, it has an 'id' method which returns the contents of the # instnace's __name__ attribute. Inheriting in the other order # obscures this method, resulting in much pulling of hair and # gnashing of teeth and fraying of nerves. Don't do it. # # Really. # # Note that if you use getId() to retrieve an object's ID, you will avoid # this problem altogether. getId is the new way, accessing .id is # deprecated. -- this is fairly true. I needed to make the DataSkin the first subclass of File to ensure the datamanager-machinery will work (not_found v_dm) for example: class File(DataSkin , OFS.Image.File , PortalContent , DefaultDublinCoreImpl ): this basically works fine except when I rename this object the different behaviour of Dataskin (stores its id in self.id) and Image/File (stores its id in self.__name__ and recommends the use of ob.getId() to get the id). Has anyone used a Image/File/ExtFile class for combining it with ZPatterns.DataSkin and perhaps give me a hint ?? thanks Ulrich Eck net-labs ___ ZPatterns mailing list [EMAIL PROTECTED] http://www.eby-sarna.com/mailman/listinfo/zpatterns ___ 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] DateTime class not recognizing timezone correctly...
Hi -dev folk.. I ha(d) a problem where DateTime was basing the local timezone on time.tzname, and getting it wrong. (tzname comes from the abbreviation, which in Indiana is 'EST', but DateTime really wants 'US/East-Indiana'. So.. I patched DateTime as follows.. I saw a proposal in the archives about this kind of solution. Any other ideas? How are other folks handling this? thanks, -steve diff DateTime.py myDateTime.py 96,97c96,107 try: from time import tzname except: tzname=('UNKNOWN','UNKNOWN') --- tzname = None try: from localzoneinfo import tzname except: pass try: if tzname is None: from time import tzname except: tzname=('UNKNOWN','UNKNOWN') ___ 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] ZCVSFolder not running on windows
Hi Robert, Sorry.. ZCVSFolder is not supported for Windows. Patches accepted! -steve Robert Rottermann wrote: Hi there, I installed the newest version of ZCVSMFolder on my windowsbox. As it uses fork it can not work. However I used a former version under windows. Is this not possible anymore? thanks for any insigth Robert ___ 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 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] getPersistentItemIDs not cooperating?
Has anyone seen anything like this? I have the following script in a Specialist: ## Script (Python) deleteAllTracks ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## trackMaster=context.Tracks import string iList=[] for id in trackMaster.defaultRack.getPersistentItemIDs(): iList.append(id) theItem=trackMaster.getItem(id) iList.append(theItem.manage_delete()) return OK! deleted: + string.join(iList,',') It works.. partially. For some reason it looks like getPersistentItemIDs does not always return a *complete* list. I need to run this method several times to completely exhaust the Rack's storage. Thoughts? The only way I ever create Track objects is via a different method that is only accessed once (a long time ago!) thanks, -steve ___ 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] getPersistentItemIDs not cooperating?
Well.. it turned out to be more subtle. It goes back to the old problem that getPersistentItemIDs doesn't return a real list, but rather a BTreeItems object. When you call manage_delete on *one* item, it affects the BTreesItems object you are iterating over! This works: ## Script (Python) deleteAllTracks ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters= ##title= ## trackMaster=context.Tracks import string iList=[] for id in trackMaster.defaultRack.getPersistentItemIDs(): iList.append(id) dList=[] for id in iList: theItem=trackMaster.getItem(id) theItem.manage_delete() dList.append(id) return (OK! deleted %i elements % len(iList)) + string.join(iList,',') On Wednesday, May 23, 2001, at 10:59 AM, Steve Alexander wrote: Steve Spicklemire wrote: Has anyone seen anything like this? snip It works.. partially. For some reason it looks like getPersistentItemIDs does not always return a *complete* list. I need to run this method several times to completely exhaust the Rack's storage. Yes, I've seen this. It's on my list of things to look into when I've got a certain large project out of the way :-/ Thoughts? Well, getPersistentItemIDs() just returns the result of calling keys() on the Rack's BTree. I guess it is a problem with the BTree code. I doubt it'll be fixed though. Instead, we should update Rack to use the new BTrees module. -- Steve Alexander Software Engineer Cat-Box limited ___ 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 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] getPersistentItemIDs not cooperating?
Hi Phil, Yup.. I realized it when I could *list* all the ids, but not delete them. ;-) I'm wondering if it might be better to change the implementation of getPersistentItemIDs to return a plain list? This would also help avoid permission errors that folks run in to when trying to use it in dtml. I realize that listifying takes time, but you probably wouldn't call it if you had a very large number of items in the rack (you'd maybe query a catalog or something else.. ) -steve On Wednesday, May 23, 2001, at 11:22 AM, Phillip J. Eby wrote: At 05:48 PM 5/23/01 +0200, Christian Scholz wrote: Hi! It works.. partially. For some reason it looks like getPersistentItemIDs does not always return a *complete* list. I need to run this method several times to completely exhaust the Rack's storage. Thoughts? The only way I ever create Track objects is via a different method that is only accessed once (a long time ago!) Well, I experiences something similar when changing a Racks storage from persistent to non-persistent. The included objects are marked as orphaned then and should be deleted with the Clear-Button. This also works, but only the half of them gets deleted every time I click on that button.. So I also have to press it several times.. Sounds like the same problem.. I just thought of how this happens... if you delete an object from the Rack, it's being removed from the virtual list of keys your loop is traversing. So as you iterate from 0..n, and you delete items from the rack, they are removed from the keys list too, the list shortens, and every other item in the list is skipped! This is why you get half the list every time. The fix would probably be: foo = getPersisentItemIDs() while foo: foo[0].manage_delete() I should probably do this in ZPatterns too. I'm working on upgrading it for 2.3.2 right now anyway. ___ 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) Speeding up Skinscripts
Hi John, Makes sense to me! I'm guessing eval was used since it's a little simpler not to have to keep track of both the string expression and the compiled expression.. but that's just a guess. However it does bring up a point I've been wondering about anyway. Now that Ty and Phillip have moved on to TransWarp, who will be maintaining all the changes to ZPatterns? SteveA has done a great job of keeping a modified version available for folks running 2.3.X, but I've seen no motion to move those changes into the "real" ZPatterns. Now if you find a great optimization, will it get movedinto ZPatterns too? There are a number of folks now whove contributed to the 'ZPatterns' project and have invested significant effort in projects that are based on ZPatterns, and would like to see it maintained. (me!) I wonder if there is some way that stewardship for ZPatterns could be either 'handed off' or 'shared' so that these kinds of things can be kept up-to-date without delaying the promised TransWarp goodies. What do you think? take care, -steve "JAE" == John Eikenberry [EMAIL PROTECTED] writes: JAE We have a fairly large and complex app framework built on JAE ZPatterns. It uses MySQL for storage and the standard JAE Specialist/Rack/DataSkin setup with skinscripts for JAE attributes and triggers. JAE We've found that the speed of getItem is a bit slower than we JAE need. For instance retrieving 200 dataskins takes about 8 JAE seconds on a P2-300. After profiling and digging around I JAE think I've found the primary bottleneck. Its the running of JAE eval() on the skinscript's python expression (stored in the JAE Compute class as _fromex and Triggers as callexpr). JAE Note that this becomes the bottleneck after the SQL Method JAE gets cached. The query to the DB takes the most time on the JAE first hit, but after its been cached it takes very little JAE time. JAE The optimization I've been looking at is changing the code JAE from storing a string and eval()ing the string to using JAE compile() at save time and exec() when evaluated. JAE Profiling these 2 ways in little test programs seems to JAE indicate about a 2.5x speedup. Not huge, but combined with JAE better hardware should be enough. JAE But I'm curious why this avenue wasn't taken to begin JAE with. Seems like the way to do it to me. Am I missing JAE something? JAE -- JAE John Eikenberry [[EMAIL PROTECTED]] JAE __ JAE "A society that will trade a little liberty for a little JAE order will deserve neither and lose both." --B. Franklin JAE ___ Zope-Dev JAE maillist - [EMAIL PROTECTED] JAE http://lists.zope.org/mailman/listinfo/zope-dev ** No cross JAE posts or HTML encoding! ** (Related lists - JAE http://lists.zope.org/mailman/listinfo/zope-announce JAE http://lists.zope.org/mailman/listinfo/zope ) ___ 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] Btree problems on recent CVS update..
Hmm.. anybody seen this? -steve cc -fpic -I../Components/ExtensionClass/src -I../Components/BTree -I./ZODB -O -pipe -D_THREAD_SAFE -I/usr/local/include/python1.5 -I/usr/local/include/python1.5 -DHAVE_CONFIG_H -c ./../Components/BTree/BTree.c ./../Components/BTree/BTree.c: In function `BTreeItems_item_BTree': ./../Components/BTree/BTree.c:249: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c:249: (Each undeclared identifier is reported only once ./../Components/BTree/BTree.c:249: for each function it appears in.) ./../Components/BTree/BTree.c: In function `BTreeItems_item': ./../Components/BTree/BTree.c:299: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `bucket_index': ./../Components/BTree/BTree.c:471: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `_bucket_get': ./../Components/BTree/BTree.c:509: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `BTree_index': ./../Components/BTree/BTree.c:596: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `_BTree_get': ./../Components/BTree/BTree.c:647: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `_bucket_set': ./../Components/BTree/BTree.c:749: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `BTree_grow': ./../Components/BTree/BTree.c:961: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `_BTree_set': ./../Components/BTree/BTree.c:1028: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `bucket_keys': ./../Components/BTree/BTree.c:1099: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `bucket_values': ./../Components/BTree/BTree.c:1129: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `bucket_items': ./../Components/BTree/BTree.c:1159: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `bucket_clear': ./../Components/BTree/BTree.c:1209: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `BTree_clear': ./../Components/BTree/BTree.c:1265: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `bucket_getstate': ./../Components/BTree/BTree.c:1294: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `BTree_getstate': ./../Components/BTree/BTree.c:1759: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `BTree_elements': ./../Components/BTree/BTree.c:1851: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `Bucket_length': ./../Components/BTree/BTree.c:1986: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `BTree_length': ./../Components/BTree/BTree.c:2002: `cPersistenceCAPI' undeclared (first use in this function) ./../Components/BTree/BTree.c: In function `initBTree': ./../Components/BTree/BTree.c:2122: `cPersistenceCAPI' undeclared (first use in this function) ___ 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] FTP interface being worked on?
Hi Fred, "Fred" == Fred Wilson Horch [EMAIL PROTECTED] writes: Fred Wanted to follow up on Steve's points. Fred I don't know if we need just one serialization interface Fred that tries to solve all five issues. Ok.. Fred We currently have two serialization interfaces in Zope: Fred 1) the FTP interface, and 2) the XML export interface. Fred Seems to me that the FTP interface could be generalized as Fred the "lossy" serialization interface that is "morally human Fred readable" and the XML export interface could be tweaked a Fred bit as "lossless" but "morally binary". Fred The FTP interface would be used when you want a Fred representation that can be edited by hand. It solves C, D Fred and E, but not A and B. Fred The XML interface would be used when you want a Fred representation that can be manipulated programmatically. It Fred solves A and B, but not C, D and E. Hmm.. maybe I'm misuderstanding... which would/could you use for version control? It still seems to me that a blend of these could be developed that would work in all cases. An object could have a human readable part/aspect and 'the rest' could be captured as an xml bloblet. The 'human editable' part could just be what you get on the FTP interface (as you say), and the rest could be saved/restored to a 'auxiliary' file that would track other aspects of the object. Since objects could implement their own serialization, they could decide what aspects belonged in which part. Otherwise I can't help feeling that we'd have problems with duplicated versions, some xml/zexp, some human-readable that would inevitably stomp on eachother in any version control scenario. If all this could be worked in to the existing FTP/export/import system... there would be a minimum impact on existing interfaces. Fred FWIW, I'm working on tweaking the XML export/import code to Fred serialize object hierarchies as directories and files, Fred rather than exporting a single file. Cool.. this sounds like a promising approach. I'd be interested in testing this.. thanks! -steve Fred Fred Fred P.S. The link Karl sent Fred (http://www.thetwowayweb.com/theXmlFiles) is interesting. Fred -- Fred Wilson Horch mailto:[EMAIL PROTECTED] Executive Fred Director, EcoAccess http://ecoaccess.org/ P.O. Box 2823, Fred Durham, NC 27715-2823 phone: 919.419-8354 ___ 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] FTP interface being worked on?
Hi Fred, "Fred" == Fred Wilson Horch [EMAIL PROTECTED] writes: Fred Steve Spicklemire wrote: I'm looking at all this from the perspective of someone who is using the current xml/zexp code to manage objects in CVS today Fred Can you tell me how you do that? Our big problem is that we Fred can't import over existing objects. Are we doing something Fred wrong? I use ZCVSMixin (http://www.zope.org/Members/sspickle/ZCVSMixin). Fred Here's our set up: Fred We have developers all over the world that can check code in Fred and out of SourceForge. We'd like our developers to be able Fred to work on our site using their own local instances of Zope, Fred export everything from their Zope ODB to their local Fred filesystem, then use CVS to check in all the changes they've Fred made to SourceForge. Then to keep in synch, everyone else Fred can update their local copies of the source tree, and import Fred the updates into their local instances of Zope. Fred The problem: imports raise all sorts of conflict errors -- Fred we basically have to delete everything before importing it. ZCVSMixin does the loading of objects into folderish containers so conflict errors are not a problem. This naturally means that you can destroy things if you're not careful. (Motto: a tool that doesn't let you destroy things now then.. is a weak tool.) -steve ___ 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] FTP interface being worked on?
Hi Folks, I posted this to the Wiki... but it's not "in-your-face" like email, so I never know if anyone reads it. Here are a few, possibly random, but nonetheless concrete, thoughts of mine on the matter. I'm looking at all this from the perspective of someone who is using the current xml/zexp code to manage objects in CVS today, and hoping that whatever evolutionary/revolutionary process that occurs here not completely break all my existing stuff. It seems to me that the current import/export mechanism is actually pretty close to what we need for serialization. It has some nice properties: A) All objects are faithfully encoded and saved on the filesystem in a text format that any configuration management system can use and track. It seems to me that this property is critical to maintain. B) Whole object hierarchies can be saved in a simple file, moved to any other zope instance (via checkin/checkout) and instantiated. (This is needed for import/export to be useful) C) It's possible (through a hack[1]) to make simple objects 'diff'able so that all the metadata that's in the current xml export rep doesn't get in the way too much. (this is almost irrelavent, but may be useful as an interem step to make this part of the native import/export code... ) There are also a few not-so-nice properties: D) The current xml representation use by xml import/export is morally binary, in the sense that you can't easily edit/manage it with ordinary editors etc. E) There is no simple way to separate the contents of a containerish object from the container. I think that both of these shortcomings could be addresses using Chris M's idea of letting objects handle their own serialization. (e.g., Folders could save their meta-data in a 'special' file, or directory and then proceed to call the serialization methods of their contents). However I think there would be benefits to working this into the current import/export scheme. Imagine the following: A 'serialization' interface is invented that objects could implement that preserve A-C, and, optionally, fix D-E. If no such interface is found, the current export method is invoked. (I suppose this could also be done by adding a default implementation of the interface that simply does what the current import/export code does.) Something like this maybe? class FSObject: """ Abstract filesystem Object that 'does the right thing'. Might be implemented as StringIO, or impose special security restrictions, or whatever. """ def chdir(.. ) def mkdir(.. ) def open(.. ) class Serializable: Serialize(self, serialize_contents_separately=None, use_fs_object=None): """ Serialize this object. If serialize_contents_separately is not None then create a 'special' file for meta_data, and create a new directory for self and subobjects. After saving meta_data, call Serialize on each content object in turn, passing appropriate arguments through.. """ Anyway.. it seems to me that this sort of approach would have the benefit of using what's available today to the best advantage while permitting tools to be developed that would work well with whavever serialization process that evolves for all the Zope objects that are out there.. take care, -steve [1] See the ZCVMixin product: ZCVSExIm.py "CM" == Chris McDonough [EMAIL PROTECTED] writes: CM I think the only good reasons we have right now for having CM filesystem-compatible serialization are to make Zope content CM editable via common tools in a way that makes sense to people CM not used to (or comfortable with) the object database, and to CM give people a plausible way to put a Zope site under source CM control. CM Are you thinking that we would build client-side tools to CM recognize an XML representation of a subpart of a site? CM - Original Message - From: "Karl Anderson" CM [EMAIL PROTECTED] To: "Chris McDonough" CM [EMAIL PROTECTED] Cc: "John D. Heintz" CM [EMAIL PROTECTED]; "Fred Wilson Horch" CM [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, CM March 22, 2001 8:17 PM Subject: Re: [Zope-dev] FTP interface CM being worked on? "Chris McDonough" [EMAIL PROTECTED] writes: I don't think it's reasonable or wise to impose any "master structure" for filesystem serialization of bodies of objects. Each instance (or perhaps each class) should define how best to serialize itself to disk. Representations between classes are likely to be radically different. A place for standardization is in the "properties" file(s) which accompany each object rep... this is likely to be XML or another structured variant. Is there a motivation for using serialization to provide an editable "god's eye view" of all or part of a Zope site? That is, provide a
Re: [Zope-dev] ZPatterns style question
Hi Lex, This is a little bit of a tricky question. Here is what I think is the *intent* of ZPatterns. The details of storage are to be left up to the implementor/integrator. Given that they are the only ones who really know where all the goodies are hidden (sql? zodb? etc.. ) your app shouldn't assume any particulars here. What your app *can* do is demand that the objects that are used satisfy a particular interface (e.g., have certain methods or attributes that behave in particular ways.). With ZPatterns, what look like attributes can really be methods, due to the flexible nature of SkinScript. I see in your tutorial that you're trying to help the integrator by putting SkinScript in for them... but I think that in ZPatterns, it's probably better to leave that up to them... or at least to assume ZODB ( something everyone has) rather than SQL. Does any of that make sense? take care, -steve "Lex" == Lex Berezhny [EMAIL PROTECTED] writes: Lex Hello, Lex I dont know if i'm missing something, or if this is just a Lex style question. But where do the implimentation specific Lex get/set methods go (the functions called within a SkinScript Lex for example)? Do i just stick them anywhere in the aquistion Lex path, or is there some logical place I should place them? How Lex can I write my application so that the user can switch data Lex sources with a click of a button (ie, without having to Lex delete one implimentations' methods, and paste the new ones)? Lex I hope my question makes sense. Lex BTW once i figure this out, i'll be able to finish my Lex tutorial on ZPatterns: Lex http://www.zope.org/Members/eukreign/ZPatternsTutorial Lex - lex Lex __ Do You Lex Yahoo!? Get email at your own domain with Yahoo! Mail. Lex http://personal.mail.yahoo.com/ Lex ___ Zope-Dev Lex maillist - [EMAIL PROTECTED] Lex http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Lex posts or HTML encoding! ** (Related lists - Lex http://lists.zope.org/mailman/listinfo/zope-announce Lex http://lists.zope.org/mailman/listinfo/zope ) ___ 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] Implementing ZPattern: Containment
Hi Johan, I wrote: The best way I've found is to provide a method (or methods) in the Specialist of the contained item to get ids of those instances satisfying certain criteria... e.g., getToDoIdsForDoer( aDoer ) (the contained item keeps a reference to the id of its container.) then you replied: How well does this apply to the WhoIKnow pattern? Could you say that the Specialist is the association? In that case how do I create a n-n relation, or maybe I never do that? I can't really find any Patterns that matches n-n situation, so I assume it my modell probally would wrong if I end up with that, right? then I went on vacation. ;-) I think that in most of these situations you can have a 'catalogish' method in the Specialist that manages the 'n' things that finds those related to the '1'. (e.g., getToDoIdsForDoer( aDoer )). This can then be mapped to an attribute of the '1' specailist (myToDos), so that it does 'know' about all it's todos, its just that under the covers (in it's rack) the myToDos attribute is really fulfilled by calling the todos specialist and asking for all the todos assocaited with a particular doer. In the n-n case it's really no different, except that each 'n' thing needs to know which of the other 'n' thing(s) it's associated with so the catalogish method can pull out the ids. fun eh? take care, -steve ___ 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: getItem returns None
Hi Roche, In all simplicity I still can't get it to work but here's some more info from the console: Traceback (innermost last): File C:\PROGRA~1\ZOPE230\lib\python\Products\ZPatterns\AttributeProviders.py, line 335, in _AttributeFor (Object: GAPMixin) File C:\PROGRA~1\ZOPE230\lib\python\Products\ZPatterns\Expressions.py, line 13 6, in eval KeyError: AllotmentArea_ID Seems like the first element of the list of result objects returned by sqlGetAllotmentArea doesn't define anything called 'AllotmentArea_ID'. Could it be a case problem? What datbase/db_adaptor are you using? You might try changing the skin-script to something like: WITH (myDebuggingMethod(test_id = self.id) or [NOT_FOUND])[0] COMPUTE AllotmentArea_ID, AreaName, AreaCode then have myDebuggingMethod call an external method to 'print' out things like the id being used, and the contents of the results being passed back to the attribute provider. This same method could also return a 'static' dictionary in a list that has AllotmentArea_ID, AreaName, AreaCode defined as keys, so that you know they are there. There was also an exchange on the list between Joachim Schmitz and me back in October about some debugging strageties. You might try to dig those up... -steve ___ 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 feature patch: kickTriggers
Hmmm... tripTriggers(...) pullTriggers(...) fireTriggers(...) ;-) dunno... kickTriggers works for me... -steve "SA" == Steve Alexander [EMAIL PROTECTED] writes: SA I've patched DataSkins.py to add this method: ... SA I'd welcome suggestions on a better name for the method than SA "kickTriggers". :-) SA -- Steve Alexander Software Engineer Cat-Box limited SA http://www.cat-box.net SA ___ Zope-Dev SA maillist - [EMAIL PROTECTED] SA http://lists.zope.org/mailman/listinfo/zope-dev ** No cross SA posts or HTML encoding! ** (Related lists - SA http://lists.zope.org/mailman/listinfo/zope-announce SA http://lists.zope.org/mailman/listinfo/zope ) ___ 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] freebsd file: table is full when starting zope2
If you bump maxusers up to 64 (from the default 32) and rebuild the kernel the messages should go away... it's worked for me. -steve "RDM" == Zope mailing lists [EMAIL PROTECTED] writes: RDM On Wed, 14 Feb 2001, Sin Hang Kin wrote: When starting Zope2.3 from the freebsd box, the kernel says : file: table is full. The kern.maxfiles is set to 1064, does zope really need that many? what number should I need to make zope happy? RDM I noticed this problem with Zope and FreeBSD a long time ago, RDM and managed to track it down to zserver or python or a python RDM module opening every possible socket number separately on RDM startup (this is from an lsof dump as zserver is starting). RDM The ones it doesn't use get closed somehow, but it sure was a RDM weird thing to see. I've no idea if this is a bug in RDM zserver/python or a bug in FreeBSD, and since it hasn't been RDM causing me any real problems (just the message in the log), I RDM haven't bothered to track it further. I still see the RDM messages though, and I'm now running FreeBSD 4.2S and Zope RDM 2.3.0. RDM --RDM RDM ___ Zope-Dev RDM maillist - [EMAIL PROTECTED] RDM http://lists.zope.org/mailman/listinfo/zope-dev ** No cross RDM posts or HTML encoding! ** (Related lists - RDM http://lists.zope.org/mailman/listinfo/zope-announce RDM http://lists.zope.org/mailman/listinfo/zope ) ___ 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] http headers
Another you might consider (though Shane's is great, but required Tkinter, which not everybody (me!) has really easy accesss to... ) is the more browser based, but less flexible: http://www.cyberclip.com/webdebug/ -steve "SA" == Steve Alexander [EMAIL PROTECTED] writes: SA Tim McLaughlin wrote: Anyone know how I can log or view the http headers that Zope sends when it responds to a http request? SA Take a look at tcpwatch: SA http://www.zope.org/Members/hathawsh/tcpwatch SA -- Steve Alexander Software Engineer Cat-Box limited SA http://www.cat-box.net SA ___ Zope-Dev SA maillist - [EMAIL PROTECTED] SA http://lists.zope.org/mailman/listinfo/zope-dev ** No cross SA posts or HTML encoding! ** (Related lists - SA http://lists.zope.org/mailman/listinfo/zope-announce SA http://lists.zope.org/mailman/listinfo/zope ) ___ 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] Local roles and security of ZClass instances in Specialists
Hi Itai, I'm sure there's something clever you could do here with an attribute provider for you user object that supplied __roles__ dynamically somehow, but I'd need to think about that more... one easy way to limit who can see different stuff is to use a wrapper around your access methods (e.g., SQL queries) that checks for security: e.g., WITH [ QUERY ] LookupAttributesAndCheckForPermission(REQUEST) COMPUTE foo, bar, baz where LookupAttributesAndCheckForPermission get's everything it needs out of the REQUEST. It's a crude tool.. but it's simple. When I get some time to think clearly.. I'll try to come up with something more general. Hopefully you'll also get some other suggestions... -steve "Itai" == Itai Tavor [EMAIL PROTECTED] writes: Itai Hi, Itai I'm trying to work out a security strategy for data stored Itai in Specialists, where specific users need access to specific Itai data instances. Itai For example: A Customer object is linked to a Person and Itai Address objects. The customer needs permission to edit the Itai her - and only her - Address object. Using the Owner local Itai role won't work, because customers can be registered by site Itai managers and customer support people, in which case Owner Itai won't be the customer. Itai I can solve this by giving the customer a local role when Itai creating her Address object: Itai Customers.addCustomer(REQUEST): ni = Itai container.addItem(some_id) Itai container.Addresses.addAddressFor(ni.id, REQUEST) Itai Addresses.addAddressFor(for_id, REQUEST): ni = Itai container.addItem(some_id) ni.manage_addLocalRole(for_id, Itai 'EditMyDetails') Itai But this can be a lot of work - If an Address object can Itai also be created for a CreditCard object, addCreditCard will Itai have to both set its own local role, and pass the customer Itai id on to Address... Itai But the main problem is that I'm not sure if it will work at Itai all - can local roles be set for DataSkins that aren't Itai stored in the ZODB? From what I can see ZPatterns doesn't Itai support this, so I'll have to do it Itai myself. __ac_local_roles__ can't be accessed in a SkinScript Itai - so will I have to override has_local_roles, Itai get_local_roles and get_local_roles_for_userid and call them Itai from the SkinScript? This is getting hairy... Itai Without local roles, all I can think of is explicitly Itai checking that the logged in user is the right customer in Itai all the methods that display and edit the object, which is Itai very ugly. Plus it would require Address to know a Itai customer_id even when it actually belongs to a CreditCard, Itai not a Customer... there goes Demeter. Or I can add a Itai findUserID to Address, CreditCard and Customer, all of which Itai pass the request upwards until one is reached that actually Itai knows the customer. Still ugly. Itai TIA for Any comments/suggestions. Itai Itai -- Itai Tavor "Je sautille, donc je suis." C3Works Itai [EMAIL PROTECTED] - Kermit the Frog Itai "If you haven't got your health, you haven't got anything" Itai ___ Zope-Dev Itai maillist - [EMAIL PROTECTED] Itai http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Itai posts or HTML encoding! ** (Related lists - Itai http://lists.zope.org/mailman/listinfo/zope-announce Itai http://lists.zope.org/mailman/listinfo/zope ) ___ 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] Massive scalability
Hi Andy, I'm not sure what you mean by 'interface/way', so.. I'm going to guess at two possible interpretations. 1) Basically ZPatterns allows you to define classes (DataSkins) instances of which can optionally be used to view/create/change/delete external data through methods of the class ( + a little SkinScript ). If your store your instance data in SQL you can use SQL queries, masked from the application behind some generic method (e.g., getFooIdsWithText( textToFind )") to find the id(s) of the instance(s) you're after. You can then get the instance from the ZPatterns machinery and, once gotten, display it, change it, call it's methods, and/or delete it. The way these actions on the object interact with the data in the external database is all defined in 'SkinScript' which is hidden away as a PlugIn of a Rack deep inside the ZPatterns guts. At the Zope application level you don't really *know* where/how the data is stored. Best of all you, or your Product's customers can easily customize that part *after* your product is plugged into *their* application, without changing the basic application level logic and design of your product. It's the coolest. ;-) 2) To get folks started with moving objects from ZODB to SQL I've found ZFormulator handy as a tool to get folks quickly up to speed in how SQL 'works'. http://www.zope.org/Members/faassen/ZFormulator If they already have ZClasses, they can use this to 'automatically' generate starting point queries to match their class propertysheets. Of course... it probably won't be normalized/optimized/etc.. but it's better than doing it all for them! ;-) -steve "Andy" == Andy McKay [EMAIL PROTECTED] writes: Andy Does ZPatterns provide a nice interface / way for storing Andy classes in a RDBMS? I have to say using an RDBMS is not as Andy transparent as I would like, this may may improve Andy it. Finally a reason for me to ZPatterns... Andy -- Andy McKay. Andy - Original Message - From: "John Eikenberry" Andy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: "Michael Andy Bernstein" [EMAIL PROTECTED] Sent: Tuesday, January 16, Andy 2001 3:22 PM Subject: Re: [Zope-dev] Massive scalability Michael Bernstein wrote: So, again: Has anyone run up against any performance or other limitations regarding large numbers (hundreds of thousands or more) of objects stored within the ZODB either in a BTree Folder or a Rack? I was looking into the same issues recently, but for a much smaller set of data (5ish). In my tests ZPatterns/binary-trees scaled well for Andy storage and retrieval. But ZCatalog did not. It was basically useless for partial matching searches (taking many minutes for searches that retrieved more than 100 matches). I was also concerned about the indexing overhead. It doesn't scale well when changing/adding many things at a time (we might have bulk adds/changes). I ended up deciding to go with a RDBMS backend for data storage with a ZPatterns interface. SkinScripts work so well for this that I'm actually glad I switched. It simplified my design and implementation immensely. -- John Eikenberry [[EMAIL PROTECTED] - http://zhar.net] __ "A society that will trade a little liberty for a little order will deserve neither and lose both." --B. Franklin ___ 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 ) Andy ___ Zope-Dev Andy maillist - [EMAIL PROTECTED] Andy http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Andy posts or HTML encoding! ** (Related lists - Andy http://lists.zope.org/mailman/listinfo/zope-announce Andy http://lists.zope.org/mailman/listinfo/zope ) ___ 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: SAVING doesn't tolerate missing attributes
Hi Steve, Could you let some other value represent no car? (e.g., _.None?). untested... WITH CompanyCars.getCar(self.car_id) or NOT_FOUND COMPUTE car=RESULT, car_registration=registration OTHERWISE LET car=_.None car_registration="no car" WHEN OBJECT CHANGED CALL HAS_CHANGED('car_id') and (self.car_id and CompanyCars.getItem(self.car_id).decommission(), ORIGINAL['car_id'] and (OLD['car'] and OLD['car'].commission())) SAVING car Would that work? -steve "SA" == Steve Alexander [EMAIL PROTECTED] writes: SA In SkinScript such as SAWHEN eventspec CALL expression SAVING mementolist SA if any of the mementos in mementolist are not found, the SA script raises a KeyError. ___ 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] Re: ZPatterns: __getitem__ on a DataSkin instance
Hi Steve, Hmm.. is the 'id' of your PythonScript also getattr? thanks, -steve "Steve" == Steve Alexander [EMAIL PROTECTED] writes: Steve Steve Alexander wrote: Let's say I have a DataSkin-derived ZClass that has the attribute "forename" (in a dataskin attribute propertysheet). If I get an instance of this ZClass from the ZODB (set up to use a Folder w/ customizer suppport), I can refer to the "forename" attribute using dtml-var "this()['forename']". However, if I get an instance of the same class from a Specialist, dtml-var "this()['forename']" gives me Error Type: AttributeError Error Value: __getitem__ Any idea why there's the difference? Can the latter case be fixed? Steve A workaround, using the ever-flexible skinscript: Steve I've defined __getitem__ through skinscript and a Steve PythonScript. Steve SkinScript: WITH SELF COMPUTE __getitem__=getattr Steve PythonScript: parameter list: index Stevereturn getattr(index) Steve -- Steve Alexander Software Engineer Cat-Box limited Steve http://www.cat-box.net Steve ___ Zope-Dev Steve maillist - [EMAIL PROTECTED] Steve http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Steve posts or HTML encoding! ** (Related lists - Steve http://lists.zope.org/mailman/listinfo/zope-announce Steve http://lists.zope.org/mailman/listinfo/zope ) ___ 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] Objects with multiple parents and storage flexibility, ZPatterns?
Hi Chris, "Chris" == Chris Withers [EMAIL PROTECTED] writes: Chris Steve Spicklemire wrote: I think that if you make your DataSkins folderish it will be hard to make the storage anything other than ZODB. Chris Well, I don't mind the 'skins' being stored in the ZODB, Chris but, as Steve A mentioned, I _would_ like stuff created in Chris the RDBMS to 'magically appear' in the Zope side of Chris things. I guess that means FwCS and folder-subclassing Chris DataSkins are a no-no? No... I don't think so! If you don't mind keeping stuff in ZODB then you *could* have a traversal interface that made stuff 'appear' wherever you want it to, though its persistent storage would 'really' be in a Rack or FwCS. Let's say your objects have an attribute that defines them in the context of their parent (e.g., dataskin2 in your example URL), Chris their id in Zope parlance, right? Hmm. not really... the Zope 'id' is used by the Rack to keep track of all the objects of a single type. If all your 'X's are kept in one Rack, they all need a unique 'id'. The idea context_id is an id-like attribute that 'plays the role of id' in the context of a particular parent. It's probably a bad name... but all I could think of in 5 minutes... let's call it 'context_id'. You may have six objects with the same context_id, but they would all have different parents. Chris They may each have mutliple parents too ;-) The point for Chris me is that the id (context_id in your example) is unique in Chris terms of _only_ the following constraint: No parent may Chris have more than one child with the same id. This is Chris actually how the ZODB works except that it objects in the Chris ZODB may only have one parent (well, at least ZODBs managed Chris with Zope ;-) Wow... multiple parents, multiple children.. it's almost incestuous! So long as you can write queries for 'find parents for child x' and 'find children for parent y' it shouldn't matter. If not you'll need to keep references to parents/childred stored in the objects and that can be bothersome, but possible. Now.. you could implement a search interface that finds an object in context. GetObjectInContextOfParent( context_id, parent_id ) Chris might be better if it resolved a path into an object, like Chris Zope does, hence my keenness to see if there isn't a simple Chris way I can make Zope and Zpatterns do the bulk of the work, Chris just with the tweaks I need... I'm not sure how the path will help you at this point... but if you need it you can always ask Zope for it once traversal is complete. Now for the traversal interface: def __bobo_traverse__(self, REQUEST, name): ob = getattr(self, name, _marker) if ob is _marker: ob = self.GetObjectInContextOfParent( context_id = name, parent_id = self.id) if ob is not None: return ob raise 'NotFound' return ob Chris looks good... Totally untested of course. ;-) Anyway the idea would be to *not* use folderish DataSkins, but to build a hierarchy out of them that could be traversed. Chris Hurm... I'd love them to have a UI identical to normal Zope Chris folders/objectmanagers, though, with properties, a security Chris tab, and, in a dream world, the ability to drop normal DTML Chris methods, python Scripts and the like into the foldersish Chris objects. Chris Is this asking for too much? ;-) You can never *ask* for too much. ;-) Seriously though... for this you'll probably need to store the objects persistently in the Rack(s), though you could farm some of their attributes out to other data storage systems with SkinScript. Nothing will prevent you from making your DataSkins inherit from ObjectManager or Folder, but you won't be able to completely 'virtualize' them. The only way I *think* you could make this work with completely virtual data-skins is to create 'sister' classes to everything you wanted to add (e.g. 'SkinDTML Method' and 'SkinPython Script' which would be new classes that inherit from DataSkin *and* the class you want to emulate (and probably yet another class that hanldles the interconnection glue parents/context and all that). Then you'd need to add whatever attribute providers were necessary to keep all the attributes of the original classes (e.g., DTML Method) in your external storage. But it sounds like you just want to keep 'some' of the associated data in the external source... so I don't think any of that will be necessary. good luck! -steve Chris 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] Objects with multiple parents and storage flexibility, ZPatterns?
Hi Chris, Random thoughts follow. ;-) I think that if you make your DataSkins folderish it will be hard to make the storage anything other than ZODB. However, Steve Alexander posted a neat trick the other day where __bobo_traverse__ is supplied by an attribute provider. You could use this to make your DataSkins traversable. Let's say your objects have an attribute that defines them in the context of their parent (e.g., dataskin2 in your example URL), let's call it 'context_id'. You may have six objects with the same context_id, but they would all have different parents. Now.. you could implement a search interface that finds an object in context. GetObjectInContextOfParent( context_id, parent_id ) Each object must also (of course) have a parent_id, unless it's a root level object. In SQL this might be: select * from objectXs where parent_id = 'dataskin1_id' and context_id = 'dataskin2' or it could be a catlog search, if you're in ZODB. Now for the traversal interface: def __bobo_traverse__(self, REQUEST, name): ob = getattr(self, name, _marker) if ob is _marker: ob = self.GetObjectInContextOfParent( context_id = name, parent_id = self.id) if ob is not None: return ob raise 'NotFound' return ob Totally untested of course. ;-) Anyway the idea would be to *not* use folderish DataSkins, but to build a hierarchy out of them that could be traversed. -steve ___ 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 example update....
Hi Itai, "Itai" == Itai Tavor [EMAIL PROTECTED] writes: Itai Steve Spicklemire wrote: Hi Folks, The Dumb ZPatterns example is updated. Now there is some more blah blah blah Itai Nice work, Steve. Thanks! Itai Removing id lists looks good. I started building objects Itai using getXForY(y_id), but the last one I made used an id Itai list following the Dumb Example. I've just changed it to use Itai getXForY, and it's much cleaner, plus it makes adding X from Itai Y/editInstanceForm easier. Yup.. this is working nicely for me. Itai I like the idea of naming all UI methods with '_html' - now, Itai if you find yourself referencing a method which doesn't end Itai in '_html' in your html code, you know you need to add an Itai interface method. I just need to decide if I like it enough Itai to change all my existing code... Right... I was on the lookout for something natural, and sorta obvious. I liked the fact that there are already examples of 'standard' interface methods that have '_html', so I wouldn't have to change *them*... sometimes laziness can be inspiring. ;-) Itai Some thoughts about the broken links handling problem: If an Itai object depends on the existence of another (for example, if Itai you wanted a ToDo to be tightly linked to a Deliverable) Itai then it should be deleted when the Deliverable is deleted, Itai right? You'd have WHEN OBJECT DELETED CALL Itai ToDos.deleteInstances(myToDoIDs) in the Deliverable Itai SkinScript, and you would never have ToDos floating around Itai without a Deliverable. As for the Deliverable changing and Itai invalidating the link, I think it would be solved if you Itai used immutable ids for all objects, and stored the Itai Deliverable title in a separate property. In case of weaker Itai links, such as between ToDo and Doer, I guess it should be Itai ToDo's responsibility to return None if the Doer referenced Itai by doerID doesn't exist - treating it the same way as the Itai case where no doer has been assigned. Yes.. I like this. Itai Maybe with this Itai SkinScript: WITH Doers.getItem(self.doerID) CALCULATE Itai self.doerID=RESULT.id or '' ? But I'm not really sure about Itai this... Ahh.. I think my brain just imploded in a recursive death spiral, but I get intent of the idea. This would work I think: WITH Doers.getItem(self.doerID) COMPUTE self.myDoer=RESULT or Doers.getItem('doNothing') where there is a default 'doer' named 'doNothing' in one of the Doers Racks. This guy would 'fill in' for the ToDo's doer when no 'real' doer can be found... I like that. ;-) Itai I think you've managed very well to stay on the right side Itai of the line in the sand... the problem is that complex real Itai world applications have a lot of stuff on the other side of Itai the line, and the challenge is to pull that stuff over the Itai line. My personal problem is figuring out if the stuff I Itai have on the wrong side of the line is necessitated by the Itai complexity of the application, or if I'm just making things Itai unnecessarily complicated... Thanks... don't want to mix metaphors, but I'm fearing that the line in the sand may be on a slippery slope ;-). Seriously though. It would be really easy to make this 'dumb' example so complex that a beginner in ZPatterns couldn't make it through without brain damage but never fear.. I've already squandered all my free time for the next three months on this... so it will very likely stay stuck where it is for some time now... I hope that some ZPatterns beginners find it useful as a starting place. take care, -steve ___ 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 example update....
Hi Folks, The Dumb ZPatterns example is updated. Now there is some more realistic object referencing going on, borrowing of code snippets between Specialists and suchlike. There is also more in the way of reasonable documentation, though everything is in flux, and it still doesn't resemble a truly completed product. I just feel the need to get things finished enough that I can stop thinking about them for a while. ;-) In particular there the ToDos now hold references to Doer and Deliverable, and no 'lists' are maintained. One thing I need to do is to have these references automatically 'fixed' when a 'referred to' entity is removed or modified in such a way that the link should be broken that's for the next version. If I'm not careful.. it won't be a 'simple' example anymore. There's got to be a line here somewhere (in the sand?). take care, -steve ___ 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] Re: ZPatterns, ObjectDomain, UML and all that.....
Hi Itai, Good idea! I'll try to add this to the example. thanks! -steve Itai P.S. I've been struggling with a problem that might get Itai cleared up if you added it to the example: Itai Say you want to allow a user to add a ToDo from the Itai Deliverable screen (in addition to the existing menu for Itai selecting existing ToDos). You could either place a 'create Itai ToDo' form right there, using a UI snippet from ToDos, or Itai link to ToDos.addToDoForm. The problem is how to get the id Itai of the new ToDo into the deliverable. If you didn't store Itai todo_ids in Deliverable, instead calling Itai ToDos.getToDosForDeliverable(), there would be no Itai problem. Otherwise, you'd need a addToDoInterface in Itai Deliverable, which will call ToDos.addToDo, then add the new Itai ToDo id to todo_ids. Or, as a third option, you could pass a Itai method to ToDos.addToDo, and get it to call this method and Itai give it the new id. Itai What do you think? Want to tackle this in the example? Itai Itai -- Itai Tavor "Je sautille, donc je suis." C3Works Itai [EMAIL PROTECTED] - Kermit the Frog Itai "If you haven't got your health, you haven't got anything" ___ 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] Re: ZPatterns, ObjectDomain, UML and all that.....
Hi Itai, "Itai" == Itai Tavor [EMAIL PROTECTED] writes: Itai I'm already using globally unique ids, but still, doesn't Itai using the same id for the Participant and the Actor make Itai these objects too tightly coupled? Seems to me that Actors Itai should provide an interface for finding actors to the rest Itai of the application; other objects should not make Itai assumptions about the internal storage of Actors, and Itai particularly what ids they use. No? Well... there are two aspects here: 1) Who knows about how various Participants and Actors are managed and 2) How are they actually managed. Tight coupling is only about "1". It seems to me that "2" is up to you as the developer to decide based on the particular situation. I'm sure that ZPatterns Zen is like most things... you learn by getting your fingers burnt ;-). However it seems to me that it should be OK for an Xs Specialist to implement getXforY( y_id ) or getXsforY( y_id ) (if there is more than one x for a single y. If you have an XOR relationship, with several potential Specialists I think you could either: (A) iterate through the list of possible Specialists and ask each to getXforY until you get a hit... or (B) have a 'clearing house' Participants specialist, with a Rack for each of the Participant types and let it iterate through the racks and return an object of the right type based on which one is a 'hit'. (Specialists of course do this automatically!) The advantage of (A) is, one less Specialist. The disadvantage is that the Actor Specialist needs to 'know' about the list of Participant Specialists itself. The advantage of (B) is that the clearing house Specialist keeps track of all the different Participants types... and the iteration is 'automatic'. However... I think that either of these is 'OK' as far as coupling is concerned. In both cases the information about the different types of Participant is kept in a single centralized place [(A) in the Actors Specialist] and [(B) in the clearing house Specialist]. *If* you had some *other* Specialist that also needed to iterate through the various types of Participants... *then* B would be a clear advantage, and probably worth the added complexity. Anyway.. just my random thoughts. -steve (P.S. it was refreshing to hear pje mention that he and Ty had to "bite the bullet" and add new classes/Specialists on a project and only *after* that it got much simpler, clearly implying that the original design was less than perfect. It seems to us newbies sometimes that they possess the Deific characteristic of near (object oriented) infallibility whereby they produce clean, elegant, yet simple object oriented designs with the same graceful ease with which they might compose a grocery list, while we mortals struggle for hours and days to come up with something that they might discard after a moment's thought. Anyway in the end we'll all learn the most by hard experience, if only she were a more forgiving Mistress!) (P.P.S. I still really like your idea of codifying some of these ZPatterns techniques into a sort of gallery of ZPatterns Implementations. I'm working already on incorporating some of these into the ToDo example.) ___ 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] 'Subclassing' another product
Hi Morten, There are two ways to subclass products. You can use straightforward Python subclassing: e.g.,In your custom Product.. here is an example from Zwiff: import Products.PythonMethod.Guarded from Globals import HTMLFile, MessageDialog from App import Common manage_addZwiffForm = HTMLFile('addForm',globals()) def manage_addZwiff(self, id, title, params, body, REQUEST=None): """Add A Zwiff to a folder just like PythonMethod.. """ it = Zwiff(id, title, params, body) self._setObject(id, it) return self.manage_main(self, REQUEST) def handleMovieOutput(movie, RESPONSE): fname = tempfile.mktemp() movie.save(fname) f = open(fname) s = f.read() f.close() RESPONSE.setHeader('Content-type', 'application/x-shockwave-flash') os.remove(fname) return s class Zwiff (Products.PythonMethod.PythonMethod.PythonMethod ): meta_type = 'Zwiff' def makeFunction(self, compile=0): from Products.PythonMethod.Guarded import GuardedBlock, safefuncs, theGuard if compile: self._checkCBlock(GuardedBlock) if self.errors: raise "Python Method Error", string.join(self.errors, '\n') return self._newfun(compile, {'$guard': theGuard}, __builtins__=mysafebin, _=safefuncs) So the class Zwiff is a subclass of PythonMethod. Look at Zwiff for the full source: http://www.zope.org/Members/sspickle/Zwiff Or you can create a ZClass that subclasses from a 'base class'. To do this you've got to register the base class with the ZClass machinery (e.g., here is the code for ZCVSMixin that does this ZCVSMixin is a base class... CVSFolder is a full blown product that happens to be a subclass of ZCVSMixin... ) import ZCVSMixin import CVSFolder __doc__ = ZCVSMixin.__doc__ __version__ = ZCVSMixin.__version__ def initialize(context): context.registerClass( CVSFolder.CVSFolder, constructors=(CVSFolder.manage_addCVSFolderForm, CVSFolder.manage_addCVSFolder), icon='fish.gif', ) context.registerBaseClass(ZCVSMixin.ZCVSMixin) does that help? take care, -steve ___ 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] Adding and setting properties from a virtual Specialist
Hi Itai, "Itai" == Itai Tavor [EMAIL PROTECTED] writes: Itai "OrderingEntities.getItem(some_id).current_order_id)" shows Itai me the value of current_order_id of the Employee object Itai some_id. But I can't figure out how to change the property Itai so it get changed in the Employee object. dtml-call Itai "OrderingEntities.getItem(some_id).manage_changeProperties(current_order_id='123')" Itai does nothing, it doesn't even trigger the WHEN OBJECT Itai CHANGED line (not that I really expected it to work... this Itai object is virtual, how can I call changeProperties on it?) How about 'OrderingEntities.getItem(some_id).propertysheets.TheRightPropertysheet.manage_changeProperties() or you could create an external method to set the property you want... YourExternalMethod( OrderingEntities.getItem(some_id), theValue) where def YourExternalMethod( theObject, theValue): setattr(theObject, 'current_order_id', theValue) I think these could/should work... Itai Other than figuring out how to get the change to work, I two Itai more problems: Itai -Eventually the OrderingEntities Specialist will have Itai several Racks mapping to several other Specialists, so it Itai will end up returning different classes. Should I instead Itai create a new ZClass with just the current_order_id property Itai and use this class in all the virtual Racks? This is what I do in most cases... each rack has different SkinScript to map the attributes of different classes onto the common attribute set of the single Storage class used by all the racks. Itai - How do I add a property to the original object from the Itai virtual object (assuming I did not add it manually to the Itai Employee class)? Do I call Itai self.original_object.manage_addProperty(...) from the Itai SkinScript? I think this should work but it will only add the propertysheet to the instance.. not the class. If the property is completely missing from the original class then it seems to me either there is really no real need to save it there... or the class was incomplete somehow to begin with... and it should be added at the ZClass level.. Just random thoughts... ;-) -steve Itai TIA -- Itai Tavor "Je sautille, donc je suis." C3Works Itai [EMAIL PROTECTED] - Kermit the Frog Itai "If you haven't got your health, you haven't got anything" Itai ___ Zope-Dev Itai maillist - [EMAIL PROTECTED] Itai http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Itai posts or HTML encoding! ** (Related lists - Itai http://lists.zope.org/mailman/listinfo/zope-announce Itai http://lists.zope.org/mailman/listinfo/zope ) ___ 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] Adding and setting properties from a virtualSpecialist
Hi Itai, "Itai" == Itai Tavor [EMAIL PROTECTED] writes: Itai Say I got several Participants, and some of those need to be Itai able to place orders. I create the Specialist Itai OrderingEntities to implement the role of 'someone who Itai places orders'. From what I understand about using Itai Specialists to extend a class behavior, this Specialist Itai should add the properties it needs to track orders with to Itai the Participant classes - I should not have to go in to Itai every Participant class and add the property to it, because Itai those classes don't know and don't care that they might be Itai used in this role. Am I wrong in this? Otherwise, the only Itai other way to track properties for this role would be to Itai physically store a new object on the OrderingEntities Rack Itai for every Participant class accessed, but what's the point Itai in that, if I can simply add the property to the original Itai class? No.. you're right here. I've never used property sheets in this way, just because it's seemed too much trouble to check for existence, then add if necessary... etc. If I need to have a property set in an instance... I just set it, using an external method. (Or I add it at the ZClass level.) It's important to be careful though... if there is already a property with that name there could be a clash. Obviously application integration needs to be done with full awareness of the different attributes used by each component. Itai Making small steps up the ZPatterns mountain (and too many Itai of them backwards), Yup.. me too. ;-) But it's better than sticks and bones.. take care, -steve Itai Itai -- Itai Tavor "Je sautille, donc je suis." C3Works Itai [EMAIL PROTECTED] - Kermit the Frog Itai "If you haven't got your health, you haven't got anything" ___ 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] Implementing [XOR A] 1 object connections in ZPatterns
Hi Itai, "Itai" == Itai Tavor [EMAIL PROTECTED] writes: ... Itai The 2nd way seems to go better with OO principles - all Itai handling of photos is delegated to the Photos Specialist and Itai the Product doesn't care if the photo exists or not, or Itai where it comes from. But it also increases complexity in Itai Photos, because I need to implement an efficient way to Itai retrieve photos (with a Catalog, or SQL searches), and Itai because it introduces the photo_key. Storing photo_id in Itai Product eliminates these complexities, but it moves some of Itai the responsibility for managing photos into Product. Hmmm.. it seems to me that it makes more sense for the Product to know the id of the Photo that *it* needs to display itself than for the Photo to have to know that it belongs to a particular Product. Also.. I can imagine that the Photo class might be useful for lots of other things besides Products, and how would you teach it what type of object it belongs to? Just my $0.02. ;-) -steve ___ 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, ObjectDomain, UML and all that.....
Thanks Roche! "RC" == RC Compaan [EMAIL PROTECTED] writes: RC Hi Steve RC I'm also a babe in the woods when it comes to object RC modelling, but here's my pennie's worth. Since code RC generation was not really required in the models I recently RC did for Zope Apps and the terrible exchange rate on the South RC African Rand I decided to use to very light weight Playground RC modelling tool. I agree with Steve Alexander that Coad RC notation serves ZPatterns *better* and this is exactly what RC Playground uses. Ahh.. alas Playground is Win only (if I'm thinking correctly that it's the software that came in Coad's book), and I loaned tbe book and CD to someone else ... g... ;-) RC Take the Customer with Address property example: I create RC Customer and Address Dataskins. For Customer I have an RC external method setAddress which sets the Address property of RC my Customer object and this is how I would create a new RC Customer: newCustomer = customerRack.newItem( CustomerCounter RC ) newAddress = addressRack.newItem( AddressCounter ) RC newCustomer.setAddress( newAddress ) RC I prefer the simplicity this brings when I have to access the RC properties of a Customer (without having to call a getter each RC time I need an address): myCustomer.Address.Street RC This also maps quite simply to SQL storage. RC So although instances of Address are properties of Customer RC they live on their own Rack and instances of Customer simply RC refers to their Address through assignment. Thanks... is that working between transactions? It has me a little confused. I've been snooping through the implementation of ZPatterns for a clue and it looks to me like: a) the data manager for a DataSkin is a non-persistent attribute. (self._v_dm_). I think this means that it needs to be set somehow in every Zope transaction before you can do much of anything with the instance. b) For Rack mounted DataSkins this should happen when the item is retrieved from the Rack, and basically should be set to the Rack itself. c) If an object is set as an attribute of another DataSkin won't its data manager be lost at the end of the transaction? How does it find its rack again at the next transaction? I too like the simplicity of setting attributes rather than saving IDs, and that may lead me to experiement with the folder/customizer stuff but right now I'm still doing specialists/racks ( for some reason... that's where I started! ) RC With Container/Content type objects I do roughly the same - I RC have setContainer methods for the Content objects. So most of your objects are defined in Python products, or are these methods ExternalMethods? thanks! -steve RC Roché ___ 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] ZPoPyDA for FreeBSD... was (Hmmmm.... what do *you* do when Zope is 'stuck'.)
Thanks... I'm pretty sure now that what I was was pthreads/popy related. I didn't realize there was a new/updated PoPy/ZPoPyDA on the zope site with lots of thread related (sem_init, sem_wait,... ) changes so I built it on my FreeBSD boxen and haven't seen the same behavior since. -steve P.S. here are the changes I made to build on FreeBSD: diff -c -r1.1.1.1 -r1.2 *** PoPymodule.h2000/12/03 14:06:38 1.1.1.1 --- PoPymodule.h2000/12/03 14:09:57 1.2 *** *** 38,43 --- 38,44 #include catalog/pg_type.h #include libpq-fe.h #include libpq/libpq-fs.h + #include sys/types.h #include regex.h #include string.h #include stdlib.h and mercury.spvi.com diff -c foop/pythonmods/PoPy/Makefile foo/pythonmods/PoPy/Makefile *** old/Makefile Sun Dec 3 18:06:58 2000 --- new/MakefileSun Dec 3 09:43:00 2000 *** *** 88,94 TARGET= python # Add more -I and -D options here ! CFLAGS= $(OPT) -I$(INCLUDEPY) -I$(LIBPL) $(DEFS) -I/usr/local/pgsql/include/ -Wall \ -DVERSION=\"1.4.1\" # These two variables can be set in Setup to merge extensions. --- 88,94 TARGET= python # Add more -I and -D options here ! CFLAGS= $(OPT) -pthread -I$(INCLUDEPY) -I$(LIBPL) $(DEFS) -I/usr/local/pgsql/include -I/usr/ports/databases/postgresql7/work/postgresql-7.0.2/src/include -Wall \ -DVERSION=\"1.4.1\" # These two variables can be set in Setup to merge extensions. *** *** 114,120 LINKCC= $(PURIFY) $(CC) SGI_ABI= OPT= -fomit-frame-pointer -O6 ! LDFLAGS= -L/usr/local/pgsql/lib/ LDLAST= DEFS= -DHAVE_CONFIG_H=1 -DHAVE_LIBCRYPT=1 LIBS= -lcrypt -lc_r --- 114,120 LINKCC= $(PURIFY) $(CC) SGI_ABI= OPT= -fomit-frame-pointer -O6 ! LDFLAGS= -L/usr/local/pgsql/lib LDLAST= DEFS= -DHAVE_CONFIG_H=1 -DHAVE_LIBCRYPT=1 LIBS= -lcrypt -lc_r *** *** 123,129 RANLIB= ranlib MACHDEP= freebsd3 SO= .so ! LDSHARED= gcc -shared CCSHARED= -fpic LINKFORSHARED=-Xlinker -export-dynamic --- 123,129 RANLIB= ranlib MACHDEP= freebsd3 SO= .so ! LDSHARED= gcc -shared -fpic -pthread CCSHARED= -fpic LINKFORSHARED=-Xlinker -export-dynamic *** *** 209,217 cp -ra test debian mx PoPy-1.4.1/ tar czf PoPy-1.4.1.tar.gz PoPy-1.4.1/ - - # Rules appended by makedepend PoPymodule.o: $(srcdir)/PoPymodule.c; $(CC) $(CCSHARED) $(CFLAGS) -c $(srcdir)/PoPymodule.c ! PoPymodule$(SO): PoPymodule.o; $(LDSHARED) PoPymodule.o -L/usr/local/pgsql/lib/ -lpq -o PoPymodule$(SO) --- 209,215 cp -ra test debian mx PoPy-1.4.1/ tar czf PoPy-1.4.1.tar.gz PoPy-1.4.1/ # Rules appended by makedepend PoPymodule.o: $(srcdir)/PoPymodule.c; $(CC) $(CCSHARED) $(CFLAGS) -c $(srcdir)/PoPymodule.c ! PoPymodule$(SO): PoPymodule.o; $(LDSHARED) PoPymodule.o -L/usr/local/pgsql/lib -lpq $(LIBS) -o PoPymodule$(SO) ___ 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 getPersistentItemIDs() bug?
Hi Chris, It looks like it's a non-bug, more just an annoyance. Here's my current feeling. In most 'real' situations you'll end up with a ZCatalog, or possibly a totally virtual ZClass with some sort of dynamic (SQL? LDAP? etc.. ) data source where the ids you're after will be queried for. My own practice at this point is to define methods at the rack level like: getAllItemIds, getRejectedItemIds, getCurrentItemIds and so on. These can then be implemented in a way that matches the actual data storage. *If* the data is stored persistently, and *if* you are implementing 'getAllItemsIds' and *if* you don't have a handy ZCatalog around to query, then you can use the hack I sent Roche. ;-) Otherwise there are better ways to do it anyway. The reason it's a probem is that getPersistentItemIDs() returns a BTree object, that isn't allowed to be exposed directly by the security machinery. However, 'sort' short-curcuits the machinery so that you can 'handle' them (in this hack, you store them in a simple python list). Anyway.. it's not clear it's a bug worth fixing... if it's a bug at all. -steve "Chris" == Chris Withers [EMAIL PROTECTED] writes: Chris Steve Spicklemire wrote: This is a known problem. Use: dtml-let itemIDs="[]" dtml-in "addressRack.getPersistentItemIDs()" sort dmtl-call "itemIDs.append(_['sequence-item'])" /dtml-in Chris Hmmm... that's not very nice, has the bug in Chris getPersistentItemIDs() been fixed? Chris cheers, Chris 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] 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 dtml-let ni="newItem(key=REQUEST['key'])" bentzion nips="ni.propertysheets.get('Basic')" dtml-call bentzion "nips.manage_changeProperties(REQUEST=REQUEST)" bentzion /dtml-let 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 )
Re: [Zope-dev] Method calls
Hi Roch, The whole traceback would be helpful.. one clue: Error Type: TypeError Error Value: hasattr, argument 2: expected string, int found 'hasattr' is the function that is complaining do you use it in your code? -steve "Roch'e" == Roch'e Compaan [EMAIL PROTECTED] writes: Roch'e I have a method called getModulesForProduct to which I Roch'e pass a ProductID eg: dtml-in Roch'e "Products.Modules.getModulesForProduct(this(), _, Roch'e ProductID)" sort=name Roch'e If ProductID is passed on from a form variable it works Roch'e fine. Roch'e If I set the ProductID through REQUEST.set: dtml-call Roch'e "REQUEST.set('ProductID',_.str(Product.id))" , Roch'e I get a TypeError: Roch'e Error Type: TypeError Error Value: hasattr, argument 2: Roch'e expected string, int found Roch'e I've been banging my head against this problem the whole Roch'e day so help would really be appreciated. Roch'e Roché Roch'e ___ Zope-Dev Roch'e maillist - [EMAIL PROTECTED] Roch'e http://lists.zope.org/mailman/listinfo/zope-dev ** No Roch'e cross posts or HTML encoding! ** (Related lists - Roch'e http://lists.zope.org/mailman/listinfo/zope-announce Roch'e http://lists.zope.org/mailman/listinfo/zope ) ___ 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] Method calls
Hmm... OK ... next question... what are you doing *in* the 'in' tag? Somehow you're trying to access an object contained in an object manager (one of your modules?) and you're using an 'int' rather than a string as an id. Can you post the code? thanks, -steve "Roch'e" == Roch'e Compaan [EMAIL PROTECTED] writes: OK.. it's the 'in' tag that's causing the problem. Why not try: dtml-var "experession that's causing problem with in" html_quote and see what 'in' is choking on... Roch'e It's choking on a list of instances. This is what is Roch'e returned when I "var" the expression: Roch'e [Module instance at 8b97660, Module instance at Roch'e 88f04b0, Module instance at 8994730, Module instance Roch'e at 8b46a08] ___ 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: Methods of specialits
Hi Roch'e, I'm guessing that getAllContactsForCustomer is a "DTML Method". If I remember correctly the third argument is a 'mapping object' that can be used to augment the effective namespace available to the method. Passing _.None should do nothing (I'm guessing you could just use "getAllContactsForCustomer( this(), _ )" and it would work just fine. This issue has been pretty much hashed to death here in the past. There is even a fishbowl proposal to 'fix it'. http://dev.zope.org/Wikis/DevSite/Proposals/NamespacePassingRevisited -steve "Roch'e" == Roch'e Compaan [EMAIL PROTECTED] writes: Roch'e I have a specialist Contacts and for Contacts I have a Roch'e method getAllContactsForCustomer. Whenever I want to call Roch'e this method I have to pass on the whole namespace and the Roch'e object itself to get it to work eg: Roch'e getAllContactsForCustomer(this(), _, _.None). Why is this Roch'e the case? And what does _.None actually mean? Roch'e Roché ___ 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 Project Help!
Hi Ben, GAPs are sort of deprecated at this point in favor of SkinScript. In SkinScript you might do something like this: WITH accounts.getItem(self.account_id) COMPUTE account_object=RESULT or more carefully... WITH accounts.getItem(self.account_id) COMPUTE account_object=(RESULT is _.None) and NOT_FOUND or RESULT -steve "bentzion" == bentzion [EMAIL PROTECTED] writes: bentzion Another question... bentzion I want to have a GAP that will add some other Object to bentzion an attribute of my DataSkin. This is what I have tried bentzion with no success. bentzion fromexpr: accounts.getItem(self.account_id) attrsexprs: bentzion account_object=RESULT bentzion This way in my UI Methods in my DataSkin I can access bentzion (and change) the attributes of "account_object". bentzion Q. How can I do this? Should I be doing this in a bentzion different/better way? bentzion Thanks, -Ben ___ 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] CVS and Zope methods
Hi Petr, If you're running on something unixy.. you could use ZCVSMixin... -steve "PK" == Petr Knapek [EMAIL PROTECTED] writes: PK Hi Zopists, I am working on a Zope project and we decided to PK store source code in CVS. With python Zope products there is PK no problem. The work with CVS is very comfortable but I do PK not know how to make comfortable also the working with Zope PK methods which we would like have them in CVS also in plain PK text format and not in zope export or XML format. I would PK prefer this: Put Zope methods into our CVS and edit them in my PK working copy of CVS. When I restart Zope the Zope methods PK which are in my CVS working copy will be placed into ZODB or PK they will replace the content of existing ones. Is this PK possible and if yes can you advice me how to do this? Or give PK me some URL on documentation how others solve this problem. PK Thank you very much in advance, Petr -- Petr Knápek NEXTRA PK Czech Republic, s.r.o., Hlinky 114, 603 00 Brno, Czech PK Republic e-mail: mailto:[EMAIL PROTECTED] tel:+420-5-43 554 150 PK FAX:+420-5-43 554 214 PK ___ Zope-Dev PK maillist - [EMAIL PROTECTED] PK http://lists.zope.org/mailman/listinfo/zope-dev ** No cross PK posts or HTML encoding! ** (Related lists - PK http://lists.zope.org/mailman/listinfo/zope-announce PK http://lists.zope.org/mailman/listinfo/zope ) ___ 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] CVS and Zope methods
Hi Robin, You can FTP to the 'methods' tab of your ZClass using: ftp://name@server:xx21/Control_Panel/Products/YourProductFolder/YourZClass/propertysheets/methods -steve "Robin" == Robin Becker [EMAIL PROTECTED] writes: Robin On the same kind of note I find that while the code in my Robin Zope Products is visible to FTP and searchable anything I Robin put into a ZClass is invisible from FTP/or text Robin searches. Although they appear a bit like folders in the Robin management interface they aren't the same at all. -- Robin Robin Becker ___ 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: Remapping object from on to another specialist
Hi Jimbo, I'm not sure what you mean by 'not getting anywhere...' but I've generally found it useful to work on problems like this one little step at a time. I might be tempted to just try: WITH EmployZManager.getItem(self.id) COMPUTE original_object = (RESULT is _.None) and NOT_FOUND or RESULT and WITH self.original_object COMPUTE name=emp_id, description=first and then put some objects into EmployZManager 'manually' with known attributes for emp_id and description. Then try to trigger the script by displaying the 'original_object' attribute. (You should set the rack to be non-persistent and 'original_object' as the existence attribute.) Once that's working, then worry about the other skinscript statements. If that's not working... the you have some other problem. -steve ___ 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] Specialists, Racks, and Objects, oh my!
Hi Bill, The 'type' of object is set in the Storage tab of the rack. The specialist can decide which rack to use based on circumstances that dicate one type of object or another. -steve "Bill" == Bill Anderson [EMAIL PROTECTED] writes: Bill I want a specialist to have two (or more hypotheticaly) Bill racks, and each rack is to contain one type of object. I Bill then want to be able to add objects. Bill I have the two racks set up, but I am unclear as to how to Bill specify that I want to add an item of a certain type, or to Bill a certain rack. Bill Ideas appreciated ... Bill -- Bill Anderson Linux Specialist HPSO Thursday, November Bill 02, 2000 Random Quote: Portable: survives system reboot. Bill ___ Zope-Dev Bill maillist - [EMAIL PROTECTED] Bill http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Bill posts or HTML encoding! ** (Related lists - Bill http://lists.zope.org/mailman/listinfo/zope-announce Bill http://lists.zope.org/mailman/listinfo/zope ) ___ 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] Best way to start on ZPatterns ?
Hi Nigel, Yes.. the example still works. I am working on an update that incorporates some of the suggestions folks have made and better illustrates some ZPatterns concepts. Basically the example is *too* simple, and it doesn't separate PD, and UI issues very well.. -steve "Nigel" == Nigel Head [EMAIL PROTECTED] writes: Nigel OK, I've finally got a little leisure to re-assess my way Nigel of making Zope apps (which so far has been 99.9% ZClasses) Nigel and it seems the way to go might be ZPatterns. In true Zope Nigel tradition the docs (at least the simple docs) seem to leave Nigel quite a steep learning curve :-) Nigel After searching the zope-dev mail for a while I've happened Nigel on the thread from Steve S. describing the simplest example Nigel he could think of. Is this still a valid example for the Nigel current version of ZPatterns? Nigel -- Nigel Head Houbits Hi-Tech Servers [EMAIL PROTECTED] Nigel ___ Zope-Dev Nigel maillist - [EMAIL PROTECTED] Nigel http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Nigel posts or HTML encoding! ** (Related lists - Nigel http://lists.zope.org/mailman/listinfo/zope-announce Nigel http://lists.zope.org/mailman/listinfo/zope ) ___ 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, MySQL, Full Text Searching
Hi Chris, ZPatterns and ZCatalog work fine. Here is a skin script I've been using to keep a catalog up to day with DataSkins: WHEN OBJECT ADDED CALL Catalog.catalog_object(self, _.string.join(self.getPhysicalPath(),'/')) WHEN OBJECT DELETED CALL Catalog.uncatalog_object(_.string.join(self.getPhysicalPath(),'/')) WHEN OBJECT CHANGED CALL Catalog.uncatalog_object(_.string.join(self.getPhysicalPath(),'/')), Catalog.catalog_object(self, _.string.join(self.getPhysicalPath(),'/')) The problem (I think) is DataSkins and CatalogAware, which don't mix. -steve "Chris" == Chris Withers [EMAIL PROTECTED] writes: Chris Hello, Chris I've read that ZPatterns and ZCatalog don't interact too Chris well and I was wondering if this is also true of the new Chris ZPatterns release. I might be looking to move something to Chris ZPatterns so that it can get all benefits of Zope's Chris security system and things like the Catalog, obviously if Chris the Catalog doesn't work with ZPatterns, that's a bit of a Chris problem :-S Chris On a related note, has anyone thought of using MySQL's new Chris full text searching to implement the Catalog interface? Has Chris anyone thought of or actually made the Catalog stuff into Chris an interface so people can implement other options to Chris ZCatalog? Chris cheers, Chris Chris Chris PS: Is there a ZPatterns demo/tutorial around anywhere? How Chris should I start getting into ZPatterns? What should I read? Chris Where should I start? (The four most common ZPatterns Chris FAQ's if I'm not mistaken ;-) Chris ___ Zope-Dev Chris maillist - [EMAIL PROTECTED] Chris http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Chris posts or HTML encoding! ** (Related lists - Chris http://lists.zope.org/mailman/listinfo/zope-announce Chris http://lists.zope.org/mailman/listinfo/zope ) ___ 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] Debugging ConflictErrors
Hi John, This is one of the problems with SkinScript, and I've not found any great way to sort through it. Here are my two (three?) cents worth 1) Break the SkinScript triggers down to the simplest possible event, and test them individually. If this is not possible, then debug the trigger with a 'pseudo' event that you can generate deliberately. 2) Try Steve A's DummyDataSkin from his add-on utilities. It can be a great help in sorting out what's going on 3) Get down to the debugger. It's not as easy as debugging 'plain' zope since the 'trigger' objects are 'compiled' but you should at least be able to step through a 'commit' and see when they are hitting exceptions etc... -steve "John" == John Eikenberry [EMAIL PROTECTED] writes: John Hey all, John Using ZPatterns, I have a set of specialists/racks/dataskins John that have a dependency relation. So I've used triggers to John chain deletes in an appropriate way. I won't go into a lot John of detail here as there is quite a bit of code, and I figure John I'm the best suited to debug it. John My problem is I can't get a hold on where the problem John is... all the triggers and appropriate manage_delete's are John getting called. I've checked to make sure I'm not modifying John something already marked for deletion. I don't manually John commit at any point and there are no other threads getting John run. Are there any good heuristics I can use to figure out John what the problem is? I'm sure others have run into John ConflictErrors before, how have you debugged them? John Thanks in advance for any tips... John -- John John Eikenberry [[EMAIL PROTECTED] - http://zhar.net] John __ John "A society that will trade a little liberty for a little John order will deserve neither and lose both." --B. Franklin John ___ Zope-Dev John maillist - [EMAIL PROTECTED] John http://lists.zope.org/mailman/listinfo/zope-dev ** No cross John posts or HTML encoding! ** (Related lists - John http://lists.zope.org/mailman/listinfo/zope-announce John http://lists.zope.org/mailman/listinfo/zope ) ___ 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] It's been a while
Hi Roche, PJE produced some great comments about this in reaction to my lame attempt at an example. There also some good discussion about other questions on the list. Here are a few choice posts: http://lists.zope.org/pipermail/zope-dev/2000-October/007232.html http://lists.zope.org/pipermail/zope-dev/2000-October/007205.html http://lists.zope.org/pipermail/zope-dev/2000-October/007287.html http://lists.zope.org/pipermail/zope-dev/2000-October/007289.html hope that help... sometime (soon?) I hope to get a chance to re-work the example with references to these posts, plus fixes to make the example 'fit' the model. Also.. I want to incorporate another specialist to demonstrate interapplication integration. -steve "Roch'e" == Roch'e Compaan [EMAIL PROTECTED] writes: Roch'e It's been a while since i've had time to explore ZPatterns Roch'e - and now the time has come that I am considering to base Roch'e development for a new project on ZPatterns. Roch'e I think I'm better prepared now - I read Coad's Object Roch'e Models, and implemented a data management layer in Delphi. Roch'e The project envolves Customer Relationship Management - Roch'e like openticket, but I don't like openticket's tight Roch'e coupling with the SQL databases. Roch'e First stupid question: Are ZClasses based on Dataskins PD Roch'e (Problem Domain) objects or DM (Data Management) objects? Roch'e Can somebody possible categorize the main classes in Roch'e ZPatterns according to Problem Domain, User Interface, Roch'e Data Management? Roch'e Would it be safe to base development on ZPatterns if I Roch'e want to use an SQL RDBMS as storage and ZPatterns as Roch'e DataManagement layer ie. is ZPatterns stable engough? Roch'e Roché Roch'e ___ Zope-Dev Roch'e maillist - [EMAIL PROTECTED] Roch'e http://lists.zope.org/mailman/listinfo/zope-dev ** No Roch'e cross posts or HTML encoding! ** (Related lists - Roch'e http://lists.zope.org/mailman/listinfo/zope-announce Roch'e http://lists.zope.org/mailman/listinfo/zope ) ___ 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, Racks, Customizers, etc.
Would something like this work? newSpecialist = Specialists.Specialist() newSpecialist.id = 'goobers' newSpecialist.title = "Goober Manager" myFolder._setObject(newSpecialist.id, newSpecialist) newSpecialist = newSpecialist.__of__(myFolder) newSpecialist.RacksGroup._constructPlugIn('Rack', id='defaultRack') newRack = newSpecialist.defaultRack newRack.manage_addSSMethod('mySSMethod','') Most of this can be 'gotten' by poking around in the HTML documents in the management interface -steve ___ 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 + Skinscript
OK I think I found the problem(s): *** Expressions.py 2000/10/18 23:11:55 1.1.1.3 --- Expressions.py 2000/10/31 14:14:09 *** *** 133,139 def eval(self,mapping): """Return the result of looking up/calling the name from 'mapping'. If the object was created with 'call==1', call it before returning it.""" ! return md.getitem(self.name,self.call) del Eval, expr_globals, TemplateDict, Base, ComputedAttribute --- 133,139 def eval(self,mapping): """Return the result of looking up/calling the name from 'mapping'. If the object was created with 'call==1', call it before returning it.""" ! return mapping.getitem(self.name,self.call) del Eval, expr_globals, TemplateDict, Base, ComputedAttribute *** SkinScript/Compiler.py 2000/10/18 23:11:56 1.1.1.4 --- SkinScript/Compiler.py 2000/10/31 14:12:09 *** *** 168,174 class Compute(AST): type = 'COMPUTE' ! def __init__(self,*args,**args): self._kids=list(args)+kw.items() class Trigger(Compute): --- 168,174 class Compute(AST): type = 'COMPUTE' ! def __init__(self,*args,**kw): self._kids=list(args)+kw.items() class Trigger(Compute): Try these patches and see if it works... -steve ___ 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 + Skinscript
Hi Joachim, "Joachim" == Joachim Schmitz [EMAIL PROTECTED] writes: Joachim Hi Steve, Joachim that did it, many thanks, how did you debug this ? The debugger is your friend. ;-). Seriously I'd be lost without it: http://www.zope.org/Members/michel/HowTos/TheDebuggerIsYourFriend Joachim By the way, it only work if specify a DataSkin derived ZClass Joachim under the Storage tab. Yes... did you attempt to use a 'pure' DataSkin? -steve ___ 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 + Skinscript
My Experience with 'raw' DataSkins is that you'll quickly run afoul of the Zope Security system. Using a ZClass that has ZPatterns:DataSkin as a base class avoids this, and gives you an easy way to put a 'user interface' on your objects. -steve "Joachim" == Joachim Schmitz [EMAIL PROTECTED] writes: Joachim Hi Steve, Joachim thanks for the tips, I try to do it without the ZClass, Joachim according to my understanding, and Phil Eby's reply that Joachim should work too, but apparently I the first one to try Joachim it. I try it out. Joachim On Mon, 30 Oct 2000, Steve Spicklemire wrote: Hi Joachim, Hmm.. I would start start really simple here, and then 'work up' to the sql query Create a default rack with the following SkinScript. WITH ['a','b','c'] COMPUTE movie_link=RESULT[0],movie_title=RESULT[1], zeiten=RESULT[2] Set the storage for this rack to be a DataSkin derived ZClass loaded by accessing attribute 'movie_link'. Then try the following method in the Specialist: dtml-var standard_html_header dtml-let theItem="getItem('anyOldThing')" dtml-with theItem dtml-var movie_link dtml-var movie_title dtml-var zeiten /dtml-with /dtml-let dtml-var standard_html_footer If this does what you expect.. then you're getting close. Now change the ['a','b','c'] to be a call to your query: WITH yourQuery(... parameters for your query... ) COMPUTE movie_link, movie_title... etc. If you get the same errors in the first case.. then your problem has nothing to do with SQL. -steve "Joachim" == Joachim Schmitz [EMAIL PROTECTED] writes: Joachim On Mon, 30 Oct 2000, Steve Spicklemire wrote: Hi Joachim, rackList just refers to the racks in the 'racks' tab of the Specialist. Do you have any racks defined for this Specialist? The rackList is managed magically with the plug-in-group stuff. Joachim Yes that's what I found too, but it doesn't work, with Joachim SQL-database and SkinScripts, the setup is described Joachim below: "Joachim" == Joachim Schmitz [EMAIL PROTECTED] writes: Joachim for debugging I inserted in Specialists.py in getItem: Joachim return str(self.rackList) -- inserted for rack in Joachim self.rackList: item = rack.__of__(self).getItem(key) if Joachim item is not None: return item Joachim this alway returns an empty list, when calling it from Joachim the dtml: Joachim dtml-var "getItem(_.int(609))" returns "[]" Joachim I tried to follow the magic how this rackList is setup, Joachim but it is to much python-Zen for me. Joachim On Sun, 29 Oct 2000, Joachim Schmitz wrote: On Sat, 28 Oct 2000, Phillip J. Eby wrote: At 05:17 PM 10/28/00 +0200, Joachim Schmitz wrote: select e.event_id as event_id ,e.zeiten as zeiten ,v.firma as firma ,v.tel as tel ,e.movie_id as movie_id,m.movie_title as movie_title ,m.movie_link as movie_link ,m.movie_text as movie_text ,e.datum_von as datum_von ,e.datum_bis as datum_bis from event as e, veranstalter as v, movies as m where e.event_id = dtml-sqlvar e_id type=int and e.movie_id = m.movie_id and e.veran_id = v.veran_id order by m.movie_title Just out of curiosity, why do you have an "order by" clause, if this is supposed to only return one row? If more than one item is returned by this query, only the first will be used to supply data to your DataSkin. that was just left over from an reused query-template, I forgot to take it out. I also added a SkinScript method as a Data Plug-in in the defaultRack like this WITH QUERY readEvents(e_id=self.event_id) COMPUTE zeiten,firma,tel ,movie_id,movie_text,movie_link,movie_title ,datum_von,datum_bis,zeiten Do you have some way of providing self with an "event_id" value? Keep in mind that when DataSkins are created, they have only an "id" attribute, nothing else. So unless you have an attribute provider that provides an "event_id" value, this statement will fail. Perhaps what you actually mean is: WITH QUERY readEvents(e_id=self.id) COMPUTE event_id, zeiten,firma,tel, movie_id,movie_text,movie_link,movie_title, datum_von,datum_bis,zeiten Notice that I'm passing self.id to readEvents, and that I've added event_id to the list of attributes retrieved from the query. how do I set "self.id" I tried in dtml
Re: [Zope-dev] ZPatterns + Skinscript
Hi Joachim, Hmm... I just put all the code in myself... to be *really* sure, and it does work. What do you see for 'current attribute handling' in the Data PlugIns tab of the default rack? I would try to simplify. Take out all the skin script execpt for the one line. -steve "JS" == Joachim Schmitz [EMAIL PROTECTED] writes: JS Hi Steve, JS I did exactly (hopefully) as you sugested, but the dtml-method JS fails with: (I moved the SkinScript with first to the top) JS Error Type: KeyError Error Value: movie_link JS ... JS File JS /usr/local/Zope-2.2.0/lib/python/DocumentTemplate/DT_String.py, JS line 528, in __call__ (Object: testzclass) File JS /usr/local/Zope-2.2.0/lib/python/DocumentTemplate/DT_Let.py, JS line 147, in render (Object: theItem="getItem('anyOldThing')") JS File JS /usr/local/Zope-2.2.0/lib/python/DocumentTemplate/DT_With.py, JS line 146, in render (Object: theItem) KeyError: (see above) JS what's the best way to debug this ? JS On Mon, 30 Oct 2000, Steve Spicklemire wrote: Hi Joachim, Hmm.. I would start start really simple here, and then 'work up' to the sql query Create a default rack with the following SkinScript. ___ 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] Refresh and debugging product creation issues.....
Debugging products is a pain... restarting Zope all the time is a Pain THANK GOD for Shane Hathaway. ;-) I am delighted to report general success with the Refresh product! My only problem is while debugging the process of creating new EMarket instances, I find that every time I run 'Refresh' I get a new "EMarket" in the 'Available Objects' popup. A quick test of other Products shows the same behavior. Soo... I snooped through the product creation code and found that Products.meta_types was being unconditionally appended to every time context.registerClass was called so I changed my initialize to this: def initialize(context): import Products context.registerClass( EMarket.EMarket, permission='Add EMarkets', constructors=(EMarket.addEMarketForm, EMarket.addEMarket), icon='emarket.gif', ) found_count = 0 new_products_meta_types = [] for index in range(len(Products.meta_types)): if Products.meta_types[index]['name'] == EMarket.EMarket.meta_type: found_count = found_count + 1 if found_count == 1: new_products_meta_types.append( Products.meta_types[index] ) else: new_products_meta_types.append( Products.meta_types[index] ) Products.meta_types = tuple( new_products_meta_types) In other words... only include the original version of EMarket.EMarket.meta_type in the Product.meta_types tuple... if there are others... leave them out. ...and that seems to have solved the problem Does this seem like an OK idea? thanks, -steve ___ 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 design questions
I should point out a couple of things that might not be obvious (that I noticed only on a second 'read' of the explaination): 1) getPersistentItemIds() can be a pain. dtml-in "defaultRack.getPersistentItemIDs()" sort is straightforward enough... but what if I don't care if they are sorted, or I want to sort on some other property? One would think that you could do something like...: dtml-let foo="[]" dtml-in "defaultRack.getPersistentItemIDs()" dtml-call "foo.append(defaultRack.getItem(_['sequence-item']))" /dtml-in dtml-in foo sort=description ... /dtml-in /dtml-let But it doesn't work! You get 'Authorization Failed'. There was a bit of email on the list when I found this problem but it doesn't seem to bother anyone too much it turns out that getPersistentItemIds() actually returns a BTree object, which is not covered by the Zope security system as an allowed 'simple' subobject. However, when you 'sort' the list in the 'in' tag.. a side effect is that it it copied to a plain old Zope list. so it's OK. ;-) So... you *can* do dtml-let foo="[]" dtml-in "defaultRack.getPersistentItemIDs()" sort dtml-call "foo.append(defaultRack.getItem(_['sequence-item']))" /dtml-in dtml-in foo sort=description ... /dtml-in /dtml-let Soo.. the moral of that story is... if you're not allowed to see something... just sort it! :-) !! ;-( 2) This simple/dumb example using a Specialist/Rack combination. There is another approach (that Steve Alexander has used a lot I gather) which is to use the Folder with customizer support. I've never tried that since I went down this road and wanted to sort it out before 'branching' to other methods. To be fair I should probably try to implement this same example with that approach. -steve ___ 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] ToDoManager ZPatterns example not working
Erp! Sorry... I think the ZClass and the Rack got out of sync... I'll upload a new 'consistent' pair.. sorry! -steve "Itai" == Itai Tavor [EMAIL PROTECTED] writes: Itai Hi, Itai I installed the ToDoManager/ToDoProduct example Itai (http://www.zope.org/Members/sspickle/DumbZPatternsExample ) Itai but it won't work. System is RedHat 6.1, Zope 2.2.2, Itai ZPatterns-0-4-2a3. Itai I get the following traceback when I try to view Itai /ToDoManager/index_html. Is it a bug somewhere or a problem Itai with my installation? Itai Error Type: AttributeError Error Value: Itai _setRack Itai Traceback (innermost last): File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, Itai line 222, in publish_module File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, Itai line 187, in publish File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/Zope/__init__.py, line Itai 221, in zpublisher_exception_hook (Object: Itai ProviderContainer) File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, Itai line 171, in publish File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/mapply.py, Itai line 160, in mapply (Object: index_html) File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, Itai line 112, in call_object (Object: index_html) File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/OFS/DTMLDocument.py, Itai line 177, in __call__ (Object: index_html) File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/DocumentTemplate/DT_String.py, Itai line 528, in __call__ (Object: index_html) File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/DocumentTemplate/DT_In.py, Itai line 691, in renderwob (Object: Itai defaultRack.getPersistentItemIDs()) File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/DocumentTemplate/DT_Let.py, Itai line 147, in render (Object: currID="_['sequence-item']") Itai File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/DocumentTemplate/DT_With.py, Itai line 133, in render (Object: getItem(currID)) File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/DocumentTemplate/DT_Util.py, Itai line 337, in eval (Object: getItem(currID)) (Info: currID) Itai File string, line 0, in ? File Itai /opt/Zope/lib/python/Products/ZPatterns/Specialists.py, line Itai 34, in getItem (Object: ProviderContainer) File Itai /opt/Zope/lib/python/Products/ZPatterns/Rack.py, line 60, in Itai getItem (Object: ProviderContainer) File Itai /opt/Zope/lib/python/Products/ZPatterns/Rack.py, line 114, Itai in retrieveItem (Object: ProviderContainer) File Itai /opt/Zope-2.2.2-linux2-x86/lib/python/OFS/Uninstalled.py, Itai line 110, in __getattr__ (Object: broken) AttributeError: Itai (see above) -- Itai Tavor "Je sautille, donc je suis." Itai C3Works [EMAIL PROTECTED] - Kermit the Frog Itai "If you haven't got your health, you haven't got anything" Itai ___ Zope-Dev Itai maillist - [EMAIL PROTECTED] Itai http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Itai posts or HTML encoding! ** (Related lists - Itai http://lists.zope.org/mailman/listinfo/zope-announce Itai http://lists.zope.org/mailman/listinfo/zope ) ___ 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 design questions
Ack.. sorry... I was making little changes last night to make sure the ZClass was completely consistent with my explaination, and to make sure I could start 'from scratch'. I created a 'new' ZClass, and a 'new' rack. This confused the 'old' Rack. (I didn't update the ToDoManager.zexp, so if you downloaded the new Product, but the old ToDoManager you got the _setRack error. Anyway... I've now uploaded both the ToDoManager and the ToDoProducts at 0.0.2. I also changed the index_html of the ToDoManager to illustrated the getPersistentItemIds() issue I wrote about earlier good luck! -steve here's the new index_html: dtml-var standard_html_header center br h2dtml-var title/h2 p dtml-let idList="[]" dtml-in "defaultRack.getPersistentItemIDs()" sort dtml-call "idList.append(getItem(_['sequence-item']))" /dtml-in dtml-in idList sort=description dtml-if sequence-start form action="." method="post" table cellspacing=3 cellpadding=3 border=1 trtdnbsp;/tdthName/ththDescription/ththDoer/ththDone?/th/tr /dtml-if tr tdinput type=checkbox name="ids:list" value="dtml-id;"/td tda href="dtml-var id url_quote/editInstanceForm"dtml-var id/a/td tddtml-var descriptionnbsp;/td tddtml-var doernbsp;/td tddtml-if doneDone!dtml-elsenbsp;/dtml-if/td dtml-if sequence-end trtd colspan=5 align=centerinput type=submit name="newToDoForm:method" value="Add New ToDo"input type=submit name="deleteInstances:method" value="Delete selected ToDos"/td/tr /table /dtml-if dtml-else Sorry.. no "to do"s! br form action="." input type=submit name="newToDoForm:method" value="Add New ToDo" /form /dtml-in /p /dtml-let /center dtml-var standard_html_footer ___ 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 design questions
"pje" == Phillip J Eby [EMAIL PROTECTED] writes: - Propertysheets: You don't expressly say that Shared needs to be a 'Common Instance Property Sheet'. pje Actually, if it's intended to be shared across all instances, pje there seems to me to be little reason to have it in the pje ZClass; you might as well define the properties as constants pje using SkinScript. However, if you want to have defaults that pje an application integrator will be able to override without pje actually subclassing, then you want Shared to be a DataSkin pje Property Sheet, so that they will have the option of pje overriding your defaults with SkinScript or another attribute pje provider. Yeah.. now that I think about it a little more clearly, it makes sense to define this in the Specialist itself. This way all the instances in a ToDoManager would share the same set of 'doers', but different ToDoManagers could keep their own custom set. - I'm trying to reconcile PJE's methodology of Domain Logic, Presentation Logic, Data Management Implementation Logic, and User Interface Implementation Logic. Can you (or Phillip) label each of the DTML methods as to which category they fall into? And state why, even if it seems obvious? pje In the ZClass: pje index_html - presentation, because it displays things the pje object knows pje editInstanceForm - presentation, because it is strictly pje display pje editInstance - primarily domain, but mixes some presentation pje in. If instead of displaying an OK button, it just did a pje redirect, I'd consider it a pure domain. Note, by the way, pje that it's not wrong to mix the two, it's just usually more pje reusable to keep presentation code out of domain methods if pje you want to be able to call them from code or XML-RPC and pje such. Good! This is the kind of feedback I need! So I can pass in a redirection URL so that the domain code can work in different environments easily. pje In the Specialist (btw, stric: pje index_html: UI implementation, because it implements a pje non-object specific UI (i.e. "display all to-do's"). pje newToDoForm: UI implementation, because it's a non-specific pje object UI. pje addNewToDo: DM implementation, polluted by a bit of UI. :) pje It implements the data management aspect of creating a new pje instance. It calls the Specialist's newItem() method, but it pje could have directly called a newItem() method on one of the pje Specialist's Racks, or done something else to create the pje instance. pje deleteInstances: DM implementation, again with a touch of UI. pje It implements the data management aspect of creating a new pje instance. Instead of doing manage_delete on each item, this pje could have been implemented as an SQLMethod that did a DELETE pje WHERE operation using the id's that were given (if the data pje store was an SQL database, of course). OK.. I'll go back and try to 'clean out' the UI pollution to illustrate that separation better. - How does this product (simple though it is) exemplify the RIPP approach? pje I'm not sure that you can say it *exemplifies* the RIPP pje approach, although it certainly goes along with that pje approach. My hesitation is mainly that it doesn't really pje show any of RIPP's major benefits, which are associated with pje framework re-use and integration. For that, you really need pje to have more than one kind of object, with some kind of pje collaboration taking place. Hmm.. can anyone thing of a good collaboration 'partner' for a simple ToDo list? If it's not too complex.. I'd be happy to add it. thanks, -steve P.S. my first alpha of EMarket based on ZPatterns is just about ready. I'm sure it's full of similar pollution. This would be a great place for a design review. ;-) ___ 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] Accessors for DataSkin attributes (was Re: [Zope-dev] Success!
"pje" == Phillip J Eby [EMAIL PROTECTED] writes: pje It is *not* undesirable to have ZClasses be subclasses of pje your core logic base class. Just make sure they *also* pje subclass DataSkin, or that you use the metaclass definition pje stuff above. You've actually got a pretty decent approach pje going there. Hmmm.. again, maybe I'm reading too much into the DropZone example, but I seem to recall there that subclassing was pretty much explicitly discouraged. Did I misinterpret that? ''' Notice that we do not subclass SkyDiver from a Customer class and a ResourceUser class. What we are doing is saying is that Customer is a role that a Party (person or organization) plays in an accounting system, and ResourceUser is a role that a Party plays in a resource scheduling system. SkyDiver, then should implement a Party interface, allowing it to be used as a Customer or ResourceUser. Thus, SkyDiver can be used by any framework that needs to collaborate with a Party object, although it may have a new role in which the party will be used. For example, if I later add a curriculum management system to cover my skydiver training courses, I will want SkyDiver to fill the Student role. ''' OK.. allow me to summarize my very latest thought. Subclassing is OK withing my own framework. It's OK to require users of my framework to create ZClasses that subclass from my core logic Python classes, and from DataSkin. If we need integration between frameworks, we can handle that in SkinScript to share attributes between Specialist, or anthing else that might be helpful in providing the needed information. Does that sound right? pje One question, though. Why the derivation from Folder? Oh... this was a case where my object, in addition to 'simple' properties also needed to 'contain' other stuff (files, images and the like...) making it a subclass of folder just got me that ability for 'free'. I could also have used ObjectManager, but making it folder just reduces the amount of 'UI' effort needed for the management interface of the contained stuff. I could have just created a plain folder with the same 'id' as my DataSkin, and 'associated' they two, but it made some sort of sense to keep them all together. -steve ___ 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] Success! Was: Re: [Zope-dev] How is 'retrieveItem intended to work with TTW Specialists? Specialists?
Yes.. I see what you mean... this is a 'whitebox customization' that I used as part of the integration of my framework into the 'online catalog' system. This is not 'blackbox' code that is integral to my system In fact, I mis-spoke earlier, it's not in my specialist at all... it only appears in a method of a ZClass that I use as the 'storage class' for objects controlled by one of my specialists this is clearly whitebox territory, since this wrapper is chosen by the integrator... The first thing my docs (will) say to do.. is go through all my specialists and choose 'storage' classes for each specialist. This brings up another point If I choose 'DataSkin' as a storage class, then my code hits the security system every time a refer to any data (simple types) stored directly in the DataSkin. I can either set __allow_access_to_unprotected_subobjects=1 on each instance, or I can write accessor methods for each attribute, (yuk!, but maybe good in some ways...) or I can ask the integrator to create 'dummy' ZClass(es) even for those racks that they don't want/need to customize (which seems to 'get around' the security system.) I'm curious to know what you folks do here.. do you write accessor methods for every type stored in your DataSkins? Anyway.. thanks for the great tools! I'm having fun now. ;-) -steve "Phillip" == Phillip J Eby [EMAIL PROTECTED] writes: Phillip At 09:15 PM 10/4/00 -0500, Steve Spicklemire wrote: This was also nice since in my Specialist I could do things like: dtml-call "RESPONSE.redirect(this().theRealThing.absolute_url())" After the user is finished working in my 'app area' they could get redirected back to the actual object that my Specialist was 'posing' for... Phillip I don't really recommend the above, unless it's being Phillip done by SkinScript. Otherwise, you're unnecessarily Phillip exposing an implementation attribute (theRealThing). Phillip Instead, require that your object implement a redirect() Phillip method, and define it in the class as Phillip "class_default_for_redirect". Then you can override the Phillip method in SkinScript or with a class extender (a new Phillip 0.4.3 feature). Doing it this way means your framework Phillip code will not incorporate an assumption that your Phillip whitebox specialist is always going to be wrapping Phillip someone else's objects. ___ 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 design questions
OK.. here's the dumbest example I could cook up. It was my first experiment with ZPatterns in July of last summer. It was based on a really early release, I don't remember which, but it seems to work with the latest.. (I just barely testted it... ) Load the Product ToDoProducts.zexp into the products folder first, then the ToDoManager into a folder in Zope. http://www.zope.org/Members/sspickle/DumbZPatternsExample -steve ___ 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 design questions
Ack.. of course I forgot to test creating new instances there was a snippet of code for editing and creating that didn't work with the new propertysheet stuff. I fixed it just now... so it really works. ;-) -steve "Steve" == Steve Spicklemire [EMAIL PROTECTED] writes: Steve OK.. here's the dumbest example I could cook up. It was my Steve first experiment with ZPatterns in July of last summer. It Steve was based on a really early release, I don't remember Steve which, but it seems to work with the latest.. (I just Steve barely testted it... ) Load the Product ToDoProducts.zexp Steve into the products folder first, then the ToDoManager into a Steve folder in Zope. Steve http://www.zope.org/Members/sspickle/DumbZPatternsExample Steve -steve Steve ___ Zope-Dev Steve maillist - [EMAIL PROTECTED] Steve http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Steve posts or HTML encoding! ** (Related lists - Steve http://lists.zope.org/mailman/listinfo/zope-announce Steve http://lists.zope.org/mailman/listinfo/zope ) ___ 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] Thank you very much SteveS for your efforts and the working zpatterns example.
I'd love to bask in the glory of having done something really significant. but just remember... it *is* the Worlds Simplest (some might say Dumbest) example! ;- -steve "James" == James Johnson [EMAIL PROTECTED] writes: James At last some meat AND potatoes for us feely touchy zpattern James people. It opens up a whole new can of worms that I will James take _fishing with me this weekend. Long live Steve James Spicklemire! James Get your Free E-mail at http://tacoma.zzn.com James James Get your own Web-Based E-mail Service at http://www.zzn.com James ___ Zope-Dev James maillist - [EMAIL PROTECTED] James http://lists.zope.org/mailman/listinfo/zope-dev ** No cross James posts or HTML encoding! ** (Related lists - James http://lists.zope.org/mailman/listinfo/zope-announce James http://lists.zope.org/mailman/listinfo/zope ) ___ 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 design questions
We also need to be able to add and delete items from the rack: newToDoForm: -- dtml-var standard_html_header center form action="addNewToDo" method="post" table trtd align=center colspan=2h2Add New ToDo/h2/td/tr trthToDo Name/thtdinput name="name" size=40/td/tr trthToDo Description/thtdtextarea rows=10 cols=40 name="description"/textarea/td/tr trtd align=center colspan=2input type=submit value="OK"/td/tr /table /form /center p /p dtml-var standard_html_footer -- addNewToDo: -- dtml-var standard_html_header center h2 Thanks for the new ToDo!/h2 dtml-let ni="newItem(name)" dtml-call "ni.propertysheets.Basic.manage_changeProperties(description=description)" /dtml-let form action=index_html input type=submit value="OK" /form /center dtml-var standard_html_footer deleteInstances: -- dtml-var standard_html_header h2Deleting Instances/h2 p dtml-in ids dtml-let ni="getItem(_['sequence-item'])" dtml-call "ni.manage_delete()" /dtml-let /dtml-in form action="dtml-URL1;" input type=submit value="OK" /form /p dtml-var standard_html_footer -- That's it. I can't imagine anything simpler. ;-) Really! -steve "Michael" == Michael Bernstein [EMAIL PROTECTED] writes: Michael Steve Spicklemire wrote: Ack.. of course I forgot to test creating new instances there was a snippet of code for editing and creating that didn't work with the new propertysheet stuff. I fixed it just now... so it really works. ;-) Michael I didn't get a chance to play with this today, but I'll Michael make time to do so tomorow. How easy would it be for you Michael to write a step-by-step HowTo/WalkThrough of creating the Michael example? I can edit it and flesh it out if you can write Michael a bare-bones version. Michael Thanks, Michael Michael Bernstein. ___ 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] How is 'retrieveItem intended to work with TTW Specialists?
Thanks again... it's great that you're willing to entertain my apparantly twisted use of ZPatterns. ;-) "PJE" == Phillip J Eby [EMAIL PROTECTED] writes: PJE To put it another way: design your whitebox specialist how PJE you want it. Make it complete, but of course some parts will PJE have to be changed if someone wants to use other than your PJE default implementation. If they want its data to come from PJE somewhere else, they can plug in the SkinScript or do PJE whatever else it takes. PJE So, to sum up... Stop worrying about delegated retrieval! PJE :) You're stepping into app integrator territory here. PJE ZPatterns was designed to make it easy to make reusable PJE frameworks without hardly trying. And it was *especially* PJE designed for retrofitting object frameworks over legacy PJE applications and databases. Hmm... OK I see what you mean. I guess I somehow got the idea that ZPatterns worked best when you had two ZPatterns based frameworks that you wanted to work together *after* they had both been designed. I was looking for a way to 'hook up' two 'finished' applications. I was trying to avoid creating a framework that couldn't be easily integrated, by attemting a 'fake' integration myself. How can I be sure I've got all the TTW stuff organized in a way that an integrator can change unless I actually set it up and test it that way? I'd hate to find out later that someone needs to go in and edit my Python code to make my framework useable But.. I think what I'm hearing is that working out the integration at the Rack level is much better than trying to delgate retrieval at the Specialist level. I'm not sure where I got the idea that delegating retrieval at the Specialist level was the 'right' way, maybe in the Drop Zone example? Anyway... thanks again for your reply. I'll march happily along now and see what I run into next! ;-) (I'm especially grateful for your explaination of using a virtual object (non-persistent) in a Rack. I've not seen that explained so clearly anywhere else.. and I'm going to use it! thanks! -steve ___ 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] How is 'retrieveItem intended to work with TTW Specialists?
Thanks so much for the response... It turns out, I tried the Python Method and it had the same basic problem as the DTML Method... however I've now moved on, using deletageRetrieve to a new thorny issue. ;-) When I get an object from of another specialist it appears that it doies not inherit from my specialist, but from *its* specialist. (e.g., my framework specialist has methods that I want the dataskins to acquire). I've currently got it wrapped like so: def retrieveItem(self, key): """ get an item""" return self.delegateRetrieve(self, None, key=key).__of__(self) I've tried several different combinations of __of__ etc, but none of them seems to allow the dataskin to acquire, for example, standard_html_header from my specialist. Is there any way to enforce acquisition at this level? thanks! -steve "pje" == Phillip J Eby [EMAIL PROTECTED] writes: pje At 08:00 AM 9/25/00 -0500, Steve Spicklemire wrote: So my retrieve item gets called. *unfortunately* it gets called without any namespace parameter... so my retrieveItem DTML method has no way to acquire a namespace so that it can delagate to something else! So... here is what I did... I defined a method in my Python subclass of Specialist.. class MarketItemManager(ZPatterns.Specialists.Specialist): """A Market Item Manager""" # Specify a name for the item type: meta_type='MarketItemManager' def retrieveItem(self, key): """ get an item""" return self.__of__(self).delegateRetrieve(self, None, key=key) Then I made a DTML method called 'delegateRetrieve' like so: dtml-return "myGreatSite.ThingManager.getItem(key)" this way, my integrator can edit 'delegateRetrieve' to point to whatever Specialist he wants to... and I have a Python implementation of retrieveItem. Does this sound OK? Am I working way too hard here? (I feel like I am! ;- ) pje Remember in the code where I have "# XXX DTML check?" That's pje because I was anticipating your problem, but since I didn't pje personally need to do what you're doing yet, I didn't pje implement it. For one thing, I was waiting to see if Zope pje core method binding would get fixed. Unfortunately, I'm not pje sure that Zope method binding is going to be available for pje anything but PythonMethods in 2.3. As of right now, however, pje you should be able to use a PythonMethod for retrieveItem, pje rather than a DTML Method, and it should work. pje In short, even now, delegateRetrieve should not be necessary. pje You should be able to implement retrieveItem using a pje PythonMethod or a DTML Document rather than a DTML Method. pje (I say *should* because I have not tried it personally.) ___ 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] How is 'retrieveItem intended to work with TTW Specialists?
Hello ZPatterns Folk. I'm trying to implement 'delagation' with a custom Specialist. The idea, (I think this is one of the goals of ZPatterns... to allow delegation of responsibility after the Framework is built...) I have: a) MarketItemManager (Python subclass of Specialist) Some of methods, both DTML Methods, and plain old Python Methods, are *meant* to be acquire by the objects (DataSkins) he manages. b) ThingManager (ZClass subclass of Specialist). This is really just a test class that is supposed to represent some later developer integrating my ZPattern based EMarket into their application, (e.g., inventory or whatever...) in MarketItemManager I've defined a 'retrieveItem' (this would really be done by the integrator...) that does something like this: dtml-return "myGreatSite.ThingSpecialist.getItem(key)" with the hope that when the Specialist class gets traversed it will execute: def __bobo_traverse__(self, REQUEST, name): ob = getattr(self, name, _marker) if ob is _marker: ob = self.getItem(name) --- traversal invokes getItem if ob is not None: return ob raise 'NotFound' return ob def getItem(self, key): """Get an item""" if hasattr(self.aq_base,'retrieveItem'): --- getItem invokes retrieveItem return self.retrieveItem(key=key) # XXX need DTML check? for rack in self.rackList: item = rack.__of__(self).getItem(key) if item is not None: return item So my retrieve item gets called. *unfortunately* it gets called without any namespace parameter... so my retrieveItem DTML method has no way to acquire a namespace so that it can delagate to something else! So... here is what I did... I defined a method in my Python subclass of Specialist.. class MarketItemManager(ZPatterns.Specialists.Specialist): """A Market Item Manager""" # Specify a name for the item type: meta_type='MarketItemManager' def retrieveItem(self, key): """ get an item""" return self.__of__(self).delegateRetrieve(self, None, key=key) Then I made a DTML method called 'delegateRetrieve' like so: dtml-return "myGreatSite.ThingManager.getItem(key)" this way, my integrator can edit 'delegateRetrieve' to point to whatever Specialist he wants to... and I have a Python implementation of retrieveItem. Does this sound OK? Am I working way too hard here? (I feel like I am! ;- ) thanks, -steve ___ 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] Re: [Zope-ZEO] Advice
We're using ZCVSMixin for just such a scenario. It's working a lot better than nothing. ;-) It does still have rough edges, and you need to know too much about how it works to do anything complex, but it does allow us to manage changes and test/stage/update etc with a much greater degree of control than we used to have... Of course right now it's unix only... but I should be able to fix that once my current slate of projects are finished. -steve "Andy" == Andy McKay [EMAIL PROTECTED] writes: One of the reasons our group is moving away from Zope is that it has very poor support (if any) for the development/staging/live model. We like this model. We think it's a good thing. But sync'ing code across multiple Zope installations is a royal PITA. I'd like to hear more about the problems you've had and how you overcome them in a different system. And no, versions are *not* the answer. Well, they are a pretty good answer for lots of applications in my experience. Andy Version can work for small changes, but they certainly dont Andy for large numbers of changes across lots of objects. And Andy since the catalog is a key component for our site, its a Andy real problem. Andy ___ Zope-Dev Andy maillist - [EMAIL PROTECTED] Andy http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Andy posts or HTML encoding! ** (Related lists - Andy http://lists.zope.org/mailman/listinfo/zope-announce Andy http://lists.zope.org/mailman/listinfo/zope ) ___ 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.... more thoughts about implimentation of a concrete system...
Er Hmmm wow. I guess I never thought of attribute providers supplying anything other than instance 'data'. I'll have to try that! Thanks for the idea! This would mean that I could map methods onto my objects from any source I like... hoping that the acqusition machinery won't get confused! ... I can see it now... who did you say self was again? ;-) thanks, -steve "Itamar" == Itamar Shtull-Trauring [EMAIL PROTECTED] writes: Itamar Steve Spicklemire wrote: (3) Has anyone found a better way to adorn 'plain' objects with methods? Itamar An AttributeProvider? Itamar -- Itamar S.T. [EMAIL PROTECTED] Fingerprint = D365 7BE8 Itamar B81E 2B18 6534 025E D0E7 92DB E441 411C ___ 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] SkinScript, and family
Hi Bill, I doubt that skinscript is going to help with 'potentially complicated calculations'. Skin Script works with ZPatterns (Specifically DataSkins) to provide control over how attributes of DataSkins are gotten, and stored. They are normally pretty simple "if THIS then THAT" kinds of things (basically a set of one line expressions that handle substitutions that occur under various circumstances... ). It would be a lot easier to answer your question if you could elaborate a bit on the 'get me what I want' part of your query. ;-) The best documentation I've seen yet is an email from pje about the current implementation: http://lists.zope.org/pipermail/zope-dev/2000-July/006201.html Hope that helps... -steve "Bill" == Bill Anderson [EMAIL PROTECTED] writes: Bill OK, I have some potentially complicated calculations to Bill build on a Ticket Tracking system I've built here. I can do Bill it in python mehtods, but am wondering if skinscript will Bill get me what i want as well. If anyone has done dome stuff in Bill skinscript they can share I would be ecstatic. I don't Bill necessarily need a tutorial (but would be happy to review Bill and rate one :), as I can learn fairly well from examples Bill that have an explanation of what the skinscript Bill accomplishes. Bill TIA, Bill Bill -- Bill Anderson (ARC) Unix/Linux System Administrator HPSO Bill Engineering Productivity Team Thursday, September 07, 2000 Bill Random Quote: Never eat anything bigger than your head. Bill ___ Zope-Dev Bill maillist - [EMAIL PROTECTED] Bill http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Bill posts or HTML encoding! ** (Related lists - Bill http://lists.zope.org/mailman/listinfo/zope-announce Bill http://lists.zope.org/mailman/listinfo/zope ) ___ 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: DropZone example
Hi Steve, (and any others who might care to comment) I've been sorting through old ZPatterns email looking for inspiration and I came upon this: "Steve" == Steve Alexander [EMAIL PROTECTED] writes: Steve Hi folks, Steve I've been looking at the DropZone example Phillip Eby Steve provided on the ZPatterns Wiki. Steve http://www.zope.org/Members/pje/Wikis/ZPatterns/DropZoneExample Steve I've decided to start implementing it, so as to give myself Steve an educational experience in using ZPatterns. Did you get very far with this? I'm still working out the best way to get EMarket to work with ZPatterns in my copious spare time, and I've hit a question... in the original EMarket design Shopper, MarketItem, ShoppingBasket, and ShoppingBasketItem were all classes defined in Python. With ZPatterns I'm moving in a direction in which these will be replaced at runtime with customized objects that will merely play the *role* of Shopper, etc... I see how the data associated with these objects can be virtually provided using SkinScript etc... but I'm a little confused about the methods of these objects. PJE makes it very clear in his DropZone example (cited above) that when you allow objects to 'role play', they do not subclass from anything in particular, but rather just sort of 'drop in' and 'act like' any sort of object they need to, in order to get the job done. However, without subclassing... how do they get the Shopper methods? e.g., one EMarket method might be: aShopper.insertIntoShoppingBasket( mi=aMarketItem, quantity=qty ) One idea that occured to me was to make the specialists 'do' everything. ShopperManager.InsertItemIntoShoppersBasket(shopper=aShopper, mi=aMarketItem, quantity=qty), but this smells a little bit like the 'controller' paradigm that Coad et. al. are so opposed to... It seems like 'big brother' for the ShopperManager to be meddling with the individual items in a shopper's basket... but maybe that's the best way... Anyway.. just fiddling around and looking for ideas... thanks! -steve ___ 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: DropZone example
Hi Steve, "Steve" == Steve Alexander [EMAIL PROTECTED] writes: ShopperManager.InsertItemIntoShoppersBasket(shopper=aShopper, mi=aMarketItem, quantity=qty), Steve Seeing as the context is clearly ShopperManger (or Steve Shoppers), I don't think there's any need for such a long Steve method name. The context clearly involves shoppers and Steve baskets, so perhaps AddToBasket(shopper, item, qty) would Steve be clear enough? Yeah.. the long method name was to help clarify the meaning. ;-) Steve If anything, AddToBasket could be a method of MarketItem. Steve Item.addToBasketOf(Shopper). However, if Items live on Steve Shelves in Isles in a Shop, addToBasketOf could be a method Steve of the Shop, that gets found by acquisition from items in Steve the shop. And, perhaps we know who the Shopper is from the Steve AUTHENTICATED_USER of the REQUEST. Again... it seems to me that these objects aren't allowed to have methods, since that would require sub classing and according to my understanding sub classing is sort of a 'deprecated' approach. Maybe I'm missing something... I like your thought about the 'shop' being the best object responsible for handling the shopping baskets.. it's just a different way to slice the problem.. I could get used to it. ;-) thanks, -steve ___ 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] PlugIns.py bug.... (was incorrectly ZPatterns: transaction bug)
OK I think I found the actual intent of aq_base() in _checkId of PlugIns.py: if hasattr(aq_base(self), id): # The object is located in this ObjectManager. if not flags REPLACEABLE: raise 'Bad Request', ('The id "%s" is invalid - ' \ 'it is already in use.' % id) # else the object is replaceable even if the UNIQUE # flag is set. elif flags UNIQUE: raise 'Bad Request', \ ('The id "%s" is reserved.' % id) it comes from the ObjectManager _checkId which has basically the same code execpt it ObjectManager.py also has the needed: from Acquisition import aq_base which PlugIns.py does not.. so looking at Acquisition.c it appears that there is no real difference between hasattr(aq_base(self), id) which calls if (WRAPPER(self)-obj) { r=WRAPPER(self)-obj; while (isWrapper(r) WRAPPER(r)-obj) r=WRAPPER(r)-obj; } else r=Py_None; Py_INCREF(r); return r; and hasattr( self.aq_base, id) which calls case 'b': if (strcmp(name,"base")==0) { if (self-obj) { r=self-obj; while (isWrapper(r) WRAPPER(r)-obj) r=WRAPPER(r)-obj; } else r=Py_None; Py_INCREF(r); return r; } break; Anyway.. it looks like either fix is OK... I guess! -steve "Steve" == Steve Spicklemire [EMAIL PROTECTED] writes: Steve ZPatterns 0.4.2a1 PlugIns.py bug? Steve I get a 'Name Error' aq_base when I hit the following code Steve while trying to update the index_html method of one of my Steve Specialists from CVSMixin.. I think that this would get hit Steve anytime you add an object whose id is already in the Steve acquisition path Steve -steve Steve diff -c -r1.1.1.2 PlugIns.py *** PlugIns.py 2000/09/04 Steve 14:17:29 1.1.1.2 --- PlugIns.py 2000/09/04 18:53:17 Steve *** *** 265,271 # An object by the given Steve id exists either in this # ObjectManager or in the Steve acquisition path. flags = getattr(obj, '__replaceable__', Steve NOT_REPLACEABLE) ! if hasattr(aq_base(self), id): # The Steve object is located in this ObjectManager. if not flags Steve REPLACEABLE: raise 'Bad Request', ('The id "%s" is invalid Steve - ' \ --- 265,271 # An object by the given id exists Steve either in this # ObjectManager or in the acquisition path. Steve flags = getattr(obj, '__replaceable__', NOT_REPLACEABLE) ! Steve if hasattr(self.aq_base, id): # The object is located in Steve this ObjectManager. if not flags REPLACEABLE: raise 'Bad Steve Request', ('The id "%s" is invalid - ' \ Steve ___ Zope-Dev Steve maillist - [EMAIL PROTECTED] Steve http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Steve posts or HTML encoding! ** (Related lists - Steve http://lists.zope.org/mailman/listinfo/zope-announce Steve http://lists.zope.org/mailman/listinfo/zope ) ___ 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: transaction bug
ZPatterns 0.4.2a1 PlugIns.py bug? I get a 'Name Error' aq_base when I hit the following code while trying to update the index_html method of one of my Specialists from CVSMixin.. I think that this would get hit anytime you add an object whose id is already in the acquisition path -steve diff -c -r1.1.1.2 PlugIns.py *** PlugIns.py 2000/09/04 14:17:29 1.1.1.2 --- PlugIns.py 2000/09/04 18:53:17 *** *** 265,271 # An object by the given id exists either in this # ObjectManager or in the acquisition path. flags = getattr(obj, '__replaceable__', NOT_REPLACEABLE) ! if hasattr(aq_base(self), id): # The object is located in this ObjectManager. if not flags REPLACEABLE: raise 'Bad Request', ('The id "%s" is invalid - ' \ --- 265,271 # An object by the given id exists either in this # ObjectManager or in the acquisition path. flags = getattr(obj, '__replaceable__', NOT_REPLACEABLE) ! if hasattr(self.aq_base, id): # The object is located in this ObjectManager. if not flags REPLACEABLE: raise 'Bad Request', ('The id "%s" is invalid - ' \ ___ 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] Porting EMarket to ZPatterns....
Thanks Phillip! OK. that helped a lot. The problem is that when things don't work as I expect.. I guess (usually with a high degree of success) that I am off base. Now I've just been experimenting with this in a simpler 'dtml-only' way just to clarify how it's supposed to work. I created a simple ZClass with no ZClass based propertysheets. (The ZClass is called MyTestSkin, subclass of DataSkin) I created a specialists that manages instances of this ZClass. (The specialist is called myTest) I set up the default rack of myTest with a PlugIn SheetProvider with "SheetNames" set to "ShopperData". Based on your last email the addShopper method in 'myTest' looks like this: dtml-var standard_html_header h2dtml-var title_or_id dtml-var document_title/h2 dtml-let newObj="newItem(REQUEST['id'])" dtml-if "newObj.propertysheets.manage_addPropertySheet(id='ShopperData',ns='')" dtml-let newPPS="newObj.propertysheets.get('ShopperData')" dtml-call "newPPS.manage_addProperty(id='email',type='string',value='')" dtml-call "newPPS.manage_addProperty(id='passwd',type='string',value='')" dtml-call "newPPS.manage_addProperty(id='address',type='string',value='')" dtml-call "newPPS.manage_changeProperties(REQUEST)" New Shopper Added! form action="dtml-var "myTest.absolute_url()"" input type=submit value="OK!" /form /dtml-let dtml-else Cannot add property sheet. /dtml-if /dtml-let dtml-var standard_html_footer It seems to work OK. Now.. the index_html for my ZClass wants to look like this: dtml-var standard_html_header h2dtml-var title_or_id dtml-var document_title/h2 p email: dtml-var "email"br address: dtml-var "address"br /p /dtml-let dtml-var standard_html_footer But I get 'KeyError" on any attribute. I guess I thought that the SheetProvider would kick in when a request was made for 'email' and automagically search the instances propertysheets for an attribute that matched. The following did work however: dtml-var standard_html_header h2dtml-var title_or_id dtml-var document_title/h2 dtml-let myPPS="propertysheets.get('ShopperData')" p email: dtml-var "myPPS.getProperty('email')" address: dtml-var "myPPS.getProperty('address')" /p /dtml-let dtml-var standard_html_footer This doesn't seem quite right to me... when I use a GenericAttributeProvider that talks to a database... I can just say dtml-var foo and it works. I'm sure I'm still not getting something... but I don't know what. I can look at: /myTest/a/propertysheets/ShopperData/manage and it allows me to edit the instance's property sheet through the web.. I was hoping (and maybe this is really really just wrong...) that there was some 'central' propertsheet that could be modified and thereby give all instances new properties.. sorta like ZClass property sheets... Anyway.. I'm now off to try SkinScripts with these test cases... thanks! -steve ___ 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.. Property sheets... once and for all. ;-)
Hi Folks, OK.. I didn't hear much from my last plea for advice... I thought perhaps such a concrete problem would product lots of sage advice... but there's good news: here's another chance! Really Really Basic: If I have a class like so: class Shopper( OFS.SimpleItem.Item, ZPatterns.DataSkins.DataSkin, Acquisition.Implicit, AccessControl.Role.RoleManager, ): """ A Shopper """ # Specify a name for the item type: meta_type='Shopper' and let's say I define some attributes in the class id = 'default' email = '' _passwd = '' Now... let's further say that I want a developer using this class to be able to add propertysheets to instances of this class after I'm finished... to make customized versions of these objects. Also.. perhaps I want to take advantage of the 'automatic' nature of property sheets to provide a usable interface so that users can edit various properties. I was successful in adding a propertysheet using the /specialist/anobject/propertysheets/manage_addPropertySheet?id=foons= technique.. which I'm pretty sure I could also implement programattically. ;-). But when I try: /specialist/anobject/propertysheets/foo/manage I get an attribute error looking for 'a_'. I get the same error when I try: /specialist/anobject/propertysheets/foo/manage_addProperty?id=blahvalue=hhtype=string Any idea what's up with that? But no matter... I can't add 'email' to *any* propertysheet, even those in the ZClass, since it's already used in the class. So do I leave it out of the class and "hope" that someone defines it in some propertysheet somewhere? Do I do lots of: if hassattr(self, 'email') and so on.. in case somehow it didn't get taken care of? I *know* I missing something deep. I'm sure I'll say something dumb enough here soon.. and someone will point out my basic misunderstanding. ;-) thanks! -steve ___ 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.. Property sheets... once and for all. ;-)
Cool! Thanks Steve.. I'll give that a try. I guess the question behind the question though is is this a reasonable way to handle property sheets? Is this how the designers of ZPatterns envision property sheets will be used? I keep getting the feeling that I'm missing a basic 'grokism' of the technology and I keep expecting to get hit over the head with it but I don't. Anyway.. thanks for tracking down the traceback... -steve ___ 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 and Strategies Patterns etc....
Hi Folks, Well.. I never heard any comments about my last question.. so I thought I'd try to frame it differently. I just read Coad's book on Object Models etc.. and I think I pretty well 'grok' it.. at least enough to be mildly dangerous. ;-) I'm implementing a project with ZPatterns and I would like to keep a balance between flexibility and sanity (and of course performance). I've been using 'raw Specialists' to keep the number of new classes down to a bearable number, but I'm beginnnig to thing that Zope would behave itself better if I were to create Product level sub-classes of Specialist instead. I guess I'd just like to 'hear' what folks think about these different strategies: at one end of the spectrum: 1) Use ZClasses and 'out of the box' specialists for 90% of the application. Make ZClass and only where python is *required*, use external methods. at the other end of the spectrum: 10) Use full Python products, possibly subclassed from ZPatterns classes (DataSkin, Specialist etc) and never use ZClasses at all... and there is the middle ground: 5) Use python products for low level logic. Create overriding methods that can be 'dropped in' at the admin interface level, or in a subclass, later to change the behavior (e.g., retrieveItem ). Make ZClass sub- classes so that userinterface can be easily modified later, and so that persistent propertysheets are easy to add... There are problems with each end of this spectrum... 1) There are still limitations on what you can easily do outside of python. PythonMethods are great but they have strict security limitations that make them cumbersome in some cases. When you want to call a method of an object, that is really a 'DTML/Python Method' you need to pass along context so you end up with a lot of: dtml-with FooManager dtml-let theResult="aMethodOfTheFooManager( )" /dtml-let /dtml-with This seems like a lot of monkey-business just to call a method. Also.. nested withs can generate problems with namespace pollution.. and unfortunately performance. 5) Same problems as above when invoking methods that are implemented as DTML/Python Methods.. otherwise.. not too bad.. this is where I'm living at the moment. All my DataSkin classes are structured as: DataSkin -- myBaseClass - zSubClassableWrapper - ZClass My Specialists are just plain old Secialists... (here's the problem.. should they be Python products so that they can have plain Python methods? 10) Everything is defined in Products... harder to integrate into other apps since it's hard to override/change methods without modifying source code on the file system. I can't believe everyone is doing it this way.. but then I con't believe that folks are pushing and popping namespaces all over the place like I seem to in my app Anyway.. thoughts are appreciated. ;-) thanks, -steve ___ 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] hmmm.. wierd permission issues with getPersistentItemIDs()...
Hi Steve, Thanks for the reply. Of course as soon as I reported this, I went away for a couple days and I haven't been able to check the list. It appears that the problem is that the BTreeItems object returned by getPersistentObjectIDs isn't currently allowed as an argument of 'in' by itself since it's not in the 'containerAssertions' dictionary defined in SimpleObjectPolicies.py and it doesn't have the magic property: '__allow_access_to_unprotected_subobjects__'. If you *sort* the BTreeItems object however, the dtml-in tag makes a copy of the items in the BTreeItems object as a simple List, and sorts that rather than destructively attempting to sort the original. The simple list is in containerAssertions, and is therefore allowed. I was wrong about the dtml-var "defaultRack.getPersistentItemIDs()" it's only dtml-in "defaultRack.getPersistentItemIDs()" that seems to cause the problem. The odd thing is that the method 'getPersistentObjectIDs' is correctly included in the definition of __ac_permissions__ in Rack.py, but as you point out, it returns a BTreeItems object that doesn't want to play nice with dtml-in... . Once possible solution would be to add an '__allow_access_to_unprotected_subobjects__' property to the BTreeItems object. I'm not sure who should do that. maybe Rack.py? For now.. I'll just sort the ids. ;-) thanks, -steve "Steve" == Steve Alexander [EMAIL PROTECTED] writes: Steve Steve Spicklemire wrote: Hi ZPatterns folks... ZPatterns-0.4.1snap1 Zope2.2.0-src I have a specialist with a defaultRack storing DataSkin subclassed ZClass instances with only persistent attribute providers. dtml-var "defaultRack.getPersistentItemIDs()" Steve When I call that, I get BTreeItems object at 869a5d8. To Steve get that list of IDs, I use an external method: Steve def get_persistent_ids(self): try: items = Steve self.defaultRack.aq_base.getPersistentItemIDs() return Steve map(lambda x: x, items) Steve except: import sys, traceback, string etype, val, tb = Steve sys.exc_info() Steve sys.stderr.write(string.join(traceback.format_exception(etype, Steve val, tb),'')) del etype, val, tb Steve I've tried something like your code, with no sheetproviders Steve in the rack. I can't reproduce your error. I'm using the Steve method as a Manager. or dtml-in "defaultRack.getPersistentItemIDs()" ... /dtml-in raise AuthorizationFailed dtml-in "defaultRack.getPersistentItemIDs()" sort ... /dtml-in works fine. What did I do now? ;-) Steve Line 318, Rack.py. The method getPersistentItemIDs has no Steve docstring. Is that still significant under the new security Steve model? Steve Does the user you're running the method as have the Steve permission "Access contents information" ? Steve Looks like you may have uncovered a Zope security bug in Steve dtml-in ... sort :-/ Steve How could we test this further? Steve -- Steve Alexander Software Engineer Cat-Box limited Steve http://www.cat-box.net Steve ___ Zope-Dev Steve maillist - [EMAIL PROTECTED] Steve http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Steve posts or HTML encoding! ** (Related lists - Steve http://lists.zope.org/mailman/listinfo/zope-announce Steve http://lists.zope.org/mailman/listinfo/zope ) ___ 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] hmmm.. wierd permission issues with getPersistentItemIDs()...
Hi ZPatterns folks... ZPatterns-0.4.1snap1 Zope2.2.0-src I have a specialist with a defaultRack storing DataSkin subclassed ZClass instances with only persistent attribute providers. dtml-var "defaultRack.getPersistentItemIDs()" or dtml-in "defaultRack.getPersistentItemIDs()" ... /dtml-in raise AuthorizationFailed dtml-in "defaultRack.getPersistentItemIDs()" sort ... /dtml-in works fine. What did I do now? ;-) thanks for any ideas! -steve ___ 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 Question - Talking to a Specialist....
Hmm... this is probably more of a plain Zope question than a ZPatterns question.. but since I'm *using* ZPatterns, I thought I'd check what other folks are doing to implement apps with ZPatterns. I've been creating Specialists with DataSkin subclassed objects in their defaultRacks. The methods of the objects are pretty easy, I can put them in the ZClass, or the Product class that I'm sub-ZClassing from. But since my Specialists are just 'plain' objects I can only make methods of Specialists as 'DTML Methods' or 'Python Methods'. I'd love to call these methods as: dtml-in "TableManager.getAllProductCategories(_.None, _)" but this doesn't work. The current namespace doesn't include any of the queries or other methods that I need to *implement* getAllProductCategories.. so I end up doing: dtml-with TableManager dtml-in "getAllProductCategories(_.None, _)" ... but this seems obtuse when the TableManager needs to talk to the ProductManager or other managers I end up with a *lot* of dtml-with... statements! What are other folks doing? thanks, -steve ___ 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] More comments on ZPatterns
"pje" == Phillip J Eby [EMAIL PROTECTED] writes: a (default) rack of TableInfo objects. Now... some of the Tableinfo properties, and some of the View properties are *really* in MySQL. I figured out, from the mail list and the source code, that I can create a Generic attribute provider in the rack that can get attributes from an SQL database for my DataSkin descendents using the 'source expression' and 'target expression' business. pje Congratulations, you found the top secret documentation. :) That's what I love about working with ZPatterns. You get to play all sorts of "Roles" as a developer... part "James Bond", part "Hercule Poirot", part "Bumbling Imbecile". ;-) I've heard that it's "Roles before Objects" but I had no idea it would be like this! Here's one I've been feeling kinda stupid about: Now, "SkyDiver ... *used as*" means we should: 1. subclass (not a good choice) 2. implement interface 2.1. by copying and pasting methods code (or whole methoids) 2.2. by proxiyng (SkyDiver has a references to actual Customer and ResourceUser) 2.3. by transmitting messages to SkyDiverSpecialist which will pass unhandled messages to CustomerSpecialist and ResourceUserSpecialist (this is a variant of 2.2. case) The 2.3. case means we should use objects without types (identity markers). pje None of the above. SkyDiver should inherit from a Party base class. For pje Customer and ResourceUser behavior, one adds propertysheets whose class is pje provided by the respective frameworks. This is extension through pje *composition*, rather than inheritance. It is similar to the COM approach, pje where you can ask an object to give you a pointer to an interface. In this pje approach, you ask for a propertysheet that provides the interface. "One adds propertysheets" is much easier said than done... IMHO. The only way I've seen to add propertysheets to objects is to call manage_addPropertySheet on individual instances... as described in this earlier email: pje pje This isn't exactly code, but... pje pje Set up a LoginManager with a GenericUserSource, and set up the GUS to have pje users. Make sure that the GUS has a "Persistent Sheet Provider" on the pje "Sheet Providers" tab. Then go to: pje pje /acl_users/someuser/propertysheets/manage_addPropertySheet?id=sheetnamens= pje pje You should get a screen that says "OK". pje pje Then go to: pje pje /acl_users/someuser/propertysheets/sheetname/manage pje pje And you should see a propertysheet editor for your new sheet. pje (Unfortunately, it won't let you edit anything unless your user class is pje based on PropertyManager, due to an oversight in ZPatterns 0.3.0; the pje VirtualSheets class needs "def propertyLabel(self,id): return id" to work pje with the default Zope UI for a non-ZClass property sheet.) pje pje Or go to: pje pje /acl_users/someuser/propertysheets/manage pje pje And you should see your new propertysheet listed on the sheets management pje interface (which is somewhat broken, but that's because the basic one in pje Zope is, it's not ZPatterns' fault. ;) ) pje pje Anyway, this is all very primitive but should get better in later versions. pje 0.4.0 fixes the 0.3.0 and either it or 0.5.0 will replace the broken pje propertysheets/manage screen with one that will let you add/edit/delete pje sheets properly. I just want to make sure I understand... is the intention that property management needs to be done on each instance separately? So if I add a new property to one of my property sheets, I need to somehow update the propertysheets of each of the instances? Also if I need to create propertysheets for each instance... where should that be done? I suppose it makes sense to put that in the Specialist that handles the object that gets the properties?...no? thanks, -steve ___ 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] More comments on ZPatterns
So let's start throwing some brute force hacking at the problem! ;-) From a mail about the LinuxTag conference: P.S. ABout ZPatterns: everyone I spoke to was thought the basic idea behind ZPattern was good and sound and nice and so on. But _everyone_ complained about it being too pretentious (with all the computer science claims and theory behind it) and introducing too many unnecessary new concepts (racks, specialist and what have you). All this is very distracting. I for one can't get my head around it. But that seems to be what you're saying as well. Seriously, I'm trying to get it all figured out, and I thought maybe if I attempted to do something 'real' with it I would at least learn what I *don't* understand. Well.. I've learned a *lot*! (about what I don't understand.. ) ;-) The source code is astonishingly simple looking, but about one layer deeper that I can easily grok, apparently. I have a site that displays data from a database. Customers want to include this data on their web site, say as an included 'frame'. Each customer wants a slightly different slice of the data, and of course they want it all dressed up in the correct 'look' so that it appears seamlessly integrated. I create a "View" ZClass, subclass of DataSkin, that looks at the data with the perspective if a customer. It should keep track of all the information about how a particular site wants the results to look, and what data is interesting. I make a PropertySheet in my ZClass called 'Basic', in which I keep the basic properties I need to track the necessary information. To go along with this, I create an instance of a Specialist called "viewManager" who has a (default) rack of "View" objects. I also create a "TableInfo" ZClass, subclass of DataSkin, that quantifies the kind of data the customers have to choose from, and metadata about the data (headers, query parameters and suchlike). I create a ZClass property sheet for the TableInfo ZClass. Finally I create an instance of Specialist (tableManager) with a (default) rack of TableInfo objects. Now... some of the Tableinfo properties, and some of the View properties are *really* in MySQL. I figured out, from the mail list and the source code, that I can create a Generic attribute provider in the rack that can get attributes from an SQL database for my DataSkin descendents using the 'source expression' and 'target expression' business. e.g., Source expression: (GetTableInfo(tableInfoID=self.id) or [NOT_FOUND])[0] Target expressions: tableHeaders=RESULT.tableHeaders footnote=RESULT.footnote and when I ask one of my TableInfo instances for their footnote it comes right out of MySQL! Cool. Now.. I can't seem to figure out how to *change* the data in the database when the user 'edits' the DataSkin which brings up the whole issue of changing stuff in DataSkins. Even when I can figure out *a* way to make it work.. I'm almost sure it's not *the* way it should work. The problem I'm having is that I feel that some of my code is violating Demeter... and it makes me think that I'm still missing some really fundamental insight... For example: My tableManagerr has a method like this, the "addNewTableInfo" method: dtml-var standard_html_header center h2 Inserting new Data Table Info Item!/h2 dtml-let ni="newItem(name)" nips="ni.propertysheets.get('Basic')" dtml-call "nips.manage_changeProperties(REQUEST)" /dtml-let form action=index_html input type=submit value="OK" /form /center dtml-var standard_html_footer Now... I thought that stuff like: nips="ni.propertysheets.get('Basic')" was a "nono" on Demeter grounds... I *should* be able to say simply: ni.setAllTheRightThings(REQUEST) But I can't seem to find that method in the source. ;-) Or is it that Specialists are allowed to have special 'inside' knowledge about the objects they specialize in, since they are, after all, specialists! Also.. I've gotten the habit of adding methods to my ZClasses that edit themselves: editInstance: dtml-var standard_html_header center dtml-call "propertysheets.get('Basic').manage_changeProperties(REQUEST=REQUEST)" Table Info Changed.br form action="dtml-URL2;" input type=submit value="OK" /form /center dtml-var standard_html_footer But this won't work now... since I could add another propertysheet in the Specialist. Should the specialist call manage_changeProperties on all the propertysheets? (including any defined in the ZClass) Is there some method hidden somewhere that does this? Anyway.. this is what I'm working on at the moment... Any insight appreciated... since I seem to be having a shortage. ;-) -steve ___ 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] EMarket and 2.2.0b3
Hi David, I think the design is flawed from the outset and should be changed. Basically I was trying to have my cake and eat it too with this one... and the solution (iterating through the folder class's manage_options and slapping on my own was goofy anyway...) but there's really no need. I'm moving MarketItem to a ZClassable object anyway where this can by much more simply done with 'Views'. The thing I haven't figured out is how to make the MarketItem ZClasses available only inside a MarketItemsFolder. I'm thinking I may have to make ZClasses for everything, but define the 'enclosed' ZClasses inside the enclosing ZClasses. Also.. ZPatterns may affect this as well. I'm looking into making all these things 'DataSkins' so that the actual instance data can be kept in a very flexible way, but in ZODB by default. ZPatterns looks really cool.. I feel sometimes like a kid looking at a magic trick... sure that once I really get into it I'll understand, but somehow not sure that it might *really* just be magic after all. ;-) -steve "RDM" == R David Murray [EMAIL PROTECTED] writes: RDM On Fri, 30 Jun 2000, R. David Murray wrote: Darn, I should have done more testing. I only fixed the prompt for permissions problem. manage_workspace still goes to the import/export screen...back to the testing. RDM Arg, it's worse than I thought. My original test was broken. RDM I haven't found the problem at all. So please ignore all my RDM recent posts about this and I'll crawl back under my rock and RDM do some more careful testing. RDM --RDM ___ 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] FWIW, ZCVSMixin now at 0.1.1... and rising. ;-)
Hi Jim, et. al... Steve and Shane, We've been positively *dying* to have cvs or cvs-like functionality. It's one of those things where we left the unix-everything-is-a-file-idiom and went, "Oh, um, heh, now what?" =) Well.. I don't know much about cosource but I did just put the latest version on zope.org, with Shane's patches, and incorporating some of his UI suggestions. (as much as I could get done in a few hours...) I'm kinda strapped for time right now.. since I'm working on active, deadline oriented projects and all.. of course all contributions welcome! This latest for example just saved me lots of time, since I was about to do the same thing Shane did in a much less elegant way... Thanks again Shane! For what it's worth, we needed this so badly in my project that I was pretty much forced to implement it, anyway I could! We are using now... and it's working pretty well for us. You have to 'understand' too much about what's going on for my taste but it's getting better. -steve ___ 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] EMarket and 2.2.0b3
I'm sure a lot of this is because EMarket was a 1.x product that has seen relatively little change, in basic structure, since. I'm working on some patched to allow (1) ZClasses to act as MarketItems and Shoppers and (2) ZPatterns integration so that most objects can be optionally stored in RDBM or ZODB. .. I'll go ahead and checkin my ZClass stuff. I'm not running 2.2x much, since I'm really busy on other development... but I can at least see if the product installs! ;-) -steve "RDM" == R David Murray [EMAIL PROTECTED] writes: RDM OK, so I didn't get very far in tracking down what inside RDM EMarket is triggering the wierd auth behavior, because I had RDM to run a bunch of tests against b3, where the behavior has RDM changed from that of b2. RDM For this testing my method of determining if "things are RDM weird" is to see if I get prompted for authentication if I RDM access the "/manage_main" URL. Weird means I don't get RDM prompted. RDM Under b2, installing EMarket with a dummy empty __init__.py RDM file caused the weird behavour. Under b3, that test does RDM not. However, the EMarket __init__.py file with any of the RDM imports for the submodules uncommented *does* cause the weird RDM behavior. Farther than that I haven't gotten yet. RDM My tests give me some other interesting things to report, RDM however. After installing b3, I confirm that the site is RDM working and I can view the root index_html file normally. If RDM I then copy my test Data.fs from the b2 installation, the b3 RDM instance fails to show the root index_html, giving an error RDM message of a key error on URL on the last line of traverse in RDM BaseRequest.py. Now here's the weird thing: if I then RDM *delete* the Data.fs file, and restart Zope, *I continue to RDM get that same error*. I didn't try to track that any RDM further, but it unnerves me. RDM Second, the patch, supplied by someone else, that I reposted RDM here that fixed the "a_" KeyError after EMarket was installed RDM in b2, if applied to b3 *causes* that "a_" error to appear. RDM Since this patch was reportedly added to the CVS, I think RDM there is something here that needs to get cleared up before RDM 2.2 final. RDM I'll work on this some more tomorrow, but so far I'm nowhere RDM near finding what code might be involved in this set of RDM errors. RDM Has anyone seen the aforementioned "weird problem" with any RDM products other than EMarket and eTailor? RDM --RDM RDM ___ Zope-Dev RDM maillist - [EMAIL PROTECTED] RDM http://lists.zope.org/mailman/listinfo/zope-dev ** No cross RDM posts or HTML encoding! ** (Related lists - RDM http://lists.zope.org/mailman/listinfo/zope-announce RDM http://lists.zope.org/mailman/listinfo/zope ) ___ 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] Zope ...2.1.7 update - patch for EMarket 0.1.03
Hi Adam, I looked at your patch... *** EMarket.py.orig Thu Jun 01 00:06:01 2000 --- EMarket.py Fri Jun 16 02:56:35 2000 *** *** 258,265 newMainF.transactionFolder = newTransF Products.MailHost.MailHost.add(newMainF, 'eMarketMailhost', !smtp_host = smtp_host, !localhost = localhost) theMailHost = getattr(newMainF,'eMarketMailhost') ### TODO... change documents that send mail to be proxies for Manager --- 258,264 newMainF.transactionFolder = newTransF Products.MailHost.MailHost.add(newMainF, 'eMarketMailhost', !smtp_host = smtp_host) theMailHost = getattr(newMainF,'eMarketMailhost') ### TODO... change documents that send mail to be proxies for Manager Looking at the source, it's not clear what was broken by the localhost line in the factory. so what was the error that prompted the patch? thanks! -steve ___ 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] ZCVS Mixin class... feedback sought.
Hi Jonothan, Thanks for the thoughts "Jonothan" == Jonothan Farr [EMAIL PROTECTED] writes: Good questions! You can just go to the 'admin' tab and type 'diff'. The admin tab lets you execute just about any cvs command with arguments stat, rtag etc etc. Jonothan Doing a diff on a zexp file isn't going to be very Jonothan helpful, though. Any thoughts on integrating some sort Jonothan of xml diff tool? Not as bad as you might think... http://cvs.spvi.com/cgi-bin/viewcvs.cgi/zopeObjs/testCVS/foobie.xml.diff?r1=texttr1=1.1r2=texttr2=1.2diff_format=h having said that and xml diff tool would be cool as well. I know little/nothing about what's out there. The other problem is that Zope appears to choose id values for pickles embedded in these xml files that are essentially random. I don't know enough about the implementation (time to look?) to know why they choose the ids they choose... but it would be nice for this reason if they were always, (usually), consistent. You also get things like this: http://cvs.spvi.com/cgi-bin/viewcvs.cgi/zopeObjs/testCVS/foo.xml.diff?r1=texttr1=1.4r2=texttr2=1.5diff_format=h Conflicts.. uh... bad news. ;-) I think it's essentially impossible to 'merge' two different versions of a zope object... so my plan would be to pick one version, or the other. I forgot to mention that you have all the power of CVS to handle the notion of 'watching' and 'editing'. I'm not a cvs expert.. but I think there are some cvs features that can help here... Login and logout are handled when you set up the directory on the filesystem. Basically you need to 'checkout' a module (maybe an empty module) into a directory on the filesystem before you can use it to keep the xml representations of your Zope objects. That checkout, might, or might not, require a login, depending on your CVSROOT. You must 'be' the zope user (the same user that the zope process runs as) when you checkout the module, so that zope can manage the contents. Jonothan So essentially all checkins are by the same cvs user, so Jonothan you lose the ability to track accountability? I'd like Jonothan to see something that was on a per-user basis, maybe Jonothan tied to the zope user, maybe not. No.. that's not quite right. CVS has several ways to handle the concept of 'ownership'. If you are using pserver authentication for example, you can be user x, but authenticate with cvs as user y. So, to make this work Joe would have his branch and mary could have her branch in different ZCVSMixin folders within the same zope instance. However, for development I think it's probably not uncommon that individual zope developers might have their own zope instance. With a ZCVS Mixin folder they could work on completely seprarate instances and still stay 'synced', much the same way developers use cvs to stay synced with 'c' code now. Jonothan There's been a ton of talk about a zope cvs Jonothan product. I've been thinking about giving it a shot for a Jonothan while now. I'm excited to see someone actually doing Jonothan something about it. I'd be glad to help out however I Jonothan can. Especially since now you've taken the killer Jonothan name. ;) I haven't heard much of the talk, since I have been too busy to keep up with the list, but I am interested in ideas. Also.. I'm 72% sure that someone else can come up with a much better name! ;-) thanks, -steve Jonothan --jfarr ___ 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] FWIW, ZCVSMixin now at 0.0.2... and rising. ;-)
Hi Michael, I need to put some verbage in the README about setting up the workspace on the filesystem to work with ZCVSMixin. No time like the present! ;-) Before you begin, you need to set up a cvs repository somewhere. This is described pretty well in the cvs reference: http://www.loria.fr/cgi-bin/molli/wilma.cgi/doc.847210383.html After that is done and you set your CVSROOT environment variable to match that repository, you can setup your module for zope objects... Basically you must first become the same user that runs as the zope process. If this is a totally new project you will need to create a module in cvs. I usually do this with 'cvs import'.. like this: -- mkdir foo cd foo cvs import -m "start new project" zopeObjs/foo steve start No conflicts created by this import -- Now, go to the place on your filesystem where you want to keep your 'live' zope objects. This might be called your active workspace. I might do it like this: mkdir workspace cd workspace cvs co zopeObjs/foo cvs checkout: Updating zopeObjs/foo cd zopeObjs/foo pwd /usr/home/steve/workspace/zopeObjs/foo this is the path you would enter in the ZCVS Folder as the 'fsdir' parameter. Now you can manage the contents of this folder in Zope, or on the command line. The Zope stuff doesn't handle subdirectories at the moment.. we can add that as soon as we have a sane way of making that work! ;-) Good Luck! -steve "Michael" == Michael Bernstein [EMAIL PROTECTED] writes: Michael Steve Spicklemire wrote: I've not heard any comments about the usefulness of this concept... am I barking up the wrong tree to get version control of zope objects? Does someone know of a better way? Michael Steve, this has been my fondest hope for about three Michael months now. Now, if I could also get it to do Michael through-the-web XML (DocBook) editing and rendering, I'd Michael have a complete end-to-end document management Michael system. Particularly if it preserved accountability, like Michael Jonothan was mentioning. Michael I'll be testing this tommorow, and doing my best to get Michael this to do unnatural things with XMLWidgets and Michael DocBookDocument. Michael Many thanks, Michael Michael Bernstein. ___ 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] ZCVS Mixin class... feedback sought.
Hi Chris, The basic idea is that you can export individual zope objects in a container to the filesystem, not to the 'var' directory, but to a directory under CVS control. Then you can commit, update, add, remove etc files (each of which is the xml representation of a zope object) and keep track of what's what. The only commands available zope right now are 'add' 'commit' and 'update'. You can of course use CVS in the normal way. -steve "Chris" == Chris Withers [EMAIL PROTECTED] writes: Chris Steve Spicklemire wrote: http://www.zope.org/Members/sspickle/ZCVSMixin Chris Sounds like a cool idea, but I don't really understand what Chris it does and how you use it. Chris Could you give use some enlightenment? Chris cheers, Chris 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 )