Re: [Zope] (no subject)
Hi: Could you give an equivalent using the current dtml tags? Thanks, Shalabh - Original Message - From: Jay, Dylan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 23, 2000 12:02 PM Subject: [Zope] (no subject) Here's a feature I just submitted to the collector. It seems to me that a few tweaks to the dtml-if syntax would be beneficial something like the following would certainly clean up some of the logic I end up writing. dtml-if X a href="a_url" dtml-always link text dtml-else (no link currently available) dtml-then /a /dtml-if What do people think? I've not implemented it but I wouldn't imagine its very hard. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] private Z Classes
Hi Could it be the infamous "Resouce Not Found" bug? The following link has information about the bug and how to work around it. http://www.zope.org/Members/gtk/containers HTH, Shalabh - Original Message - From: Armin Wappenschmidt [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 15, 2000 3:25 PM Subject: [Zope] private Z Classes Hi all, I'm trying to create a product with a Z Class (call it Z_Super) that contains other (private) Z Classes (call them Z_Subs). Creating Z_Super is no problem, but creating Z_Sub in Z_Super gives me the following traceback: Traceback (innermost last): File /ford/sdrcsvr/u/zope/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /ford/sdrcsvr/u/zope/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 179, in publish File /ford/sdrcsvr/u/zope/Zope-2.1.6-src/lib/python/Zope/__init__.py, line 202, in zpublisher_exception_hook (Object: RoleManager) File /ford/sdrcsvr/u/zope/Zope-2.1.6-src/lib/python/ZPublisher/Publish.py, line 151, in publish File /ford/sdrcsvr/u/zope/Zope-2.1.6-src/lib/python/ZPublisher/BaseRequest.py, line 430, in traverse File /ford/sdrcsvr/u/zope/Zope-2.1.6-src/lib/python/AccessControl/User.py, line 375, in validate (Object: RoleManager) File /ford/sdrcsvr/u/zope/Zope-2.1.6-src/lib/python/ZPublisher/HTTPResponse.py, line 511, in notFoundError NotFound: (see above) FYI I'm using Zope 2.1.6. Thanks a lot. armin ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Referring to a total-xxx variable
Hi: Instead of dtml-call "REQUEST.set('v_allItems', v_allItems + count-id)" try: dtml-call "REQUEST.set('v_allItems', v_allItems + _['count-id'])" The _ is the 'current namespace' dictionary. Another way would be to do this: dtml-let ci=count-id dtml-call "REQUEST.set('v_allItems', v_allItems + ci )" /dtml-let Hope this helps, Shalabh - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 15, 2000 9:43 AM Subject: [Zope] Referring to a total-xxx variable Following on from my last posting I seem to have made a lot of progress - although still not sure if what I have done is the right thing or not. However, please somebody put me out of my misery. In the following code snippet the dtml-var part works fine. How can I, therefore, add count-id to v_allItems? It seems to think I am trying to do subtraction. I've spent a couple of hours trying to find the mystical incantation. dtml-in "PARENTS[0].objectValues(['TimeSheet'])" dtml-var count-id dtml-call "REQUEST.set('v_allItems', v_allItems + count-id)" /dtml-in Ian Cottee Nagoya, Japan ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] getUsers cf. get_valid_userids question
Hi: In an attempt to solve the very same problem (Get a list of all users with certain role) I created an external method. It walks up the acquisition path, at each level checking the existing acl_users (if it exists) for all users with the role. I can't say this it is the best way to do it, but it worked for me. Here's the code: == from App.Common import aq_base def getUserIdsWithRole(self, role): "Get all userids having a role. Local roles on self are considered too." item=self dict={} while 1: if hasattr(aq_base(item), 'acl_users') and hasattr(item.acl_users, 'user_names'): for user in item.acl_users.getUsers(): if user.has_role(role, object=self): dict[user.getUserName()]=1 if not hasattr(item, 'aq_parent'): break item=item.aq_parent keys=dict.keys() keys.sort() return keys == Hope this helps, Shalabh Geoff Gardiner wrote: I want to show all users who have certain roles / and or permissions (Zope 2.1.6). I can't see how to do this directly, because I can't see how to get hold of user objects, which I need to carry out has_permission, etc., methods. I can show the userids of all valid users: dtml-in get_valid_userids dtml-let uid=sequence-item dtml-var uidbr /dtml-let /dtml-in but I can't get all actual user objects because getUsers is a method valid only for an identified User folder, and doesn't have acquisition. Should I just go in and code a new get_valid_users in the style of get_valid_userids, or is there another way? Perhaps there would be a security implication (I can't think what) but that's not a major issue for me at the moment. Thank you, Geoff ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Traversable DTML methods
Shane Hathaway wrote: I downloaded TraversableMixin. Comments: 1) You used Windows path names (backslashes) in the tar file. It does not unpack cleanly on Unix variants. 2) You forgot to include TraversableDocument.py, but did include TraversableDocument.pyc. Hmm.. the TraversableDocument.pyc shouldn't be there either. It is the remnant of some experimentation I was doing prior to creating the mixin. Yuck! Ugly packaging - my bad. I have fixed both the above problems and uploaded it again. 3) You may be interested in using OFS.Traversable, checked in to the tree just a few minutes ago. (Note that TraversableMixin and Traversable.py perform non-overlapping functions.) I looked at it online only. I'll spend some time in the code and the interfaces wiki to grok this new traversal stuff. It seems like if the TraversableMixin is also made an OFS.Traversable, it will be traversable not only just through the url but also through other mechanisms that OFS.Traversable makes possible. For example, calling a TraversableMixinZClass with parameters foo and bar might be possible like this: dtml-var "MyTraversableMixinObject/foo/bar" Shane Thanks for your comments, Shalabh PS: 'Traversable' doesn't seem like a very good name for what the mixin does, especially after the new OFS.Traversable also has the same name. Anyone have any good ideas? ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Folderish Objects and their contained objects
Hi Stephan, You might want to look at the LocalFS product code: http://www.zope.org/Members/jfarr/Products/LocalFS It makes the os filesystem objects (files and directories) available through zope. The way I understand it, what you want to do is very similar, except go to a database instead of the filesystem. HTH, Shalabh - Original Message - From: Stephan Richter [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, June 14, 2000 7:44 AM Subject: [Zope] Folderish Objects and their contained objects Hello everyone, I am writing a folderish class (in Python) that gets its objects from a database using SQL. I want to call the object as follows: WEBURL/FolderishClassInstance/ObjectID What needs to be done? The Folderish class should contain something like a getObject class that is automatically called when an ObjectID is passed. The getObject method then executes a SQL statement getting the object from the DB and does an R2O (relational to object) mapping, which is trivial. So what am I asking? Is there such a method already defined, that gets an object from a folderish object? What is its name, so I can redefine it? I found two potential methods called __getitem__ and _getObj in the Zope code. Is it one of them? That let's me ask: How does the URL traversal get objects inside other objects? Right now I am developing that Product for a specific purpose, but I see great potential in generalizing it, so that all types of Zope objects can be saved in a database table. This would be different from the current SQLStorage product though, since it does not save pickle files in the DB, but the actual values with their correct type, which would make it much faster. Regards, Stephan -- Stephan Richter CBU - Physics and Chemistry Web2k - Web Design/Development Technical Project Management ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Traversable DTML methods
Hi all I just created a 'Traversable DTML Document' product. You can get it here: http://www.zope.org/Members/shalabh/TraversableDTMLDoc/ It is a ZClass product based on the TraversableMixin (which you'll have to install anyway) to be found here: http://www.zope.org/Members/shalabh/TraversableMixin/ And yes, you can use the mixin to create any ZClass that is 'traversable'. For example create a new ZClass with DTMLMethod and the TraversableMixin as bases and you have a 'Traversable DTML Method' (that's how I created the Traversable DTML Document). Mail me for any problems. Many thanks to Itamar for pointing me in the right direction, and to Ian for initiating this mindwave. Enjoy! Shalabh Ian Sparks wrote: I don't see DTML Methods as "chopping off" the URL so much as "consuming" parts of it. SQL Methods have this behaviour now : www.mysite.com/flavor/cherry/showme Where "flavor" is a SQL Method which takes a single parameter "cherry" and "showme" is a DTML Document which makes some use of the flavor SQL Method. In this instance "flavor" consumes the next part of the url because it is looking for a parameter and when it is finished hands on control to the next, unconsumed part of the URL "showme". Notice though that I have to have the "showme" DTML Method to actually display the results. If "flavor" was a parmeterized DTML Method my URL could become : www.mysite.com/flavor/cherry which makes more sense to me. In this case the "flavor" DTML Method would consume the "cherry" parameter, perhaps call some SQL Method to get the data for the "cherry" display and then display itself. If the parameters could have defaults then I could have URL's like : www.mysite.com/members/ian/ www.mysite.com/members/ian/home www.mysite.com/members/ian/preferences www.mysite.com/members/ian/todo Where "members" is a DTML method which takes parameters username,subsite (default : "home") and decides what to display based on the parameters passed. This allows my "users" to become virtual (by which I mean DB-based). I can do the last 3 URL's now with SQL Methods ("home", "preferences" and "todo" become DTML documents or methods which are aquired) but I can't do the first URL because SQLMethods don't do any rendering for display. Well, that got rambling but it lays my argument out in full I think. - Ian. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] The funny _.None,_ feature in DTML kind of question
There is some more information at http://www.zope.org/Documentation/How-To/AdvancedDTML Look for the section "DTML Calling Arguments". Reading that left me a bit confused because here you say (and I have read elsewhere too) that method is passed client=_.None. I thought that the client should be the object on which the dtml method 'operates'. So how does the dmtl method access the attributes of the object it is called upon? Is it because the namespace object '_' has the namespace of the object on top? Any example of where the client parameter would be useful? Thanks, Shalabh - Original Message - From: Vitaly Osipov [EMAIL PROTECTED] To: Johan Carlsson [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, June 01, 2000 3:50 PM Subject: Re: [Zope] The funny _.None,_ feature in DTML kind of question Everything is more or less simple - when you invoke method by dtml-var meth1 - that "mapping" _ and "client" _.None are passed automagically :) when you invoke method with explicit arguments like dtml-var "meth1()", you have to pass those two explicitly like dtml-var "meth1(_,_.None,...)" details are here: http://lists.zope.org/pipermail/zope/2000-January/017687.html - Original Message - From: "Johan Carlsson" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 01, 2000 12:43 AM Subject: [Zope] The funny _.None,_ feature in DTML kind of question Hi, This feature really bugs me so I thought I write a Tips (or HOWTO). But I need some help. (Also I believe it's documented somewhere, but I cant figure out where...) When calling the a DTML-method the second time in a row the namespace just disapears. Using _.None and _ as begining arguments make it all work again. The questions are: -Why does DTML act like this, is there a logical explanition? -Where is this documented? (I know I say it somewhere) -What would be the best way to name and categorise this "feature". Best Regards, Johan Carlsson If you understand my brief problem description, here's a scenario: In /folder1 there is three DTML-methods: meth1, meth2 In /folder1/folder2 there is a fourth DTML-method: meth3 /folder1/meth1: dtml-with folder2 #changes the namespace dtml-call "meth3()" # works just fine /dtml-with /folder1/meth2: dtml-call "meth1()" #doesn't work /folder1/folder2/meth3: dtml-var "'hällå wörld'" # or something useful like hello foobar Solution: In /folder1 there is three DTML-methods: meth1, meth2 In /folder1/folder2 there is a fourth DTML-method: meth3 /folder1/meth1: dtml-with folder2 #changes the namespace dtml-call "meth3(_.None,_)" # works just fine /dtml-with /folder1/meth2: dtml-call "meth1(_.None,_)" #works like a working thing /folder1/folder2/meth3: dtml-var "'hällå wörld'" #or something useful like hello foobar (oh, it the same...) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )