Re: [Zope-dev] LoginManager ownership bug!
Cheers! I actually tried to implement support for local roles in almost exactly the same way as you did, but for some reason I didn't get it to work. Perhaps I should look into the matter again... I just threw in the user_names(), and getUserNames() into the LoginManager, added some dtml to handle SQL and... it didn't work, so I dropped it... ;-) I'll try to come up with some nice way to handle local roles in a proper way in the LoginManager, and hope that I get my patches accepted :-) Do you have any clue about the ownership bug in the LoginManager? I find it quite strange that an unowned object becomes owned whenever Zope is restarted (or when a method is added...). I suspect that the problem is within the ZPatterns modules, since it handles the persistance of the LoginManager... This is how the LoginManager is inited and ownership is set: ob=LoginManager() ob._owner=UnownableOwner self._setObject('acl_users', ob) I tried to make _owner a global attribute of the LoginManager, but that didn't solve the problem. I have also written Ty Sarna, but I have not received any response yet. One more thing... I'm new to PythonMethods, and I would like to know how to get access to the self attirbute (or the DTML namespace if you like) from PythonMethods. I would like to use PythonMethods more, beacuse dtml quickly becomes unreadable and ugly, and Python is always beautiful :-) Have a nice day, .jonas. On Thu, Oct 05, 2000 at 08:11:45AM -0700, Michael Bernstein wrote: Jonas Juselius wrote: Another thing which I have tried to do, is to add support for local roles to the LoginManager. At first it looked rather simple, but then I realized that it wasn't really _that_ simple, and dropped it because I don't have time... It would however be nice to have local roles support in the LoginManager, as it would make it more complete. I am currently using Zope-2.2.1 (and Zope-2.2.2), ZPatterns-0-4-2a1 and LoginManager-0_8_7a1. I used Membership 0.7.6 on top of what you've got, and added support for local roles as detailed in this posting: http://lists.zope.org/pipermail/zope-dev/2000-September/007030.html This ought to give you the clues you need to add the neccessary getUserNames method to a SQL User Source, and make the LoginManager user_names modification as well. If you have any ideas on how to generalize the user_names method, I'd like to hear them. Let me know how it goes, Michael Bernstein. -- And what is good, Phaedrus, And what is not--- Need we ask anyone to tell us these things? [ PGP public key: http://www.iki.fi/jonas/pubkey.asc ] ___ 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] Removing uninstalled Prods from ZODB?
Hola, I would like to know how to remove removed Products from the ZODB. This might sound silly, but I tried out POPMail and the PTK-0.8, then I uninstalled them and removed all the files. After I restarted Zope everything looked fine, no trace of the Products in the Control Panel Products list. However, I still have 'Advanced' tabs from the PTK in some management screens, and the POPMail has left some base classes for ZClasses. As a result of the POPMail garbage, I'm not able to add any new ZClasses to the system because: Error Type: Could not load oid Error Value: None In the debug output I find that something related to POPMail is screwing up my system... Can anybody tell me how to get rid of all this half uninstalled Products (other than exporting all my objects and re-importing them into a clean ZODB)? Perhaps an uninstall API for Products would be a good idea... something like def unititalize(context): context.unregisterClass() in __init__.py, that gets called when a Product is removed from the Product Management screens... cheers, .jonas. -- And what is good, Phaedrus, And what is not--- Need we ask anyone to tell us these things? [ PGP public key: http://www.iki.fi/jonas/pubkey.asc ] ___ 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] automatical login procedure
Hi, now I know how to generate a user in the acl_user folder via dtml-var "acl_users.manage_users('Add',REQUEST,RESPONSE)" Now, how to login a user automatically via DTML? Thanks to all readers and perhaps writers :-) ___ 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] ToDoManager exampleworks for me on NT/win98
I'm using Zope 2.2.2 and ZPatterns-0-4-2a2(3). Now I'm REALLY looking forward to ZPatterns-0-4-3 ;-) I can't wait until this weekend. Get your Free E-mail at http://tacoma.zzn.com Get your own Web-Based E-mail Service at http://www.zzn.com ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
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] cookies ie5.5 win
On Thu, 5 Oct 2000, Chris Withers wrote: Sebastian Luehnsdorf wrote: i'm having a strange problem with cookie based user authentication with ms internet explorer 5.5 on windows. it seems that the browser (but only this version and only under windows!) seems to "forget" its cookies, which results in an immediate logout. does anybody have similar experiences or a even solution? I've had this problem occasionally with other versions of IE. I wonder whether you're setting the path on cookies correctly? That's all I can think of... Anyone else noticed this? cheers, Chris well, i am using the following bit of code: RESPONSE.setCookie('__ac', token, path='/', expires='0') where token is a valid authentication id (i could check that). when i tried to set the domain to anything (empty string, hostname with without port, ip address with without port), all browsers had problems with the authentication... ciao, basti -- sebastian f. luehnsdorf beehive elektronische medien gmbh -- http://basti.beehive.de http://www.beehive.de mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.zope.de fon: (+49 30) 84 78 20 http://www.i-surf.defax: (+49 30) 84 78 22 99 ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Zope static html
Yours is the third enquiry I've had about this in the past week !!! You can do this in a very general way using wget which is freely available and very configurable. Another option is to look at ZMirror in http://www.zope.org/Members/rossl/ZMirror - not because it will solve all your problems, but because the code is certainly a useful starting point. Turns out that it's a non-trivial task to do this in completely general way. I now tend to write very specific external methods based on the code in zmirror. good luck. Vijay Pawar wrote: Hi, I saw your discussion article enclosed below: Do you have a Zope external method/ Python code to create static html from Zope. Any help is much appreciated. Thanks, Vijay [Zope] ANN: Experimental zope-static html mirror external method Dr. Ross Lazarus [EMAIL PROTECTED] Sat, 05 Jun 1999 22:35:04 +1000 Previous message: [Zope] Changing default new document contents Next message: [Zope] A single value from SQL Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] Anyone needing to write a static html rendition of a zope site to a file system is welcome to try a very rough pre-alpha external method. fileme.py and fileme.txt are available via anonymous ftp at rossl.gmp.usyd.edu.au - or ftp://rossl.gmp.usyd.edu.au/ if you need to use a web browser. A more stable product will eventually appear. Please only try this release if you like to live dangerouslywget is safer and can probably do a better job. Bug reports, fixes and constructive comments to [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope-ZEO] How to get rid of the cPickle and asyncore dependencyhassleshassles
Toby Dickenson wrote: [cc to zope-dev.] Ive been using Zope only with Python 2.0 recently. That's great to hear. I'm frankly a bit surprised that this works. 2.0 is a suprisingly conservative upgrade from 1.5.2 Did you have to make many changes to Zope? All my critical patches are already merged into the Zope cvs, or the Python cvs ;-) There are also some non-critical bug fixes related to Unicode awareness, bundled up with my other Unicode-In-Zope patches at http://www.zope.org/Members/htrd/wstring. These mostly relate to the fact that Zope does not defend against objects that raise exceptions when converted to a string using str() - and Unicode objects do this frequently. (At the moment these extra patches are not 1.5.2 compatible... Ill work on this if DC feel the need for a transition period during which Zope supports both 1.5.2 and 2.0.) I heard that ExtensionClass didn't work with Python 2.0. It looks like a little work is needed to support 2.0's garbage collection of cyclic trash - but thats not enabled by default. Apart from that, everything works very well. (In some ways, better than 1.5.2) Wow! That's swesome. I'll get back to you on some of this. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! Technical Director (888) 344-4332http://www.python.org Digital Creationshttp://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats. ___ 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: Python 2.0; Garbage Collection
[Toby] It looks like a little work is needed to support 2.0's garbage collection of cyclic trash [Neil] Which 2.0 are you using? I was basing my comments on my last attempt in mid July. Ive just tried enabling WITH_CYCLE_GC again (and with the patch below) and it does all seem to be working happily. Ill make further tests next week. Index: z2.py === RCS file: /home/cvs/development/external/Zope2/z2.py,v retrieving revision 1.4 retrieving revision 1.7 diff -c -4 -r1.4 -r1.7 *** *** 430,443 if v=='-': v='' DNS_IP=v elif o=='-u': UID=v elif o=='-D': os.environ['Z_DEBUG_MODE']='1' DEBUG=1 elif o=='-S': sys.ZMANAGED=1 elif o=='-X': --- 429,448 if v=='-': v='' DNS_IP=v elif o=='-u': UID=v elif o=='-D': + try: + import gc + except ImportError: + pass + else: + gc.set_debug(gc.DEBUG_LEAK) os.environ['Z_DEBUG_MODE']='1' DEBUG=1 elif o=='-S': sys.ZMANAGED=1 elif o=='-X': Toby Dickenson [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] ZSQL returns integer only
The Oracle8i recordset I'm retrieving includes a few columns which are NUMBER(10,0) format which are milliseconds. I would like to divide each by 1000 and use the ROUND function to return a result with one decimal place, e.g. ROUND(column1/1000, 1) returns 3.1 where column1 == 3080. This works as expected in SQL*Plus. It returns the results as a number formated to one decimal place. ZSQL however returns only an integer. Any suggestions on how to get the decimal places to show? -Walter ___ 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] LoginManager ownership bug!
At 04:01 PM 10/6/00 +, Ty Sarna wrote: I think this is due to Shane's fix for allowing LM's as non-top-level acl_users. I had it originally so that _owner was a class attribute, which works fine. With the change, it was added as an instance attribute. Now, UnownableOwner is just an empty list, []. Zope checks for UnownableOwner using an identity check, that is in python: "_owner is UnownableOwner". When the LM is pickled to ZODB and reloaded, _owner is still an empty list, but it's not *the* empty list. That is, in python terms: it's still *equal* to UO, but it isn't "is" UO. We could go back to just having it as a class attribute, but then that breaks when adding a LM anywhere other than the top folder, because Zope wants to delete the _owner from it. Actually, Ty, AFAIK this is now fixed in Zope 2.2.x; IIRC Brian made some changes to the ownership machinery to deal with _owner being a class variable. We should probably put out a new LM release to go with ZPatterns 0.4.3. ___ 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] ZSQL returns integer only
On 10/6/00 12:19 PM, "Walter Miller" [EMAIL PROTECTED] wrote: The Oracle8i recordset I'm retrieving includes a few columns which are NUMBER(10,0) format which are milliseconds. I would like to divide each by 1000 and use the ROUND function to return a result with one decimal place, e.g. ROUND(column1/1000, 1) returns 3.1 where column1 == 3080. This works as expected in SQL*Plus. It returns the results as a number formated to one decimal place. ZSQL however returns only an integer. Any suggestions on how to get the decimal places to show? Please make sure you're using the latest Oracle DA, as there was a bug in handling of things that oracle returns as NUMBER(0,0) (which is basically a floating point, but we interpreted as a numberb ecause the scale was 0). Chris -- | Christopher Petrilli Digital Creations | [EMAIL PROTECTED]Where Zope comes from ___ 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] Locking (supercedes original writelocking proposal)
This supercedes the original WriteLocking proposal which was initially just to cover WebDAV's current write locking ability. http://dev.zope.org/Wikis/DevSite/Proposals/WriteLocking -- Jeffrey P Shell, [EMAIL PROTECTED] http://www.zope.org/ .oO ___ 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] Is this a ZClass/Propertysheet bug?
Is this behavior correct? See http://www.zope.org/Members/paulabrams/howto_deleteundeadzclassprops for help. It is not a bug per se, Python (upon which ZOPE is based) is built this way, i.e. if you create a class with certain attributes, every instance will keep those attributes, even if they are deleted from the class itself, and new instances that are instansiated from the now modified class will not. -Morten ___ 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] Is this a ZClass/Propertysheet bug?
On Fri, 6 Oct 2000, Morten W. Petersen wrote: It is not a bug per se, Python (upon which ZOPE is based) is built this way, i.e. if you create a class with certain attributes, every instance will keep those attributes, even if they are deleted from the class itself, and new instances that are instansiated from the now modified class will not. Context got mixed up, please disregard. -Morten ___ 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
Steve Spicklemire wrote: 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'. Ok, I just got through stepping through the walkthrough. Thanks! That *was* a really simple example. Perfect! I had a few comments: - You skipped over creating the Product in the Products folder. - Propertysheets: You don't expressly say that Shared needs to be a 'Common Instance Property Sheet'. - ToDoManager: I was initially confused as to where this needed to be created. I tried placing it directly in the Product as well as in the ZCLass before I tried placing it in a normal folder. Ok, moving forward, I had some questions about this approach to building applications: - What do I need to do to let users add ToDoManagers to their own folders without creating them from scratch? In other words, How do I turn ToDoManager into a product? - The term 'Specialist' implies (at least to me) that this object is overiding/replacing a 'Generalist' somewhere, but this does not seem to be the case here. Am I missing something? - 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? - How does this product (simple though it is) exemplify the RIPP approach? In other words, assume I'm asking annoying whiny two-year-old 'why?' questions after every declarative statement in the tutorial. Anyway, I'll try to synthesize all of the replies I get (if any) into a beginners 'Zen of ZPatterns' tutorial. Thanks again for such a simple example! 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] Re: Zpatterns design questions
At 10:09 AM 10/5/00 -0700, James Johnson wrote: I heard that it's possible to have a dtml only zpatterns based example. I would like something like Product specialist addObj Zclass index_html readObj Factory Permission Would this be a correct way to proceed? Yes, except that the Factory and Permission would not be required, and the Specialist would belong in a folder, not in the Product. ___ 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
At 07:59 AM 10/5/00 -0700, Michael Bernstein wrote: "Phillip J. Eby" wrote: Domain logic: methods which implement the basic behavior of an object, by manipulating its attributes and by calling methods on itself or other objects. (Including delegation to a Specialist, its own or another.) Presentation logic: "view" methods which implement user interface by displaying object attributes and/or the results of either presentation or domain methods, and "controller/view" methods which call domain logic methods and display results. Implementation logic: All of the code and objects contained in a Specialist which map between the domain model of an object and its physical storage implementation(s). This category can be further subdivided into data management implementation, and UI implementation. DM implementation deals with storing and retrieving objects and associated data, and firing off of implementation rules (e.g. ensure that all objects which meet such-and-such criteria are cataloged in catalog Foo). UI implementation deals with providing snippets suitable for use by collaborating classes and/or specialists. For example, [snip] How (and why) do you distinguish between UI implementation and presentation logic? Presentation logic lives with an object's class, and deals with what that object knows about presenting itself. UI implementation is "glue" presentation that lives in a Specialist for use by any object that needs to present UI related to objects of the kind the Specialist handles. The terms used here are "official" terminology with precise definitions, btw. I am just trying to answer your questions as best I know how. An example of presentation logic would be a method which displays a form to perform some action on the object. E.g., let's say we have a "Task" object with an "Assign To" form. Tasks are assigned to Assignees, but in a given application, there could be many possible kinds of Assignees and the means of selecting an Assignee is context-dependent. Thus, a Task's presentation logic cannot implement such a thing directly; it must ask the Assignees specialist for a code snippet (UI implementation) that displays an assignee selection sub-form within its "Assign To" form. As a counter-example to the above, consider Zope's local roles UI. When you assign local roles, Zope goes to the specialist "acl_users" and asks it for all possible users, then displays them in a dropdown list. While we could do the same thing in our Task/Assignees example (i.e. have Task just display a dropdown list of all Assignees), this is bad because it does not scale well. What if our Task object is used for a company intranet where there are 10,000 employees? What if assignees can be either employees or outside vendors, and they are looked up differently? The Assignees specialist is responsible for providing an appropriate UI implementation (hence the name) for this operation. It could provide a dropdown list, a type-in box with a button to pop up a search window that lets you search the employee directory, or any number of other possible implementations that would get the necessary data back to the assignment method once the form was submitted. We could include a simple implementation with our task management framework, and the application integrator would override it if needed for their situation. This is what UI implementation logic is for, and it's an important part of the rationale for the existence of Specialists (formerly known as Implementors). Our current practice is to place both domain and presentation logic in ZClasses, [snip] Do domain and presentation logic methods go into the *same* ZClass, or separate ones (I realize that this may be a stupid question)? Same one. We assume that it is more useful/important for a framework to offer ready-to-use classes than lots of mixins. dropping down to ExternalMethods or Python bases for the ZClasses when domain logic requires things you can't do in DTML or PythonMethods. Domain and presentation logic are kept to seperate methods, so that domain logic methods can be re-used for XML-RPC or other programmatic interfaces. Presentation is usually done in a flexible way, relying upon UI implementation hooks where sensible. (Since objects under a specialist acquire from the specialist, it's easy to hook to a specialist-level utility method.) I understood what you were saying until the parentheses. Could you repeat that part in a different way? Objects retrieved from a Specialist (in general) have the Specialist as their aq_parent. This means that if an object wants to use UI implementation snippets from its own Specialist, it can do so without having to explicitly name the specialist. This is useful for two kinds of snippets: 1) lookup snippets as described earlier, and 2) configuration snippets, ala standard_html_header, which can be used to customize the look of the presentation logic. We have not yet
Re: [Zope-dev] Accessors for DataSkin attributes (was Re: [Zope-dev] Success!
At 02:24 PM 10/5/00 -0500, Steve Spicklemire wrote: You're not using propertysheet providers, but DataSkin propertysheets 'installed' in a ZClass that directly inherits from DataSkin. Your use of the "Data Skin Attribute Property Sheets" is primarily to associate permissions with groupings of attributes, and to simplify establishment and management of those properties through the ZClass administrative interface. As a bonus, you get 'free' methods needed to adjust these attributes from DTML (i.e., manage_changeProperties) without requiring custom PropertyHandlers. Yes. I did notice that when I create a ZClass (in a completely different project) that inherits from a Python Product (registered with registerBaseClass) that inherits from DataSkin, I don't get the option of a DataSkin propertysheet, in the 'common' container of the ZClass, so there's probably some manual fiddling I need to do when I register my ZClass base class that I'm not doing... A simple way to avoid this is to simply create the ZClass subclassed from DataSkin *and* your Python class. I'm guessing that the code that defines the SkinZISS, SZHolder, and _ZClass_for_DataSkin culminating in registerZClass perform the necessary magic to make that happen Yes. If you want to make this work on a Python class, you need to do something like: class _ZClass_for_MyClass(_ZClass_for_DataSkin): _zclass_ = MyClass And then in your registration, call: context.registerZClass(_ZClass_for_MyClass) That should be it. This is deep magic! Aye. Here there be dragons. :) Wait'll you see the magic I had to do in 0.4.3 to get ZClass PlugIns and PlugInContainers to work... Sooo... if I want my DataSkin subclass to have the same ability I'll need to do something similar? (just replace _zclass_ = DataSkin with _zclass_ = MyDataSkinSubclass?) See above for the shortest way to do this. Well.. my *new* strategy (I'm using this on EMarket) is to put all the core logic in a Specialist subclass... and let my DataSkins be ZClasses that are directly subclassed from __ZClass_for_DataSkin. This has its own problems (I still have a hard time working in a 'specialist' on a method that is supposed to be acquired by a DataSkin, and keeping track of who 'self' is and what properties I can really get to etc...). Personally, I don't recommend this approach, even if you end up with a ZClass that doesn't do much besides have a propertysheet or two. Why did I do all that? I am used to a development routine where I work a while... in emacs.. then hit ctrl-c ctrl-c which 'runs' the current module. With this setup, everything in Thing.py can work without Zope. All my core logic can be tested and I can verify that it works correctly *before* I layer all the ZClass stuff on top. (I know.. now I guess I need to learn to use ZPublisher/Client.py ;-) Of course this requires that my ZClasses are subclasses of my core logic base class.. and I now understand why that is generally undesirable. (It makes integrating frameworks later more difficult ) But there is a clear advantage... I think that with the flexibility of Racks and SkinScript you could probably even have the best of all possible worlds... It is *not* undesirable to have ZClasses be subclasses of your core logic base class. Just make sure they *also* subclass DataSkin, or that you use the metaclass definition stuff above. You've actually got a pretty decent approach going there. One question, though. Why the derivation from Folder? ___ 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
At 03:44 PM 10/6/00 -0500, Michael Bernstein wrote: Steve Spicklemire wrote: 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'. Ok, I just got through stepping through the walkthrough. Thanks! That *was* a really simple example. Perfect! I had a few comments: - You skipped over creating the Product in the Products folder. Yep, gotta do that. - Propertysheets: You don't expressly say that Shared needs to be a 'Common Instance Property Sheet'. Actually, if it's intended to be shared across all instances, there seems to me to be little reason to have it in the ZClass; you might as well define the properties as constants using SkinScript. However, if you want to have defaults that an application integrator will be able to override without actually subclassing, then you want Shared to be a DataSkin Property Sheet, so that they will have the option of overriding your defaults with SkinScript or another attribute provider. - ToDoManager: I was initially confused as to where this needed to be created. I tried placing it directly in the Product as well as in the ZCLass before I tried placing it in a normal folder. Yes, Specialists go in the application space, as they are part of the application. A product developer may want to create one in the product, but only so that it can be copied into application space by a factory. Btw, in strict RIPP convention, ToDoManager would be named "ToDos", as the plural form of the role the objects play in the framework. Ok, moving forward, I had some questions about this approach to building applications: - What do I need to do to let users add ToDoManagers to their own folders without creating them from scratch? In other words, How do I turn ToDoManager into a product? You can put it in the product, then create two methods - a constructor form and a constructor method, along with a Permission. Last, create a Zope Factory that calls the constructor form. The constructor method would copy the specialist and paste it into the chosen destination. - The term 'Specialist' implies (at least to me) that this object is overiding/replacing a 'Generalist' somewhere, but this does not seem to be the case here. Am I missing something? Specialist means "one who specializes", not "thing which is specialized". :) There are no Generalists, unless you consider the application/Zope site as a whole to be one. :) - 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? In the ZClass: index_html - presentation, because it displays things the object knows editInstanceForm - presentation, because it is strictly display editInstance - primarily domain, but mixes some presentation in. If instead of displaying an OK button, it just did a redirect, I'd consider it a pure domain. Note, by the way, that it's not wrong to mix the two, it's just usually more reusable to keep presentation code out of domain methods if you want to be able to call them from code or XML-RPC and such. In the Specialist (btw, stric: index_html: UI implementation, because it implements a non-object specific UI (i.e. "display all to-do's"). newToDoForm: UI implementation, because it's a non-specific object UI. addNewToDo: DM implementation, polluted by a bit of UI. :) It implements the data management aspect of creating a new instance. It calls the Specialist's newItem() method, but it could have directly called a newItem() method on one of the Specialist's Racks, or done something else to create the instance. deleteInstances: DM implementation, again with a touch of UI. It implements the data management aspect of creating a new instance. Instead of doing manage_delete on each item, this could have been implemented as an SQLMethod that did a DELETE WHERE operation using the id's that were given (if the data store was an SQL database, of course). - How does this product (simple though it is) exemplify the RIPP approach? I'm not sure that you can say it *exemplifies* the RIPP approach, although it certainly goes along with that approach. My hesitation is mainly that it doesn't really show any of RIPP's major benefits, which are associated with framework re-use and integration. For that, you really need to have more than one kind of object, with some kind of collaboration taking place. ___ 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 )