Re: [Zope3-Users] Utilities naming convention
Hi Frank, I guess I have just seen more Utilities named this way than not - so just confirming things for myself. I am also using zapi all over the place. Perhaps I should stop... I am not seeing deprecation warnings yet. Many thanks. Regards David FB wrote: Hi, On Thu, Nov 16, 2006 at 04:09:52PM -0400, David Pratt wrote: Probably should have clarified - I am referring to Utility container names not anything to do with Python coding standards. None that I'm aware of. Only the title of the utility's registration matters for your application - which is '' in very often. The contained-name is fully independent from the registration's title. Choose whatever you want. Whenever a part of your application has to link to a utility of yours, it should use zapi.absoluteURL(zapi.getUtility(IMyUtility),request) which makes knowing the URL unneccessary. Regards, Frank PS: I know, zapi is deprecated - but it's so convenient :-) ... ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Utilities naming convention
Le vendredi 17 novembre 2006 à 11:48 +0100, FB a écrit : > PS: I know, zapi is deprecated - but it's so convenient :-) ... ??? What ? Why is zapi going to be deprecated ?? I didn't know that and I agree with you that it is VERY convenient and usefull, even if it's "just" a set of shortcuts to get access to functions provided elsewhere... Thierry Florac -- Chef de projet intranet/internet Office National des Forêts - Département Informatique 2, Avenue de Saint-Mandé 75570 PARIS Cedex 12 Mél : [EMAIL PROTECTED] Tél. : +33 01.40.19.59.64 Fax. : +33 01.40.19.59.85 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Utilities naming convention
Hi, On Thu, Nov 16, 2006 at 04:09:52PM -0400, David Pratt wrote: Probably should > have clarified - I am referring to Utility container names not anything to > do with Python coding standards. None that I'm aware of. Only the title of the utility's registration matters for your application - which is '' in very often. The contained-name is fully independent from the registration's title. Choose whatever you want. Whenever a part of your application has to link to a utility of yours, it should use zapi.absoluteURL(zapi.getUtility(IMyUtility),request) which makes knowing the URL unneccessary. Regards, Frank PS: I know, zapi is deprecated - but it's so convenient :-) ... ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Utilities naming convention
Probably should have clarified - I am referring to Utility container names not anything to do with Python coding standards. David Pratt wrote: Just a simple question of style for naming utilities. I don't like caps in urls. Is there a general convention of using CamelCase for utility names or is it just my imagination. Should I use what I prefer? Would just like to know what others do. Thanks Regards, David ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Utilities naming convention
Just a simple question of style for naming utilities. I don't like caps in urls. Is there a general convention of using CamelCase for utility names or is it just my imagination. Should I use what I prefer? Would just like to know what others do. Thanks Regards, David ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Utilities
Thanks! That's it exactly! I was misunderstanding the concept of a utility with the name ''. On Mon, 2006-06-05 at 17:34 +0300, Albertas Agejevas wrote: > On Mon, Jun 05, 2006 at 09:22:13AM -0500, David Johnson wrote: > > > > > getUtility does not require a name. > > > > I've tried getUtility() without a name it never returns an interface and > > returns component lookup error. > > Because you haven't registered a single utility with the given > interface and name ''! > > > I've tried in many different instances, > > and I've ended up reverting as a work around to > > getAllRegisteredUtilitiesFor(), which works just fine. > > getAllRegisteredUtilitiesFor returns even the utilities that are > "overriden" by closer utilities with the same name and interface. > > > Once I add the name it works great. What am I missing? Is there > > some other requirement? My code looks the same as what you've > > listed. > > I suspect you expect getUtility(ISomething) to return a utility with > *any* name of that interface (that's what > get(AllRegistered)UtilitiesFor() does). But getUtility(ISomething) > returns just the utilities with the name you've passed ('' by default). > > I think I already explained that in my previous email. > > Albertas > ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Utilities
> getUtility does not require a name. I've tried getUtility() without a name it never returns an interface and returns component lookup error. I've tried in many different instances, and I've ended up reverting as a work around to getAllRegisteredUtilitiesFor(), which works just fine. Once I add the name it works great. What am I missing? Is there some other requirement? My code looks the same as what you've listed. The documentation implies that it does not need a name. Is this a possible Zope 3 version issue or bug? ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Utilities
On Mon, Jun 05, 2006 at 01:14:58AM -0500, David Johnson wrote: > What is the best to find the nearest utility without using a name? > > zapi.getUtility() seems to require a name (though the documentation > implies otherwise). The default name is ''. If you're asking for z.c.getUtility(ISomething), you'll get that -- the nearest utility with a given interface and name ''. These used to be called services three years ago. > zapi.getAllRegisiteredUtilitiesFor() works but it > seems to me if you have lots of utilities in other contexts, it would > query those as well, and thereby be slow in a large application. > > I come across this problem frequently and haven't figured out the best > way to deal with it. If you want to get all utilities with a given interface, use z.c.getUtilitiesFor(ISomething). You'll get the nearest utility with each given name. Albertas signature.asc Description: Digital signature ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Utilities
Am Montag, 5. Juni 2006 08:14 schrieb David Johnson: > What is the best to find the nearest utility without using a name? > > zapi.getUtility() seems to require a name (though the documentation > implies otherwise). zapi.getAllRegisiteredUtilitiesFor() works but it > seems to me if you have lots of utilities in other contexts, it would > query those as well, and thereby be slow in a large application. getUtility does not require a name. Example: from zope.app.zapi import getUtility from zope.app.homefolder.interfaces import IHomeFolderManager hfm = getUtility(IHomeFolderManager) Regards, Florian > > I come across this problem frequently and haven't figured out the best > way to deal with it. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Utilities
What is the best to find the nearest utility without using a name? zapi.getUtility() seems to require a name (though the documentation implies otherwise). zapi.getAllRegisiteredUtilitiesFor() works but it seems to me if you have lots of utilities in other contexts, it would query those as well, and thereby be slow in a large application. I come across this problem frequently and haven't figured out the best way to deal with it. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Utilities / Adapters security - is access limited to interfaces?
On Tuesday 11 April 2006 06:59, Reinhold Strobl wrote: > I have got a question on security: > utitlities and adapters only have a simple security attribute (=permission) > in the configuration directive, that means, I can't specifiy settings on > attributes like with content components. > > But now what about access, if I have got the needed permission, can I > access only the methods, attributes defined in the interface or can I > access every attribute of the object? Simply do not specify "permission" in the adapter directive and use the directive to set your security the same way you do for other components, like content. Regards, Stephan -- Stephan Richter CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web Software Design, Development and Training ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Utilities / Adapters security - is access limited to interfaces?
Hi, I have got a question on security: utitlities and adapters only have a simple security attribute (=permission) in the configuration directive, that means, I can't specifiy settings on attributes like with content components. But now what about access, if I have got the needed permission, can I access only the methods, attributes defined in the interface or can I access every attribute of the object? Thanks a lot! ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users