[Zope-dev] Five and browser-oriented components
On Z2, certain imports need to come from Products.Five, to play nicely with ZPublisher and friends. I'd like to ask for the motivation for not patching it onto the existing classes and/or modules. The effect of having Z2-developers import from Products.Five is that they must opt out on packages that make use of templates, browser views, formlib, ... --- and it adds needless complexity. This split might also have prompted the Plone community to walk their own way to the extend that there isn't much code reuse outside of the core Zope packages (along with egg dependencies, but with our fake eggs, we're almost up to par here). \malthe ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: What happened to the infrae.subversion and py eggs?
Tres Seaver schreef: Daniel Nouri wrote: 1.0dev-r27844 seems to be gone from PyPI. Such a version should *never* have been released to PyPI (any egg / source dist with an SVN revision number in its filename is *not* suitable for sharing with the wider world). I've made it a habit *not* to enable the option in setup.cfg that adds those svn revision numbers to the version. It is enabled by default in all/most of the ZopeSkel-generated packages that I use. That single change forces me to maintain a proper version number in the setup.py (0.9 dev 3 for development versions). That is the spot where you make a change anyway when doing a release. It is wy too easy to forget to remove the subversion revision option from setup.cfg (and having to enable it again after the release). Somehow it helps :-) Reinout -- Reinout van Rees Blog: http://vanrees.org/weblog/ [EMAIL PROTECTED] Work: http://zestsoftware.nl/ http://vanrees.org Video: http://reinout.blip.tv/ ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: What happened to the infrae.subversion and py eggs?
Previously Reinout van Rees wrote: Tres Seaver schreef: Daniel Nouri wrote: 1.0dev-r27844 seems to be gone from PyPI. Such a version should *never* have been released to PyPI (any egg / source dist with an SVN revision number in its filename is *not* suitable for sharing with the wider world). I've made it a habit *not* to enable the option in setup.cfg that adds those svn revision numbers to the version. It is enabled by default in all/most of the ZopeSkel-generated packages that I use. I recently started adding that option again for some of my projects. For a few frequently updated sites I do a lot of updates installs without making full releases and it is extremely convenient to be able to see which exact revision number I'm currently using. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: What happened to the infrae.subversion and py eggs?
Reinout van Rees [EMAIL PROTECTED] writes: Tres Seaver schreef: Daniel Nouri wrote: 1.0dev-r27844 seems to be gone from PyPI. Such a version should *never* have been released to PyPI (any egg / source dist with an SVN revision number in its filename is *not* suitable for sharing with the wider world). I've made it a habit *not* to enable the option in setup.cfg that adds those svn revision numbers to the version. It is enabled by default in all/most of the ZopeSkel-generated packages that I use. That single change forces me to maintain a proper version number in the setup.py (0.9 dev 3 for development versions). That is the spot where you make a change anyway when doing a release. It is wy too easy to forget to remove the subversion revision option from setup.cfg (and having to enable it again after the release). For making releases, I create a tag and remove the setup.cfg file from that tag. No need to remove it from trunk. Also see [1] and [2]. And I agree with Wichert that for non-public packages, these development snapshot releases can be useful. [1] http://peak.telecommunity.com/DevCenter/setuptools#managing-continuous-releases-using-subversion [2] http://peak.telecommunity.com/DevCenter/setuptools#making-official-non-snapshot-releases Daniel ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Zope Tests: 5 OK
Summary of messages to the zope-tests list. Period Wed Apr 9 11:00:00 2008 UTC to Thu Apr 10 11:00:00 2008 UTC. There were 5 messages: 5 from Zope Tests. Tests passed OK --- Subject: OK : Zope-2.8 Python-2.3.6 : Linux From: Zope Tests Date: Wed Apr 9 20:56:34 EDT 2008 URL: http://mail.zope.org/pipermail/zope-tests/2008-April/009380.html Subject: OK : Zope-2.9 Python-2.4.4 : Linux From: Zope Tests Date: Wed Apr 9 20:58:05 EDT 2008 URL: http://mail.zope.org/pipermail/zope-tests/2008-April/009381.html Subject: OK : Zope-2.10 Python-2.4.4 : Linux From: Zope Tests Date: Wed Apr 9 20:59:35 EDT 2008 URL: http://mail.zope.org/pipermail/zope-tests/2008-April/009382.html Subject: OK : Zope-2.11 Python-2.4.4 : Linux From: Zope Tests Date: Wed Apr 9 21:01:05 EDT 2008 URL: http://mail.zope.org/pipermail/zope-tests/2008-April/009383.html Subject: OK : Zope-trunk Python-2.4.4 : Linux From: Zope Tests Date: Wed Apr 9 21:02:35 EDT 2008 URL: http://mail.zope.org/pipermail/zope-tests/2008-April/009384.html ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Five and browser-oriented components
Malthe Borch [EMAIL PROTECTED] writes: On Z2, certain imports need to come from Products.Five, to play nicely with ZPublisher and friends. I'd like to ask for the motivation for not patching it onto the existing classes and/or modules. The effect of having Z2-developers import from Products.Five is that they must opt out on packages that make use of templates, browser views, formlib, ... --- and it adds needless complexity. IMO, any implicitness here will eventually slap you in your face, cause bugs, and be hard to figure out. I already dislike the way that e.g. FiveFormLibMixin implicitly changes my request to be more conform with formlib . This has caused confusion and pain for me in the past. Therefore, I'd argue that we should, in contrary to what you suggest, make the Zope 2 compatibility layer more explicit in the form of utility functions, instead of more implicit. Because it makes things more transparent and easier to debug. One concrete argument against patching the Zope 3 view page template in Five to be Zope 2 conform is that this would stand in the way of legitimate use of pure Zope 3 views in Zope 2 applications, which is something that's quite feasible today. We don't to lock ourselves into a situation where Z3 templates in Z2 assume that the view is acquisition wrapped. Daniel ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Five and browser-oriented components
Daniel Nouri wrote: Therefore, I'd argue that we should, in contrary to what you suggest, make the Zope 2 compatibility layer more explicit in the form of utility functions, instead of more implicit. Because it makes things more transparent and easier to debug. You might be right; but it's a very bad place to be, stuck in the middle of two frameworks. We're duplicating code all over the place, and while this has obvious inherent qualities, it also wears us out as a community. I fail to understand why people are not more motivated to get rid of all the cruft. There are times when I wish the ship would sink, if only to get on with it. \malthe ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: straighting out the SQLAlchemy integration mess
Martin Aspeli wrote: [snip] It's never particularly pleasant. I think we need to make sure we make this as easy and pleasant as possible though. This means at the very least some document that tells you what to do. :) Regards, Martijn ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Five and browser-oriented components
Malthe Borch wrote: On Z2, certain imports need to come from Products.Five, to play nicely with ZPublisher and friends. I'd like to ask for the motivation for not patching it onto the existing classes and/or modules. Technically, I think that this is going to be hard. You'd need to patch in the magic acquisition base class. Acquisition is the main reason that some of the code needed to be duplicated - without the existence of acquisition wrappers, security checks are not made for view access and things just won't work. We do explicit acquisition in those bits of code, but it's still a pain and leads to confusion around self.context in views being acquisition-wrapped weirdly, breaking some expectations around aq_parent. The other argument against monkey-patching is that monkey-patching is something to be avoided if at all possible. I think it's wise to avoid it here, as it's possible. If you monkey-patched core Zope 3 classes, the chances are that you'll break Zope 3 code that assumes certain behavior. The way to get rid of many of these problems would be to get rid of the need for acquisition. Philipp started a branch long ago that allows the acquisition system to look at a __parent__ pointer if no acquisition wrapper is present. Since our views have __parent__ pointers, this should fix the issue. This branch has been lingering in an almost ready state for a long time now. In general, I think acquisition is one of the major remaining stumbling block in enabling quite a bit of straightforward Zope 3 code in Zope 2. Here are some more of my thoughts on this: http://faassen.n--tree.net/blog/view/weblog/2008/01/30/0 Regards, Martijn ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Five and browser-oriented components
Malthe Borch [EMAIL PROTECTED] writes: Daniel Nouri wrote: Therefore, I'd argue that we should, in contrary to what you suggest, make the Zope 2 compatibility layer more explicit in the form of utility functions, instead of more implicit. Because it makes things more transparent and easier to debug. You might be right; but it's a very bad place to be, stuck in the middle of two frameworks. We're duplicating code all over the place, and while this has obvious inherent qualities, it also wears us out as a community. I think I found a useful pattern for how to work with z3c.forms to avoid duplication. For each page that has forms, I make two views; one is the Products.Five.BrowserView view that's looked up by the publisher and is registered with ZCML. The other is my z3c.form.form.Form that does the actual work and renders my content area. The relationship between these two forms is similar to that of forms and subforms. Here is an example of how this looks like in practice: class MyForm(z3c.form.form.Form): template = Z3ViewPageTemplateFile('form.pt') fields = z3c.form.Fields(ISomething) @button.buttonAndHandler(_('Apply'), name='apply') def handle_apply(self, action): data, errors = self.extractData() # ... class PloneView(Products.Five.BrowserView): __call__ = Z2ViewPageTemplateFile('main.pt') form = MyForm def contents(self): z2.switch_on(self) return self.form(self.context.aq_inner, self.request)() Here, main.pt is the part that renders main_template and pulls in view/contents into the content area. z2.switch_on() is a compatibility function that fiddles a bit with the Zope 2 request to make it work with z3c.form (and also calls Five's decodeInput). Of course, PloneView is generic enough to be subclassed at this point: class MyFunnyView(PloneView): form = MyFunnyForm What's the advantage of this separation? - You don't have to worry about Acquisition in your form code, which will make out the bigger part of your code. The implications of Five's BrowserView being derived from Acquisition.Explicit has often left me confused. (Death to self.context.aq_inner!) - You can reuse form code between Zope 2 and Zope 3. - Your forms can be rendered in any part of your page, like in portlets. - No subclassing of classes in z3c.form is necessary to use the forms in Zope 2. (In contrast to Five's current way of subclassing formlib.) Daniel ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] [zope.testing.doctest] a nasty surprise
As the community (apparently) strongly favors doctest over unittest, I wrote my first test based on zope.testing.doctest. And promptly, I was badly surprised In order to analyse a difficult problem, I added from dm.pdb import zpdb; zpdb.set_trace() in the doctest (dm.pdb.zpdb is my Zope aware PDB extension) -- and got a TypeError: set_trace requires at least one argument, 0 given. Now, I know the zpdb.set_trace() does not want any arguments. I moved the line from the doctest code into the failing infrastructure code -- same TypeError. I called help(zpdb.set_trace) and got: Help on function set_trace in module zope.testing.doctest: set_trace(self) Apparently, doctest has overridden zpdb.set_trace in an incompatible way I will rewrite my test as unittest and probably avoid in the future zope.testing.doctest whenever possible. -- Dieter ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: straighting out the SQLAlchemy integration mess
Martin Aspeli wrote: Laurence Rowe wrote: Should one phase commit be set as the default to make it easier to work with sqlite (and mssql)? Probably yes. Ideally we'd guess based on the URL scheme but allow it to be set explicitly, IMHO. Single phase would be the fallback, I guess. I don't like the idea of guessing too much, but it could be done in the __init__. There might be good reasons to choose one phase commit even for a two phase commit supporting database (i.e. when you only are talking to a single database, it is more efficient). Given that a single database is the common case I am tempted to say just make 1PC the default. Should the default be for sessions to start out `active` or `dirty`? If they start out `dirty` then existing 1.0 code should work as before. What are the implications of having them start out dirty? Unnecessary commits to the database for read only transactions (i.e. the current situation) Laurence ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: straighting out the SQLAlchemy integration mess
Martin Aspeli wrote: Martijn Faassen wrote: Martijn Pieters wrote: On Tue, Apr 8, 2008 at 11:54 PM, Martijn Faassen [EMAIL PROTECTED] wrote: All of these are in various states of brokenness. z3c.zalchemy doesn't work with SQLAlchemy trunk. collective.lead works with it, but only if you check out a particular branch, and not with sqlite. Quite possibly z3c.sqlalchemy has a release that actually works. One out of three is not bad... :) We are going into production with collective.lead and are committed to releasing the 1.0 branch as 1.0. sqlite works just great for us, we use it to run unit tests and for developers that just need to adjust the styling and such. The production environment will run against Oracle. The elro-tpc branch (which, I was told, is the future) doesn't appear to work with sqlite out of the box. I think this is a temporary bug, as Laurence pointed out, caused by SQLite not supporting two-phase commit. It should be fixed before release, by adding a one-phase fallback. I'm curious how to do functional tests with collective.lead - I'd like to have some real easy way to get the database set up and tore down down in my tests. Are you doing this? I'm doing a lot of it in Java. :) The typical pattern is to use a test setup that does database clean-down to return it to a steady state. Test data is kept in a declarative file (e.g. with an XML syntax that maps to DB structure) and used to initialise the database before each run. Doing nested transactions and rollback would be nicer, but probably doesn't work in all cases since app code may well do explicit commits. Note that sqlite does not support nested transactions or savepoints. It's never particularly pleasant. Martin Laurence ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [zope.testing.doctest] a nasty surprise
Dieter Maurer wrote: As the community (apparently) strongly favors doctest over unittest, I wrote my first test based on zope.testing.doctest. And promptly, I was badly surprised In order to analyse a difficult problem, I added from dm.pdb import zpdb; zpdb.set_trace() in the doctest (dm.pdb.zpdb is my Zope aware PDB extension) The standard PDB works fine. I'm sure you're extended version can be tweaked to as well. -- Benji York Senior Software Engineer Zope Corporation ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: AW: [Zope-dev] Re: [Zope3-Users] How do I automatically login a user]
I have completed a first draft of an implementation of a proposal for for changes to the SessionCredentials Access code (zope.app.authentication). http://wiki.zope.org/zope3/SessionCredentialsAPIEnhancements I want to put them somewhere so that they can be discussed. I think that a svn.zope.org/Sandbox is the appropriate place. Can I get committer access to the subversion repository to make changes to this area? [According to the faq, I ask for commiter access on this list]. Alternatively, is there another location where proposed changes to the core are generally posted. Thanks Kevin On Apr 9, 2008, at 5:07 AM, kevin gill wrote: 1. IP Extraction Extract the IP Address from the credentials and store it. Return the IP Address in the dictionary from extractCredentials(). The value from request._environ['HTTP_X_FORWARDED_FOR'] will be used if present. otherwise request._environ['REMOTE_ADDR']. On a basis of privacy of attributes starting with underscore, such as _environ, I would suggest using request.headers (for X-Forwarded- For) and request.environment instead. These are defined in the public interface API. -- Zvezdan Petkovic [EMAIL PROTECTED] ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope ) -- ** Email Scanned by Elive's Virus Scanning Service - http://www.elive.net ** ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] straighting out the SQLAlchemy integration mess
On Wed, Apr 09, 2008 at 12:51:53PM -0400, Kapil Thangavelu wrote: that sound good, i'd like to see a common base layer, providing transaction support, simple containers. Actually, containers are one of the things I think should be explicitly excluded from a base SQLAlchemy integration package. You could do the same thing by IPublishTraverse plugins as well. -- Brian Sutherland ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: straighting out the SQLAlchemy integration mess
On Wed, Apr 09, 2008 at 05:47:06PM +0200, Andreas Jung wrote: --On 9. April 2008 14:15:38 +0100 Laurence Rowe [EMAIL PROTECTED] wrote: @everyone: If we can all agree to use the same basic session and transaction management then we should probably push for it to be included as a sqlalchemy extension module. I would be happy with such a solution. As said, I am not into the datamanager-building business and more interested in application-integration issues. The basic requirements I have for our applications: - having the same session within one ZODB transaction (per thread) - need to get hold of the underlying database connection for a given session Just adding my few requirements: - Integration into transactions. - Integration into the component architecture in such a way that I can specify the db connection parameters in ZCML and that database reflection still works. I want to be able to get a handle on SQLAlchemy things by calling getUtility. - Have a connection available as IZopeDatabaseAdapter utility (for BBB) -- Brian Sutherland ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: straighting out the SQLAlchemy integration mess
--On 10. April 2008 19:10:49 +0200 Brian Sutherland [EMAIL PROTECTED] wrote: Just adding my few requirements: - Integration into the component architecture in such a way that I can specify the db connection parameters in ZCML and that database reflection still works. I want to be able to get a handle on SQLAlchemy things by calling getUtility. Please *NO* database specific configurations within ZCML. We're running applications in up three or four different environments and I don't want to maintain instance specific configurations within ZCML. Either we pass such informations through environment variables or the database connections parameters are read from a configuration within the instance configuration. Andreas pgpPVek73cZst.pgp Description: PGP signature ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Have you checked on the latest commits?
On Tue, Apr 08, 2008 at 09:20:23AM +1200, Matthew Grant wrote: On Mon, 2008-04-07 at 20:02 +0300, Marius Gedminas wrote: I want to get teh branch to the point where it gets merged. Don't feel that my review is somehow necessary for it being merged. I tend to procrastinate. :-( Could you please tell me what has to happen to get the merge done? Someone with commit access goes and does the merge :-) I've looked at your latest checkins a bit. I got the impression at one or two places that you didn't quite understand the point of my suggestion, but none of those were very important. And, you know, perfect is the enemy of good. I've no objections for the merge. I believe there is some consensus that needs to be reached with the other zope.sendmail maintainers? No, I don't think so. There's no code ownership in Zope: everybody can do whatever he or she wants. At worst you'll get yelled at if you introduce a bug or commit broken untested code somewhere. ;-) Marius Gedminas -- Any sufficiently advanced Operating System is indistinguishable from Linux. -- Jim Dennis signature.asc Description: Digital signature ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] straighting out the SQLAlchemy integration mess
Hi there, On Thu, Apr 10, 2008 at 7:04 PM, Brian Sutherland [EMAIL PROTECTED] wrote: On Wed, Apr 09, 2008 at 12:51:53PM -0400, Kapil Thangavelu wrote: that sound good, i'd like to see a common base layer, providing transaction support, simple containers. Actually, containers are one of the things I think should be explicitly excluded from a base SQLAlchemy integration package. You could do the same thing by IPublishTraverse plugins as well. Agreed. I think the common base layer should do the minimum transaction integration stuff and leave any policy to layers on top. Hopefully we'll arrive at a commonly used package for containers too at some point, but we'll see about that then. Regards, Martijn ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
AW: AW: [Zope-dev] Re: [Zope3-Users] How do I automatically login a user]
Hi Kevin Betreff: Re: AW: [Zope-dev] Re: [Zope3-Users] How do I automatically login a user] I have completed a first draft of an implementation of a proposal for for changes to the SessionCredentials Access code (zope.app.authentication). http://wiki.zope.org/zope3/SessionCredentialsAPIEnhancements Thanks a lot for pick up that work. Looks very promising. One imporant part whould be to prevent write access on each request. But you noticed that already on your wiki page. Regards Roger Ineichen ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [zope.testing.doctest] a nasty surprise
Benji York wrote at 2008-4-10 11:50 -0400: Dieter Maurer wrote: As the community (apparently) strongly favors doctest over unittest, I wrote my first test based on zope.testing.doctest. And promptly, I was badly surprised In order to analyse a difficult problem, I added from dm.pdb import zpdb; zpdb.set_trace() in the doctest (dm.pdb.zpdb is my Zope aware PDB extension) The standard PDB works fine. I'm sure you're extended version can be tweaked to as well. Does a documentation exist how doctest manipulates set_trace and what it expects that the manipulation succeeds. Apparently, doctest has replaced my set_trace in zpdb by its non working implementation of set_trace. I can understand that my set_trace would not have worked (as probably sys.stdout/err points somewhere else then usual), but I have difficulties to understand why doctest's set_trace does not work (at all). -- Dieter ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: straighting out the SQLAlchemy integration mess
On Thu, Apr 10, 2008 at 07:31:54PM +0200, Andreas Jung wrote: --On 10. April 2008 19:10:49 +0200 Brian Sutherland [EMAIL PROTECTED] wrote: Just adding my few requirements: - Integration into the component architecture in such a way that I can specify the db connection parameters in ZCML and that database reflection still works. I want to be able to get a handle on SQLAlchemy things by calling getUtility. Please *NO* database specific configurations within ZCML. We're running applications in up three or four different environments and I don't want to maintain instance specific configurations within ZCML. Either we pass such informations through environment variables or the database connections parameters are read from a configuration within the instance configuration. What defines if something is the instance configuration? Isn't ZCML just another format of configuration file? I agree it's evil to hardcode database connections in the application as they must be under the control of the sysadmin. But that doesn't preclude them from being expressed in zcml. I *do* like the idea of using one and only one file format to configure applications. We also run the in a few different environments, the /etc/myserver/site.zcml is different on a per instance basis and looks like this: configure xmlns=http://namespaces.zope.org/zope; xmlns:rdb=http://namespaces.zope.org/rdb; include package=mymodule file=configure.zcml / rdb:provideConnection name=admin component=psycopg2da.adapter.Psycopg2Adapter dsn=dbi://prototype / /configure But, I'm diverging, my point is that it would be nice to be able to have SQLAlchemy connections available as IZopeDatabaseAdapter utilities to allow a migration path. Whether they are defined in or out of ZCML, I just don't care. -- Brian Sutherland ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [zope.testing.doctest] a nasty surprise
On Thu, Apr 10, 2008 at 08:46:15PM +0200, Dieter Maurer wrote: Benji York wrote at 2008-4-10 11:50 -0400: Dieter Maurer wrote: As the community (apparently) strongly favors doctest over unittest, I wrote my first test based on zope.testing.doctest. And promptly, I was badly surprised In order to analyse a difficult problem, I added from dm.pdb import zpdb; zpdb.set_trace() in the doctest (dm.pdb.zpdb is my Zope aware PDB extension) The standard PDB works fine. I'm sure you're extended version can be tweaked to as well. Does a documentation exist how doctest manipulates set_trace and what it expects that the manipulation succeeds. Documentation? Well, there are some comments in the source file... doctest monkey-patches pdb.set_trace (in an ugly way, IMHO) to restore sys.stdout, because you want the output from pdb commands like 'list' or 'print' to go to your console, and not to the doctest's actual result StringIO collector. Apparently, doctest has replaced my set_trace in zpdb by its non working implementation of set_trace. I find it hard to believe. It's more likely that zpdb is interacting with pdb.set_trace in a way that conflicts with doctest's monkey-patch. Is the zdpb module available on the web somewhere? I can understand that my set_trace would not have worked (as probably sys.stdout/err points somewhere else then usual), but I have difficulties to understand why doctest's set_trace does not work (at all). Marius Gedminas -- ...Unix, MS-DOS, and Windows NT (also known as the Good, the Bad, and the Ugly). -- Matt Welsh signature.asc Description: Digital signature ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: straighting out the SQLAlchemy integration mess
On Thu, Apr 10, 2008 at 09:29:43PM +0200, Brian Sutherland wrote: On Thu, Apr 10, 2008 at 07:31:54PM +0200, Andreas Jung wrote: Please *NO* database specific configurations within ZCML. We're running applications in up three or four different environments and I don't want to maintain instance specific configurations within ZCML. Either we pass such informations through environment variables or the database connections parameters are read from a configuration within the instance configuration. I must admit though, that being able to set an environment variable and have an IZopeDatabaseAdapter utility registered from that would make setting up functional tests much nicer. Currently, because of layers, all my functional tests run against a magical database test :((( -- Brian Sutherland ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Five and browser-oriented components
Martijn Faassen wrote: Technically, I think that this is going to be hard. You'd need to patch in the magic acquisition base class. Acquisition is the main reason that some of the code needed to be duplicated - without the existence of acquisition wrappers, security checks are not made for view access and things just won't work. I think if we could finish the philikon-aq_parent branch (or whatever it's called) that makes it possible to do acquisition using __parent__ pointers, we'd be a lot closer. Hanno and Philipp know more, but I think it's reasonably close. We do explicit acquisition in those bits of code, but it's still a pain and leads to confusion around self.context in views being acquisition-wrapped weirdly, breaking some expectations around aq_parent. And other bizarre things sometimes. The way to get rid of many of these problems would be to get rid of the need for acquisition. Philipp started a branch long ago that allows the acquisition system to look at a __parent__ pointer if no acquisition wrapper is present. Since our views have __parent__ pointers, this should fix the issue. This branch has been lingering in an almost ready state for a long time now. Ah, great minds think alike. ;) Martin -- Author of `Professional Plone Development`, a book for developers who want to work with Plone. See http://martinaspeli.net/plone-book ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] [zope.testing.doctest] a nasty surprise
Marius Gedminas wrote at 2008-4-10 22:37 +0300: ... doctest monkey-patches pdb.set_trace (in an ugly way, IMHO) to restore sys.stdout, because you want the output from pdb commands like 'list' or 'print' to go to your console, and not to the doctest's actual result StringIO collector. Apparently, doctest has replaced my set_trace in zpdb by its non working implementation of set_trace. I find it hard to believe. It's more likely that zpdb is interacting with pdb.set_trace in a way that conflicts with doctest's monkey-patch. Is the zdpb module available on the web somewhere? dm.pdb is on PyPI. And your intuition is right. zpdb rebinds pdb.set_trace overriding the name Pdb. Now, I also understand how the TypeError results: doctest has replaced the function set_trace by an instance method. Rebinding unwraps the InstanceMethod and operates only on the enclosed function -- the implicit instance argument is lost. -- Dieter ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Five and browser-oriented components
Hi. Martin Aspeli wrote: Martijn Faassen wrote: Technically, I think that this is going to be hard. You'd need to patch in the magic acquisition base class. Acquisition is the main reason that some of the code needed to be duplicated - without the existence of acquisition wrappers, security checks are not made for view access and things just won't work. I think if we could finish the philikon-aq_parent branch (or whatever it's called) that makes it possible to do acquisition using __parent__ pointers, we'd be a lot closer. Hanno and Philipp know more, but I think it's reasonably close. It is reasonably close but as stated in some threads a few month back I hit some problems which I cannot solve (not even with walking up stack frames...). As the problems only showed themselves while doing browser testing inside Plone, I guess I can at least write some unit tests for them, so someone else can actually take a look at them more easily. I'll see if I can do that during my next 10% day [1] :) Hanno [1] http://www.jarn.com/blog/the-10-plone-manifesto ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: straighting out the SQLAlchemy integration mess
On Thu, Apr 10, 2008 at 1:31 PM, Andreas Jung [EMAIL PROTECTED] wrote: --On 10. April 2008 19:10:49 +0200 Brian Sutherland [EMAIL PROTECTED] wrote: Just adding my few requirements: - Integration into the component architecture in such a way that I can specify the db connection parameters in ZCML and that database reflection still works. I want to be able to get a handle on SQLAlchemy things by calling getUtility. Please *NO* database specific configurations within ZCML. We're running applications in up three or four different environments and I don't want to maintain instance specific configurations within ZCML. Either we pass such informations through environment variables or the database connections parameters are read from a configuration within the instance configuration. i still don't see the harm having zcml db conf in a base package, if you don't have to use it to setup your particular deployment's connections. -kapil ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: straighting out the SQLAlchemy integration mess
Andreas Jung wrote: --On 10. April 2008 19:10:49 +0200 Brian Sutherland [EMAIL PROTECTED] wrote: Just adding my few requirements: - Integration into the component architecture in such a way that I can specify the db connection parameters in ZCML and that database reflection still works. I want to be able to get a handle on SQLAlchemy things by calling getUtility. Please *NO* database specific configurations within ZCML. We're running applications in up three or four different environments and I don't want to maintain instance specific configurations within ZCML. Either we pass such informations through environment variables or the database connections parameters are read from a configuration within the instance configuration. As long as it can also be specified in the code, that way people can build UIs to set up the connection. Perhaps that's what you mean by a configuration within the instance configuration. Regards, Martijn ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Five and browser-oriented components
Hanno Schlichting wrote: [snip] As the problems only showed themselves while doing browser testing inside Plone, I guess I can at least write some unit tests for them, so someone else can actually take a look at them more easily. I'll see if I can do that during my next 10% day [1] :) Yes, it'd be cool to have some tests that demonstrate the failure. Then come back to this list and bug people until they look into this. Regards, Martijn ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: straighting out the SQLAlchemy integration mess
--On 10. April 2008 21:29:43 +0200 Brian Sutherland [EMAIL PROTECTED] wrote: On Thu, Apr 10, 2008 at 07:31:54PM +0200, Andreas Jung wrote: --On 10. April 2008 19:10:49 +0200 Brian Sutherland [EMAIL PROTECTED] wrote: Just adding my few requirements: - Integration into the component architecture in such a way that I can specify the db connection parameters in ZCML and that database reflection still works. I want to be able to get a handle on SQLAlchemy things by calling getUtility. Please *NO* database specific configurations within ZCML. We're running applications in up three or four different environments and I don't want to maintain instance specific configurations within ZCML. Either we pass such informations through environment variables or the database connections parameters are read from a configuration within the instance configuration. What defines if something is the instance configuration? Isn't ZCML just another format of configuration file? I agree it's evil to hardcode database connections in the application as they must be under the control of the sysadmin. But that doesn't preclude them from being expressed in zcml. The point is: we don't need yet another configuration language for the configuration of a site. ZCML should be used for the purpose it has been intended for: for the configuration of the components of your site (easily spoken). This kind of configuration is static if you setup a site for project X. But settings like ports, paths etc. often differ between dev, test and production environments. We already have ZConfig as standard cofniguration language for instance specific configuration aspects. In addition: we often do use environment variables and .ini files for additional configurations. Introducing another configuration language is stupid. Especially because system administrators or co-workers know little or nothing about ZCML. This is an unnecessary introduction of complexity. Setting an environment variable with a DSN is much easier then having to fiddle around with ZCML and XML...totally unnecessary overheadkeep it simple ...using ZCML in this configuration context is only for XML masochists. Andreas pgpyigxtKwGmK.pgp Description: PGP signature ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope] Re: i18n/L10n support in zope2
Maurits, Thanks for the reply and suggestions. I tried i18n:translate=, it works fine. But if I change domain (e.g i18n:domain=mydomain) it doesn't work. Is domain attribute is related to the domain specified in .po file, coz the example .po file which comes with PlacelessTranslationService has domain as 'PlacelessTranslationService' and if I used same it works fine. Actually I used i18n:target after reading - http://wiki.zope.org/zope3/ZPTInternationalizationExamples. I do understand that these are zope3 examples, but just thought of giving try. While searching further I found - https://bugs.launchpad.net/zope2/+bug/142771 which gives hint that i18n:target not supported at least for Zope 2.9.7-final, python 2.4.4, win32 I will try to check for incoming browser headers, but does zope provides any inbuilt method to do so ? Thank you, Harshad. Maurits van Rees wrote: harshad behere, on 2008-04-09: Dear list members, I am newbie/begineer in area of zope2 + i18n/L10n so please excuse me if this topic has already been discussed on the list, in that case can some one please point me to the past discussions/threads. After reading some basics about i18n+zope2, I have tried following - (zope version - Zope 2.9.7-final, python 2.4.4, win32 and Placeless Translation Service - 1.3.7) Created simple page template - html body span i18n:domain=PlacelessTranslationService i18n:translate=Reload this catalog Reload this catalog /span /body /html I would expect either: i18n:translate= so that the string behind it ends up in the .pot file (and you don't repeat yourself needlessly; also think what would happen when you change one string but forget to change the other). Or: i18n:translate=reload_this_catalog or some other unique message id. But the above code should work. Well, using PlacelessTranslationService as i18n:domain is strange. You should use the name of your own product/package. Modified language preferences for browsers - (Mozilla Firefox 2.0.0.4 and MS-IE 7.0.5730.11) to set German [de] as primary langage. When I viewed above page in firfox got the corresponing german translation (Diesen Katalog neu einlesen) as specified in related .po file. But with MS-IE, no luck, gives same string - Reload this catalog So is it browser specific/dependable ? It should not. Do you have a way to check which browser headers are sent by IE and firefox and if they differ in the language preference? Another thing I tried is adding attribute i18n:target=cs, but it seems to have no effect, firefox gives german translation as per language settings as MS-IE gives same string - Reload this catalog Does it means that attribute target is not supported ? Is there any list/documentation about supported i18n attributes ? I have never seen that attribute. From the top of my head, these i18n attributes are used in zope: translate, domain, name and attributes. Also I was not able to find references/examples for DTML, does DTML supports i18n/L10n ? No. At least, I do not think so, and this grep in a buildout did not return any relevant results: grep i18n $(find . -name '*dtml') ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Conditional dtml-boundary in dtml-sendmail
Andreas Jung wrote: I started shivering while reading your code. We would have written such code five or six years ago - because we had no other choice. Please use the standard 'email' module of Python...this just works and you don't need to write such ugly and error-prone DTML code. There's also MailTemplates if you're stuck in Zope 2 land: http://www.simplistix.co.uk/software/zope/mailtemplates cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: i18n/L10n support in zope2
harshad behere, on 2008-04-10: Maurits, Thanks for the reply and suggestions. I tried i18n:translate=, it works fine. But if I change domain (e.g i18n:domain=mydomain) it doesn't work. Is domain attribute is related to the domain specified in .po file, coz the example .po file which comes with PlacelessTranslationService has domain as 'PlacelessTranslationService' and if I used same it works fine. Yes, the two should be the same. But if you use this domain and other people use it too because it is the standard example then you can get conflicting translations. Actually I used i18n:target after reading - http://wiki.zope.org/zope3/ZPTInternationalizationExamples. I do understand that these are zope3 examples, but just thought of giving try. While searching further I found - https://bugs.launchpad.net/zope2/+bug/142771 which gives hint that i18n:target not supported at least for Zope 2.9.7-final, python 2.4.4, win32 I have never seen it used anywhere. My i18n experience is with Zope 2.9 and 2.10 though, not pure Zope 3, so maybe it works fine there. I will try to check for incoming browser headers, but does zope provides any inbuilt method to do so ? In Firefox you can use the livehttpheaders extension to check those. I don't know if there is something similar to IE. In zope this information should be visible somewhere in the request object. To display the complete request in a page template for inspection you can probably do this: div tal:replace=structure request / or simply this div tal:content=request / -- Maurits van Rees | http://maurits.vanrees.org/ Work | http://zestsoftware.nl/ This is your day, don't let them take it away. [Barlow Girl] ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Help writing test where bobobase_modification_time changes
Peter Bengtsson wrote: How can I solve this? Make one big transaction two without having to use transaction.get().commit() which I don't think I can use in unit tests as per Dieter's advice. I'd suggest monkeypatching bobobase_modification_time on the objects you're testing with. You're testing your cache code, not the implementation of those objects, so replacing them with (partially) dummy objects is great for avoiding this kind of problem and is a pattern I've used frequently... cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Re: Conditional dtml-boundary in dtml-sendmail
--On 10. April 2008 11:00:14 +0200 Josef Meile [EMAIL PROTECTED] wrote: I started shivering while reading your code. We would have written such code five or six years ago - because we had no other choice. Please use the standard 'email' module of Python...this just works and you don't need to write such ugly and error-prone DTML code. Yes, I know it is ugly and I would like to use python instead, but as I said before I can't use the email module of python since the Machine were the page is hosted isn't administrated by me, so, there isn't any change of allowing or installing a python module. The 'email' module is part of the standard Python distribution since generations. Andreas pgpL3UQxa1RcA.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: Conditional dtml-boundary in dtml-sendmail
I started shivering while reading your code. We would have written such code five or six years ago - because we had no other choice. Please use the standard 'email' module of Python...this just works and you don't need to write such ugly and error-prone DTML code. Yes, I know it is ugly and I would like to use python instead, but as I said before I can't use the email module of python since the Machine were the page is hosted isn't administrated by me, so, there isn't any change of allowing or installing a python module. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Re: i18n/L10n support in zope2
Maurits van Rees wrote: In Firefox you can use the livehttpheaders extension to check those. I don't know if there is something similar to IE. In zope this information should be visible somewhere in the request object. To display the complete request in a page template for inspection you can probably do this: div tal:replace=structure request / or simply this div tal:content=request / Ooops.. I missed out REQUEST While debugging negotiation mechanizm of PTS I found following headers are being consulted - HTTP_ACCEPT_LANGUAGE, _pts_negotiator_cache_language,_pts_catalog_names_PlacelessTranslationService_??? And here are the details -- MS-IE 7.0.5730.11 -- HTTP_ACCEPT_LANGUAGE 'de-DE,en-us;q=0.5' _pts_negotiator_cache_language {('cs', 'el', 'de', 'pt-br', 'en'): None} _pts_catalog_names_PlacelessTranslationService_none [] Mozilla Firefox 2.0.0.4 -- HTTP_ACCEPT_LANGUAGE'de,en;q=0.7,en-us;q=0.3' _pts_negotiator_cache_language{('cs', 'el', 'de', 'pt-br', 'en'): 'de'} _pts_catalog_names_PlacelessTranslationService_de ['PlacelessTranslationService.i18n-pts-de.po'] Here are related entries from .po file - Language-code: de\n Language-name: Deutsch\n I suspect 'de-DE' from MSIE is the issue here. Thank you, Harshad. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Conditional dtml-boundary in dtml-sendmail
The email library should be available to use with a Script (Python) and can be done all within the ZMI. Otherwise maybe use dtml-try? On Wed, Apr 9, 2008 at 4:40 PM, Josef Meile [EMAIL PROTECTED] wrote: Dear list I'm trying to send a multi-part email after having submitted a form. In that form, the user will give some basic information from him, then he will be able to send at most three files. This is my dtml-method to send email after having submitted the data: dtml-let email=REQUEST.get('aba_email_txt').encode('utf-8') name=REQUEST.get('aau_name_txt').encode('utf-8') lastName=REQUEST.get('aat_vorname_txt').encode('utf-8') company=REQUEST.get('aas_firma_txt').encode('utf-8') file1=REQUEST.get('aap_dateien_anhang_dat') file2=REQUEST.get('aaq_dateien_anhang_dat') file3=REQUEST.get('aar_dateien_anhang_dat') dtml-sendmail smtphost=my_host.my_domain.com To: [EMAIL PROTECTED] From: dtml-email; Subject: Anfrage dtml-name; dtml-lastName; - dtml-company; Content-Type: text/html; charset=utf-8 dtml-mime type=text/html; charset=utf-8 html body Some html code comes here /body /html dtml-boundary type=application/octet-stream disposition=attachment filename_expr=file1.filename dtml-var file1.read()dtml-boundary type=application/octet-stream disposition=attachment filename_expr=file2.filename dtml-var file2.read()dtml-boundary type=application/octet-stream disposition=attachment filename_expr=file3.filename dtml-var file3.read()/dtml-mime /dtml-sendmail /dtml-let Let's say that the user doesn't submit file3, on that case, zope will generate something like this: some_ramdom_id.dat and it will attach an empty file. I tried something like this: dtml-if file1.filename not in ['', None]dtml-boundary type=application/octet-stream disposition=attachment filename_expr=file1.filename dtml-var file1.read()/dtml-if However when I try to save, zope fails and says: Error Type: Document Template Parse Error Error Value: Unexpected tag, for tag dtml-boundary type=application/octet-stream disposition=attachment filename_expr=file1.filename , on line 215 of sendAnfrage The only way I found to cope with this was doing a script to validate if a file has whether a name or not, then I will return a dictionary like this: {'name': real_name_or_dummy_name, 'data': file.read()_or_dummy_text} So, I feed the boundary with a dummy file when no file was uploaded. I don't really like to send dummy files since it may confuse the person receiving the emails. Is there any better way of achieving this? Please note that since I'm working in the zmi and I'm not the administrator of the machine where my page is hosted, I can only use dtml to send mail :-(, thus using the python mail library isn't an option on this case. Best regards Josef ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Re: i18n/L10n support in zope2
Maurits van Rees wrote: harshad behere, on 2008-04-10: Maurits, Thanks for the reply and suggestions. I tried i18n:translate=, it works fine. But if I change domain (e.g i18n:domain=mydomain) it doesn't work. Is domain attribute is related to the domain specified in .po file, coz the example .po file which comes with PlacelessTranslationService has domain as 'PlacelessTranslationService' and if I used same it works fine. Yes, the two should be the same. But if you use this domain and other people use it too because it is the standard example then you can get conflicting translations. Yes completely agreed. I tried changing domain in given example .po file (e.g. to Domain=mydomain\n), but it doesn't work even after doing Reload catalog for corresponding .po file object using PTS ZMI. I found reload catalog works if we modify message ids/text. Any idea how PTS manages this headers (like Domain/Content-Type etc) ? Is it possible to reload/refresh/rebuild this information ? Thank you, Harshad. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Conditional dtml-boundary in dtml-sendmail
How is dtml more error-prone than python? I'd imagine that all depends on who's authoring it. On Wed, Apr 9, 2008 at 11:59 PM, Andreas Jung [EMAIL PROTECTED] wrote: --On 9. April 2008 22:40:01 +0200 Josef Meile [EMAIL PROTECTED] wrote: Dear list I'm trying to send a multi-part email after having submitted a form. In that form, the user will give some basic information from him, then he will be able to send at most three files. I started shivering while reading your code. We would have written such code five or six years ago - because we had no other choice. Please use the standard 'email' module of Python...this just works and you don't need to write such ugly and error-prone DTML code. -aj ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Re: i18n/L10n support in zope2
I tried changing domain in given example .po file (e.g. to Domain=mydomain\n), but it doesn't work even after doing Reload catalog for corresponding .po file object using PTS ZMI. I found reload catalog works if we modify message ids/text. Any idea how PTS manages this headers (like Domain/Content-Type etc) ? Is it possible to reload/refresh/rebuild this information ? While working further I found following work aroud ( may not be on correct path, but it works) -- Edit the headings part (e.g Domain/Language etc) for .po files and save file. -- Make use of PTS ZMI to delete corresponding ZODB object of .po file. -- Restart Zope. I also found workaound for MSIE behaviour, include heading call X-Is-Fallback-For: ?\n in your .po file. For e.g - X-Is-Fallback-For: de-de\n. After making change and updating sample page template - (English as primary language for both browsers) html body English - span i18n:domain=English i18n:translate= Reload this catalog /span br German - span i18n:domain=Germany i18n:translate= Reload this catalog /span br Czech - span i18n:domain=Czech i18n:translate= Reload this catalog /span br /body /html gives following o/p Mozilla Firefox 2.0.0.4 - -- English - Reload this catalog -- German - Reload this catalog -- Czech - Reload this catalog MS-IE 7.0.5730.11 - -- English - Reload this catalog -- German - Diesen Katalog neu einlesen -- Czech - Znovu nacĂst katalog Interest thing is that MSIE respects selected language hierarchy where as FireFox gives preference to the primary one. Here are the headers - Mozilla Firefox 2.0.0.4 HTTP_ACCEPT_LANGUAGE'en-us,en;q=0.8,de;q=0.5,cs;q=0.3' _pts_catalog_names_Germany_en[] _pts_catalog_names_Czech_en[] _pts_catalog_names_English_en [] _pts_negotiator_cache_language{('de', 'de-de', 'en'): 'en', ('en',): 'en', ('cs', 'cs-cz', 'en'): 'en'} MS-IE 7.0.5730.11 HTTP_ACCEPT_LANGUAGE 'en-us,de-DE;q=0.7,cs-CZ;q=0.3' _pts_catalog_names_Czech_cs-cz ['PlacelessTranslationService.i18n-pts-cs.po'] _pts_catalog_names_Germany_de-de ['PlacelessTranslationService.i18n-pts-de.po'] _pts_catalog_names_English_none [] _pts_negotiator_cache_language {('de', 'de-de', 'en'): 'de-de', ('en',): None, ('cs', 'cs-cz', 'en'): 'cs-cz'} Thank you, Harshad. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: Conditional dtml-boundary in dtml-sendmail
The 'email' module is part of the standard Python distribution since generations. Well, I said allowing or installing. I wasn't sure if it was and with allowing I meant by using allow_module or allow_class. I guess you can't just use this module without removing security assertions. I will try to confirm this. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: i18n/L10n support in zope2
harshad behere, on 2008-04-10: I also found workaound for MSIE behaviour, include heading call X-Is-Fallback-For: ?\n in your .po file. For e.g - X-Is-Fallback-For: de-de\n. Ah yes, that is the correct solution here indeed. After making change and updating sample page template - (English as primary language for both browsers) html body English - span i18n:domain=English i18n:translate= Reload this catalog /span br German - span i18n:domain=Germany i18n:translate= Reload this catalog /span br Czech - span i18n:domain=Czech i18n:translate= Reload this catalog /span br /body /html Huh? You now state languages in the i18n domain. Don't you mean to make this three times the same domain and then perhaps add the i18n:target en/de/cs? -- Maurits van Rees | http://maurits.vanrees.org/ Work | http://zestsoftware.nl/ This is your day, don't let them take it away. [Barlow Girl] ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Problem with zopectl debug
Dieter Maurer wrote: Manuel Vazquez Acosta wrote at 2008-4-7 15:21 -0400: Dieter Maurer wrote: That is very strange: zopectl debug uses almost exactly the same startup sequence as zopectl fg (at least until after the configuration). Thus, if your Zope starts at all, zopectl debug should start. ... zopectl fg starts. Would need to see the starting sequence? Really funny Unfortunately, this means that is will be quite difficult to find the cause of your problem. One approach would be to emulate in a pure Python interpreter what zopectl debug would do for us. You may try: bin/zopectl shell # will create a new shell process with the correct environment your_zope_python from Zope2.Startup.run import configure configure('etc/zope.conf') # this is likely to raise the exception you have earlier reported from pdb import pm pm() # analyse the exception context I will try that. Any thing happens I report back to the list. Best regards, Manuel. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Upgrade to 2.7.2 results in all content unavailable
I upgraded to Zope 2.7.2 and all of my content can't be seen by Zope. Honestly I'm not sure what the previous version I was running was (nor am I sure how to find out). Now, every page results in Site Error An error was encountered while publishing this resource. Resource not found Sorry, the requested resource does not exist. Check the URL and try again. Resource: Zope GET There is effectively no more web interface. I've verified that the database still seems to be there in [instance]/var/Data.fs and hasn't been touched since the update. I tried going through some of the steps in the Troubleshooting and Debugging page http://www.zope.org/Documentation/Books/ZDG/current/TestingAndDebugging.stx I can do a ZPublisher.Zope('/manage') in python and see that it returns a Resource not found page. Interestingly, my log which was being written to /var/log/zope started writing to the default location after the install. I feel like there isn't enough here to determine whether there is a bug or whether I've mucked something up myself. But perhaps some gentle guidance would help me determine whether there is a bug or just my own ignorance. Was there a config file that got overwritten in the update? Where would it be? Perhaps there are some clues in the lines written to the log file upon startup. Old log file: 2008-04-10T14:43:08 INFO(0) ZServer HTTP server started at Thu Apr 10 14:43:08 2008 Hostname: library.ucsc.edu Port: 8080 -- 2008-04-10T14:43:08 INFO(0) ZServer FTP server started at Thu Apr 10 14:43:08 2008 Hostname: library.ucsc.edu Port: 8021 -- 2008-04-10T14:43:08 INFO(0) Zope Set effective user to zope -- 2008-04-10T14:43:12 PROBLEM(100) Init Ambiguous name for method of Products.ZpdfDocument.ZpdfDocument.ZpdfDoc ument: manage != manage_main -- 2008-04-10T14:43:12 PROBLEM(100) Init Ambiguous name for method of Products.ZpdfDocument.ZpdfDocument.ZpdfDoc ument: manage != manage_editForm -- 2008-04-10T14:43:12 PROBLEM(100) Init Ambiguous name for method of Products.ZpdfDocument.ZpdfDocument.ZpdfDoc ument: manage != manage_editDocument -- 2008-04-10T14:43:14 INFO(0) ZODB Opening database for mounting: '146584832_1040950278.401039' -- 2008-04-10T14:43:14 INFO(0) ZODB Mounted database '146584832_1040950278.401039' at /temp_folder -- 2008-04-10T14:43:14 INFO(0) Zope Ready to handle requests New log file: 2008-04-10T16:45:20 INFO ZServer HTTP server started at Thu Apr 10 16:45:20 2008 Hostname: 0.0.0.0 Port: 8080 -- 2008-04-10T16:45:20 WARNING Init Class Products.HappySession.HappySession.HappySess ion has a security declaration for nonexistent method 'manage_menu' -- 2008-04-10T16:45:21 WARNING Init Ambiguous name for method of Products.ZpdfDocument .ZpdfDocument.ZpdfDocument: 'manage' != 'manage_main' -- 2008-04-10T16:45:21 WARNING Init Ambiguous name for method of Products.ZpdfDocument .ZpdfDocument.ZpdfDocument: 'manage' != 'manage_editDocument' -- 2008-04-10T16:45:21 WARNING Init Ambiguous name for method of Products.ZpdfDocument .ZpdfDocument.ZpdfDocument: 'manage' != 'manage_editForm' -- 2008-04-10T16:45:22 INFO Zope Ready to handle requests W. --- Wes Modes McHenry Library Computing Network Services Information and Technology Services 459-5208 ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] retrieving a single column from database and giving it as hyper link fetching respective data
Dear all, I'm developing a biological database using Zope 2.6 and pgsql. Let me explain my issue with an example. There is a menu called Drug in my homepage, by clicking the menu the drug names along with their type in two different columns get displayed in the body. I can do things till that. My problem is , lets say there is a link called Isoniazid with all other links(drug names) in it. When a user clicks one of the links as i said before as isoniazid only the information about isoniazid has to be retreived and displayed , likewise to all the other drug links. I have no idea how to capture the click event and the data to be retrieved. Can someone help. Thanks in advance. And another query, how can i select text from a dropdown box. I just need the data which is selected in the dropdown box and sent as query. Thanks again. -- Best Regards \madhan Things must be learned only to be unlearned again or, more likely, to be corrected. -- Richard Feynman ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Upgrade to 2.7.2 results in all content unavailable
--On 10. April 2008 21:04:40 -0700 Wes Modes [EMAIL PROTECTED] wrote: I upgraded to Zope 2.7.2 and all of my content can't be seen by Zope. Honestly I'm not sure what the previous version I was running was (nor am I sure how to find out). If you upgrade then you should upgrade to the latest Zope version or at least to the latest 2.7 version. What's the reason for picking just _some_ 2.7 version? If you're application works then better stick with your working solution. 2.7 is out-dated since a long. If you really want to upgrade, then choose the latest 2.10 version. -aj pgpOuUzkjPTxZ.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] retrieving a single column from database and giving it as hyper link fetching respective data
--On 11. April 2008 10:32:15 +0530 member madhangc [EMAIL PROTECTED] wrote: Dear all, I'm developing a biological database using Zope 2.6 and pgsql. Let me explain my issue with an example. There is a menu called Drug in my homepage, by clicking the menu the drug names along with their type in two different columns get displayed in the body. I can do things till that. My problem is , lets say there is a link called Isoniazid with all other links(drug names) in it. When a user clicks one of the links as i said before as isoniazid only the information about isoniazid has to be retreived and displayed , likewise to all the other drug links. I have no idea how to capture the click event and the data to be retrieved. Can someone help. Thanks in advance. And another query, how can i select text from a dropdown box. I just need the data which is selected in the dropdown box and sent as query. This issue is basically not related to Zope. You can achieve your goal using Javascript. I recommended looking at some elementary HTML and Javascript tutorial. Andreas pgpYCJ1yt0Ymi.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )