[Zope3-Users] Use Case for a Tree of Adapter Registries?
I've read the code for adapter registries, how there is a global one and any number of local ones, arranged in a tree and that each can be disabled. But I can't figure out when you'd want to make use of such an arrangement. The docstrings and .txt files use abstract examples, for unit testing, and don't provide a motivation for this feature. Related to that, the global registry is loaded at server startup time from the various .zcml directives, and I presume that the only way to loaded up a local registry is thru-the-web, right? Which means all local registries are persistent in the ZODB, I think. Can anyone nudge me onto the right path? -Jeff ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: Use Case for a Tree of Adapter Registries?
On Fri, 14 Apr 2006 11:07:42 +0100, Jeff Rush [EMAIL PROTECTED] wrote: I've read the code for adapter registries, how there is a global one and any number of local ones, arranged in a tree and that each can be disabled. But I can't figure out when you'd want to make use of such an arrangement. The docstrings and .txt files use abstract examples, for unit testing, and don't provide a motivation for this feature. Related to that, the global registry is loaded at server startup time from the various .zcml directives, and I presume that the only way to loaded up a local registry is thru-the-web, right? Which means all local registries are persistent in the ZODB, I think. Can anyone nudge me onto the right path? I'm most definitely not the right person to make an authoritative statement on this, but something that we're struggling with in Plone's adoption of Zope 3 technologies is that CMF/Plone works on the principle that things aren't active until you've installed something in the site. For example, I may have two Plone sites in the same Zope instance. If I want to install a product that uses an adapter registration to override something in one site, but not the other, global adapter registrations don't work. I can imagine this going further, so that for a specific content type I need a more specific override for that adapter that can't be tied to an interface only (e.g. in MyCrazyFolder the adapter for IDocument is different than it is for IDocument everywhere else). Martin -- (muted) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: A Few Questions re Namespaces
2. I finally found the + view in container/browser, but all uses of it are as /@@+/newitem.html. I could have sworn I saw the + used w/o the @@ prefix someplace but can't find it again. Did I indeed imagine ever seeing /+/newitem.html? No, I've seen this too. As far as I understand, the @@ is optional, but useful to disambiguate views from other things. If you had an object in / called '+', /+ would find that, not the add view. 3. What happens if you register a utility or adapter with the -exact- same criteria including the same name? Does a queryAdapter() lookup return the oldest or newest? Is that a legitimate way of overriding, other than using an overrides.zcml? Did you try it? Martin -- (muted) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] dynamic file creation
Hello, I'm a Zope3 newbie. I want to send to user a file while he clicks on a link. The file is created dynamically and sent to user for example in ZIP format. I think I had to use IFile interface and File class. But I dont know how to prepare it and send it to user. My code: class ISomeContainer(IReadContainer): contains(IFile) then I have: self['zip'] = File(some data, application/zip) So when I access url: http://somepath/zip browser shows 'some data', but I want to see 'Save As' dialog window. How to do that? Godfryd ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] formlib problem
Hi, I'm trying to use formlib but I get a problem : Traceback (most recent call last): File pyshell#103, line 1, in -toplevel- print MyForm(None, request)() File pyshell#100, line 6, in __call__ widgets = form.setUpWidgets(self.form_fields, 'form', self.context, self.request, ignore_request=ignore_request) File C:\Python24\Lib\site-packages\zope\formlib\form.py, line 255, in setUpWidgets IInputWidget) File C:\Python24\Lib\site-packages\zope\component\__init__.py, line 154, in getMultiAdapter raise ComponentLookupError(objects, interface, name) ComponentLookupError: ((, http://127.0.0.1), , u'') This problem occurs with my objects (which are sqlos objects) but also when I try the examples of the form.txt. I must be doing something wrong, but I can't figure it out, especially since I follow the examples. Any hint ? Thanks, Stéphane ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] dynamic file creation
Hi, On Fri, Apr 14, 2006 at 02:56:55PM +0200, Michal Nowikowski wrote: Hello, I'm a Zope3 newbie. I want to send to user a file while he clicks on a link. You won't need the IFile interface - just a simple view that sets some special HTTP-headers. Example: class DownloadView(BrowserView): def __call__(self): rsp=self.request.response rsp.setHeader('Content-disposition','attachment; filename=download.txt') rsp.setHeader('Content-Type','text/plain') return This is a textfile The type of data you return, the default filename the user gets presentend in his download dialog ('download.txt' in the example) and the data itself is 100% under your control. There should be no problem creating some kind of archive inside the view and return in to the user. Remember: You must always return a plain string from __call__ if you want to manually set the 'Content-Type' -header. Thanks, it works! Best regards Godfryd ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users