Re: [Zope3-Users] ZODB and unique values
On Aug 3, 2009, at 3:00 PM, Gustavo Rahal wrote: So, i'm reading zope3 web component architecture book (quite cool by the way) and since i'm too SQL DB oriented I was wondering how to garantee fields uniqueness in ZODB. For instance, if I have a IMachine interface, I want the ip_address field to be unique across all machine objects. Is that something I have to tie in the validation routine of ip_address? Other options? A classic approach would be to take advantage of transactions with an index that you maintain. Have a data structure (index-ish) that keeps track of used ip addresses. Update the data structure in the same transaction that creates and assigns it. When you commit the transaction, if another concurrent transaction used that IP, one of them gets a conflict error. Otherwise, you're good. You need to be aware of three potential gotchas with this approach. First, if this is going to be a lot of data, you need to make sure that the data structure you use is divided across multiple persistent objects so that one write does not cause the data for the entire set to be written. Second, if there's going to be a fair amount of concurrency, you need to make sure that insertions in the data structure do not always want to write to the same object--so for instance, you do *not* want to use an approach that will make all potential concurrent IP address creations the same. Third, if the collection (index) you are using uses conflict resolution, you need to understand it and make sure its behavior will not break the transactional constraints that you want to enforce. Practically, using the BTrees that the ZODB provides will typically have the behavior you want for the first and third gotcha. For the second gotcha, we typically give each connection to the ZODB its own random starting point stored on a volatile (disposable) attribute for the index, and each connection increments that point. Look at the code in zope.intid, for instance: _generateId in http://svn.zope.org/zope.intid/trunk/src/zope/intid/__init__.py?rev=100049view=auto . Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Zope 3 and code reuse
On Apr 15, 2009, at 9:26 AM, Kent Tenney wrote: Howdy, Something I wonder about: One of the benefits offered by the Zope Component Architecture is the ability to use interfaces and adapters to leverage legacy code. To what extent is this theory being practiced? I've seen replacement of key parts of the publication machinery, key parts of the security machinery, and so on. The system is great for replacing and redefining legacy bits designed with the ZCA from the start. It also allows us to replace parts of the system with new implementations based on new or legacy libraries. I've only seen this work with new libraries that I can think of. I believe the Zope 2 switch from Acquisition to zope.location is an example of this actually working precisely as you ask. Perhaps someone from the Zope 2 world can confirm or correct. Conversely, what about writing implementations with an eye to their use outside the ZCA? I'm afraid that question is a bit too broad for me. The zope community has created libraries that then are used for building components in ZCA-based systems...and it's easy to produce packages that have interfaces (so only a dependency on zope.interface directly) but can therefore be registered as components if desired Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Last zc.async package for Zope-3.3.1
On Oct 20, 2008, at 3:13 PM, Thierry Florac wrote: Hi, Actually using Zope-3.3.1, I'm looking at zc.async package but the last release is no more compatible with my Zope release. Could anyone point me to the last compatible release ?? Thanks, Thierry Florac Hi Thierry. The 1.0 release and following have only been tested on 3.4 (eggs, actually). Did you use a pre-1.0 release before? Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zc.async in Zope2/Plone
On Sep 12, 2008, at 7:16 PM, Santiago Videla wrote: Hi Gary, If you want a Zope 2 instance to run the zc.async dispatcher/worker threads, then it might be better to get the DB that zope is using. In Zope 3, there's an event you can subscribe to to get the DB. Maybe there's something similar in Zope 2 these days? I found it. but I'm not sure if really fire the event at any moment. in my configure.zcml I have: subscriber for=zope.app.appsetup. IDatabaseOpenedEvent handler=.handlers.zcasync_config_handler / the instance starts, but it seems that the handler never run You explained this in the email today. Good to know. That means in 2.11 the zc.async setup might be extremely close to that of Zope 3. Cool! 2008-09-12 02:20:01 ERROR zc.async.events UUID 10c69742-8084-11dd-9853-0016d3094e86 already activated in queue (oid 44148): another process? (To stop poll attempts in this process, set ``zc.async.dispatcher.get().activated = False``. To stop polls permanently, don't start a zc.async.dispatcher!) Maybe you are running your tests while you are running your app instance, and that both of them actually connect to your real live ZEO. Or maybe you are starting a dispatcher yourself, *and* zc.async.ftesting.setUp is starting a dispatcher? (ftesting setUp does start one.) right, and what about running many clients with one ZEO. Many clients with one ZEO server is just fine, as long as they have their own UUID. This newer version of the quickstart, based on trunk, explains the idea (look for the Monte Carlo discussion in the second half). http://svn.zope.org/zc.async/trunk/src/zc/async/QUICKSTART_1_VIRTUALENV.txt?rev=90112view=auto The sphinx-processed version of this file is much easier to read, but I don't want to upload that until I have the release that it describes! I'm getting the same error and I don't understand what to do, this is why I need to get the DB that zope is using? No, you don't have to get the same DB. Just maybe cleaner. Each dispatcher process needs its own UUID, as saved in uuid.txt, as controllable by an environmental variable. If you hunt around, I bet you'll find a uuid.txt, probably in the same directory that you usually start your process. If you read that text, you'll see something like this: afd1e0d0-52e1-11dd-879b-0017f2c49bdd The value above (and this file) is created and used by the zc.async package. It is intended to uniquely identify this software instance when it is used to start a zc.async dispatcher. This allows multiple dispatchers, each in its own software instance, to connect to a single database to do work. In order to decide where to look for this file (or to create it, if necessary), the module looks in ``os.environ['ZC_ASYNC_UUID']`` for a file name. If you are using zdaemon (http://pypi.python.org/pypi/zdaemon) to daemonize your process, you can set this in a zdaemon environment section of your zdaemon.conf. Supervisor (http://supervisord.org/) also provides this functionality. Other similar tools probably do as well. If the ``ZC_ASYNC_UUID`` is not found in the environment, it will use ``os.path.join(os.getgwd(), 'uuid.txt')`` as the file name. To get a new identifier for this software instance, delete this file, restart Python, and import zc.async.instanceuuid. This file will be recreated with a new value. thanks for your help again, and sorry for my ignorance Don't apologize! I've spent a lot of time on docs, but they still are far from what I want. The virtualenv quickstart is good, but I need to finish the grok quickstart I have--and then maybe add a Zope 2.11 quickstart! Thanks Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zc.async in Zope2/Plone
On Sep 13, 2008, at 2:43 PM, Santiago Videla wrote: Hi, more reports... :) If you want a Zope 2 instance to run the zc.async dispatcher/worker threads, then it might be better to get the DB that zope is using. In Zope 3, there's an event you can subscribe to to get the DB. Maybe there's something similar in Zope 2 these days? I found that this event it's fired since Zope2.11, but I'm using Zope2.10.6 (actually repoze.zope use this version), so I left this option What I did to run more than 1 client instance, is to set the environment variable ZC_ASYNC_UUID from supervisord.conf for each client instance. oops, I just told you about this in the other email, after having skimmed this one too lightly. :-) This will start one dispatcher per instance, right? is that ok? That's exactly right--exactly the intent. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zc.async in Zope2/Plone
On Sep 12, 2008, at 1:23 AM, Santiago Videla wrote: Well, after some hours and many buildouts done, I couldn't get this running. The best approach I got is like this (using repoze.plone): 1) just run the standard buildout.cfg for repoze.plone 2) add zc.async to the eggs section in the buildout and run again. It's important to add the egg here, when I added just to the extra- requirements in the setup.py of my egg, it doesn't work. Something about IOBTree.family32 it's raised... sorry, I didn't copy the traceback 3) Here, the instance starts, but tests won't work. I had to edit the test script, to move down the import of zope.testing. after that, tests are running. Obviously, running the buildout again, will overwrite this change I will try to keep working on this, but I have to move on these days Understood. It's a good start. Thanks for the report! Now, a question about the usage of zc.async, I followed the docs in the QUICKSTART txt In my egg I have this __init__.py = import ZEO.ClientStorage import ZODB import zc.async.configure storage = ZEO.ClientStorage.ClientStorage( ('127.0.0.1', 8881), name='zeostorage', ) db = ZODB.DB(storage, database_name='main') zc.async.configure.base() zc.async.configure.start(db, poll_interval=1) This is reasonable. This pattern is typical for a stand-alone zc.async instance. This will run the dispatcher in a thread. The next version (1.5) has an argument to ``start`` to have the dispatcher run in the main thread, if you'd prefer. If you want a Zope 2 instance to run the zc.async dispatcher/worker threads, then it might be better to get the DB that zope is using. In Zope 3, there's an event you can subscribe to to get the DB. Maybe there's something similar in Zope 2 these days? = some_handlers.py = import zc.async.interfaces def async_job(): From your use of ``Job`` below, I suspect this takes a single argument, ``portal``, in the real code. do something def some_job(context): urltool = getToolByName(context, portal_url) portal = urltool.getPortalObject() #portal._p_jar give us the connection to the ZODB queue = zc.async.interfaces.IQueue(portal._p_jar) This is fine, but I wonder if you have to add the _p_jar... Maybe for this upcoming version I just added the registration to adapt a persistent object, in addition to a connection? Not sure offhand, and I have to run. I'd expect this to not require the _p_jar: ``queue = zc.async.interfaces.IQueue(portal)`` job = queue.put(zc.async.job.Job( async_job, portal.aq_base) ) If you're not going to do anything further with the job, then you could just leave out ``job =``, of course. == This code it's running and it works, but I'm not sure if it's the correct usage... Gary? Looks fine. :-) If you discover that you are doing the same Zope2-specific (or Plone- specific) setup/teardown for all your jobs, notice that you can have a Job subclass that defines setUp and tearDown. See what z3.py does, for instance. Last question, when I run my test, I'm getting this error 2008-09-12 02:20:01 ERROR zc.async.events UUID 10c69742-8084-11dd-9853-0016d3094e86 already activated in queue (oid 44148): another process? (To stop poll attempts in this process, set ``zc.async.dispatcher.get().activated = False``. To stop polls permanently, don't start a zc.async.dispatcher!) Maybe you are running your tests while you are running your app instance, and that both of them actually connect to your real live ZEO. Or maybe you are starting a dispatcher yourself, *and* zc.async.ftesting.setUp is starting a dispatcher? (ftesting setUp does start one.) I was reading ftesting.txt from zc.async but I yet don't understand what should I do, any hints? best regards On Thu, Sep 11, 2008 at 5:51 PM, Michael Dunstan [EMAIL PROTECTED] wrote: On Fri, Sep 12, 2008 at 5:02 AM, Santiago Videla [EMAIL PROTECTED] wrote: Hi guys, z3c.recipe.fakezope2eggs lets you tame these kind of dependencies. See http://pypi.python.org/pypi/z3c.recipe.fakezope2eggs plone.recipe.zope2install includes a couple of options for making use of that too. See http://pypi.python.org/pypi/plone.recipe.zope2install Nice, I will try those. But I have another issue... :( I need to use repoze.plone and I don't have any zope2 section in my buildout.cfg (needed to use fakezope2eggs). I need to find a way to tell to fakezope2eggs where is the python/lib/zope directory I think you should be able to do that by declaring a zope2-location for the z3c.recipe.fakezope2eggs part. [fakezope2eggs] recipe =
Re: [Zope3-Users] zc.async in Zope2/Plone
On Sep 10, 2008, at 2:55 PM, Santiago Videla wrote: Hi people, Hi! I want to use zc.async in a Zope2/Plone web app. The problem that I found it's that zc.async requires zope.testing. When I run buildout it seems that zope.testing overwrite the testing module from zope2 (instance/lib/python/zope/testing) and when I try to run my automated tests I get an error in testrunner.py about 'other' attribute That's a shame. Could it be that, if you specify a version of zope.testing in your setup.py that is equivalent to the version of zope.testing in your Plone app, the overwriting happens but without ill effects? I bet that would work. The questions are: * it's possible to run zc.async over Zope2 ? I sure hope so. I intend it to be. :-) I think it is, in fact, I have it running (I think), yay! but the tests get broken as I said Mm. :-( * How can I solve this problem?? There is any way to say in the buildout.cfg: Ignore the zope.testing package Not at the moment. I have been following the ZC opinion--brought about by pain, not theory, BTW--that test dependencies should be included as primary dependencies. However, your story seems like a reason to divide up the requirements, especially if my first suggestion doesn't work for you. Maybe I'll do that for the next release (1.5.0) which I hope/intend to make in the next 7 days. If that's not soon enough, you could make a local release for yourself, as you mention below, that divides out or removes the requirement. I guess that I won't be able to run the tests for zc.async, but I can live with that... Right. It's a shame and an annoyance, but not necessarily a show- stopper. * If I find a way to remove zope.testing, (downloading the source and removing that requirement, I know it's ugly) could that get me into troubles ?? I don't believe so. Though there are no automated tests to guarantee that, of course. :-) * Could zope.testing be require for something else than tests over zc.async and it's dependecies?? That is not the intent. So, to repeat, I *want* it to work (easily!) in Zope 2/Plone. I think your best solution is to see if you can pin the zope.testing egg to the same version that your Zope 2/Plone app currently uses, and see if it works. If that fails, let me know. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zc.async in Zope2/Plone
On Sep 10, 2008, at 5:01 PM, Santiago Videla wrote: Hi Gary thanks for the help That's a shame. Could it be that, if you specify a version of zope.testing in your setup.py that is equivalent to the version of zope.testing in your Plone app, the overwriting happens but without ill effects? I bet that would work. I will have to this with all the packages that zc.async requires, right? zope.component zope.interface zope.testing ... and so on Well, for a stable production, I believe you'll want to specify all of those, yeah. For your specific problem here, it's less clear. For a first cut, I'd probably aim for the minimum changes that you discover you need, but yeah, another approach would be to specify all of the packages that overlap. I don't know which approach will be faster. what I don't know is where I can find what versions for each egg should I use. Latest plone use Zope.2.10.6. is there any place where I can see the versions? I found this: http://svn.zope.org/Zope2.buildout/trunk/versions-zope3.cfg?rev=90415view=markup but I'm not sure if it's correct http://www.zope.org/Products/Zope/2.10.6/Zope-2.10.6-released • Zope 3.3, Five 1.5 integration • replaced several Zope 2 modules with their sister implementation of Zope 3 I guess that I have to specify all the versions that Zope3.3 uses Zope 3.3 was not eggified. Looking on pypi (http://pypi.python.org/simple/zope.testing) it looks like you can try the 3.6 line, the 3.5 line, the 3.4 line or the 3.0 line. If you don't get success soon, let me know what the exact traceback you get is, and under what exact circumstance (running your own tests, right?). I might be able to suggest a specific zope.testing version. I suspect this won't be as easy as I would like until Zope 2/Plone is eggified. :-/ That said, having to specify versions wouldn't be too bad, once the version cocktail has been determined. Not at the moment. I have been following the ZC opinion--brought about by pain, not theory, BTW--that test dependencies should be included as primary dependencies. However, your story seems like a reason to divide up the requirements, especially if my first suggestion doesn't work for you. Maybe I'll do that for the next release (1.5.0) which I hope/ intend to make in the next 7 days. don't worry, others packages requires zope.testing as well * ZODB * zc.twist I hear you. FWIW, I can help with zc.twist if you want, but I doubt ZODB is going to change. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zc.async in Zope2/Plone
On Sep 10, 2008, at 5:27 PM, Michael Dunstan wrote: On Thu, Sep 11, 2008 at 6:55 AM, Santiago Videla [EMAIL PROTECTED] wrote: * How can I solve this problem?? There is any way to say in the buildout.cfg: Ignore the zope.testing package I guess that I won't be able to run the tests for zc.async, but I can live with that... z3c.recipe.fakezope2eggs lets you tame these kind of dependencies. See http://pypi.python.org/pypi/z3c.recipe.fakezope2eggs plone.recipe.zope2install includes a couple of options for making use of that too. See http://pypi.python.org/pypi/plone.recipe.zope2install Great! It would be great to have an example buildout of a Zope2 instance configured with zc.async. Yes! I'd love to include this in the docs too. Santiago, I won't have a chance to try this in Zope 2 for awhile, but I'd love to help, and to publicize your success. ;-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] demostorage does not support blobs
On Apr 20, 2008, at 7:13 AM, Benji York wrote: On Sun, Apr 20, 2008 at 4:52 AM, Christophe Combelles [EMAIL PROTECTED] wrote: Unsupported: Storing Blobs in ZODB.DemoStorage.DemoStorage instance at 0xb6fb8dcc is not supported. I don't know if DemoStorage is supposed to work or not, but as a work-around you can try zc.demostorage2 (http://pypi.python.org/pypi/zc.demostorage2 ). Naah, don't think it will help. BlobStorage is a storage proxy, expected to wrap around another storage. Try making a temp directory for the blob storage, setting up a blob storage around the demo storage, and then cleaning up the temp dir at the end of the test. ...or something else, depending on your use case/testing needs. :-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] query all objects in catalog
On Mar 6, 2008, at 1:42 PM, Robert Marianski wrote: Is there a way to query a zope3 catalog for all objects that have been indexed? I see that there is a way to ask an index for the number of documents it currently has indexed, via documentCount() in the IStatistics interface, but I can't a good way get back all objects that have been indexed. The intid utility kinda sorta does what you want, depending on how careful you were in your intid use. zc.catalog's extents do exactly what you want, but it doesn't sound like you are using that right now. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] query all objects in catalog
On Mar 6, 2008, at 2:18 PM, Robert Marianski wrote: On Thu, Mar 06, 2008 at 02:11:40PM -0500, Gary Poster wrote: On Mar 6, 2008, at 1:42 PM, Robert Marianski wrote: Is there a way to query a zope3 catalog for all objects that have been indexed? I see that there is a way to ask an index for the number of documents it currently has indexed, via documentCount() in the IStatistics interface, but I can't a good way get back all objects that have been indexed. The intid utility kinda sorta does what you want, depending on how careful you were in your intid use. I was using grok, so however that set it up. The intid utility did indeed have all the objects, but it had more objects than were indexed with the catalog ... so I would have to filter them out myself. Not sure if that's what you mean. Yup. zc.catalog's extents do exactly what you want, but it doesn't sound like you are using that right now. I'm not familiar with extents, I'll give them a look. Thanks. You can either be more careful about what you put in your intid utility (the standard Zope 3 subscribers are more indiscriminate than you might expect), or you can set up an extent on your catalog that filters out what you don't want and use that. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: how to model a 1-to-1 relation
On Jan 11, 2008, at 10:25 AM, Christophe Combelles wrote: Jürgen Kartnaller a écrit : john saponara wrote: I want to allow the user to create car and driver objects in a limoService container. Car objects will stand alone, but each driver object should contain a car object by reference (not by value) and the driver add form should allow the user to choose which car the new driver object will have. Should IDriver's car attribute be a schema.Object or a schema.Choice? Have a look at the package zc.relation and for a simple use of zc.relation use lovely.relation which provides relation properties for your objects. What is zc.relation compared to zc.relationship? zc.relation is zc.relationship NG. I have not released it yet. When I do, I'll also release a zc.relationship that is a wrapper of zc.relation. zc.relation has MUCH fewer dependencies, so it is more of a ZODB tool rather than a Zope tool; doesn't have the more user-friendly bits like the relationship container; and has some new features like transitive indexes that you can hook up. I have not released it because there a few features I want to test better (the new ``copy`` method in particular) and because I have been busy with other things. Gary___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zc.catalog's FilterExtent (with hurry.query)
On Oct 27, 2007, at 9:40 AM, Jesper Petersen wrote: Hey! I'm trying to understand if my idea of how to use the FilterExtent in zc.catalog (1.1.1) is correct (and efficient). I'm also using hurry.query (0.9.3). My current understanding of extents is: they can be used to perform a search on a subset of a catalog. For example, give me all objects where attr1 is 'foo' but only for intids 5,6,7 and 10 Short version: I have an extent of a large catalog. How do I make a search within this extent? Hi Jesper. Extents have a primary use case in the zc.catalog package of defining the extent of a catalog--a set of indexes. This is more efficient both in terms of programmer time and computer time than filtering out objects per-index. It also allows asking indexes questions that would otherwise be impossible, e.g., what objects do *not* match this particular search?, and a couple of others. I'm not sure hurry.query leverages all aspects of extents, and indexes that know how to deal with them. I seem to recall that it didn't, but I could have been wrong and it was a while ago. So, the primary use case is different than yours. Extents can be used in the way that you describe--intersecting against a larger search of a larger catalog. What you described is a reasonable first cut, and a reasonable use of extents. Depending on your use cases and the time available, you may want to explore optimizations. I wouldn't surprised if you eventually wanted to roll your own catalog to do the set operations in the ways that make the most sense for your application. A few quick thoughts: - If your common extents are really as small as in your examples, one thing to realize is that the time for an intersection in BTree code pretty much always is determined by the size of the smaller set. Therefore, given three sets that need to be intersected (say, your extent and the result of the search of two indexes) of relative sizes Small, Medium, and Large, you want to intersect in this way: intersect(intersect(Small, Medium), Large). See http://svn.zope.org/zc.relation/trunk/src/zc/relation/timeit/manual_intersection.py?view=auto for timeit fun, if you like. - there are two primary costs of a big catalog, IMO/IME: write time and load time. If necessary for your app, consider ways to try to keep smaller catalogs (e.g., does the value of some information diminish over time? Does it make sense to have separate catalogs, divided across some boundary or boundaries?); and consider ways to keep the catalog in memory (in the object cache). - if you typically only need the first X of a result set, doing something like Dieter Maurer's incremental search Zope 2 code would be interesting to research and might be appreciated by the community if it worked out well. Finally IMO/IME, only pursue these sometimes risky optimizations if they are really necessary and if you have some pretty concrete research or knowledge (your own or others) to back up your plan. If I were you I'd just start out with the do a search and then intersect with the extent approach you mentioned, and only worry about it more when your app needs it. HTH Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Modified IntId utility
On Sep 25, 2007, at 3:27 AM, Frank Burkhardt wrote: I'm using a modified IntId utility which starts IDs at 1 and counts upwards, too. I needed some permanent link for each object which was easy to implement via IntId. The modification was made to safe keystrokes when typing the permalink. Typing http://server/~251 is a lot easier than http://server/~344357462 :-) . However, I don't use those IDs for anything else - like sorting. We do. We use 64-bit intids arranged in ways that help with our most common sorting requirements (usually time related). Higher-order bits provide the sort order we care about, and the remaining lower- order bits provide randomness so that we reduce the chance of conflict errors. (It still can have a higher theoretical chance for conflict errors than the classic intid approach to assigning keys, but the BTree conflict resolution algorithm should eliminate the increase in practice.) So, we don't follow the exact pattern in the original post, and using the general pattern has subtleties you need to get right. For instance, you need to avoid conflict errors, as Stefan mentioned; and, for simplicity, we regard intids to be immutable and so they should only be tied to immutable data points about your objects. But we believe the idea--letting intids have meaning, particularly for sorting--has merit generally. ...sigh, we need to do some open-sourcing. We've been pretty busy. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Strange ZODB error
On Aug 10, 2007, at 2:30 AM, Christian Theune wrote: Am Donnerstag, den 09.08.2007, 09:52 -0400 schrieb Gary Poster: You probably need to find out what the object is for anyone to have a chance of helping. I usually just put a pdb in the ZODB that is triggered if there's an error here, and then start poking around. Using the postmortem debug publisher might work too, but it has caused enough problems for me in the past that I dropped it, myself. One way to do this is to use the http postmortem debugger server, especially helpful if you try to debug problems in code that is triggered many times in an app, but you only want to see the pdb when an error happens. That's what I meant by postmortem debugger publisher. I was being fuzzy: your terminology is correct. However, my observation stands. I know Jim likes it, among others, but I have found it to not work the way I want enough to be a nuisance. I seem to recall that this may be related to the ZODB connection being closed, but I could be remembering incorrectly. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Strange ZODB error
You probably need to find out what the object is for anyone to have a chance of helping. I usually just put a pdb in the ZODB that is triggered if there's an error here, and then start poking around. Using the postmortem debug publisher might work too, but it has caused enough problems for me in the past that I dropped it, myself. Gary On Aug 9, 2007, at 9:44 AM, Hermann Himmelbauer wrote: Hi, After updating some z3c packages and changing some of my code, I receive a very strange traceback from Zope3: -- Traceback (most recent call last): File /local/home/dusty/Zope-3.4.0b1/lib/python/zope/publisher/ publish.py, line 138, in publish publication.afterCall(request, obj) File /local/home/dusty/Zope-3.4.0b1/lib/python/zope/app/ publication/browser.py, line 78, in afterCall super(BrowserPublication, self).afterCall(request, ob) File /local/home/dusty/Zope-3.4.0b1/lib/python/zope/app/ publication/zopepublication.py, line 175, in afterCall txn.commit() File /local/home/dusty/Zope-3.4.0b1/lib/python/transaction/ _transaction.py, line 325, in commit self._commitResources() File /local/home/dusty/Zope-3.4.0b1/lib/python/transaction/ _transaction.py, line 424, in _commitResources rm.commit(self) File /local/home/dusty/Zope-3.4.0b1/lib/python/ZODB/ Connection.py, line 524, in commit self._commit(transaction) File /local/home/dusty/Zope-3.4.0b1/lib/python/ZODB/ Connection.py, line 569, in _commit self._store_objects(ObjectWriter(obj), transaction) File /local/home/dusty/Zope-3.4.0b1/lib/python/ZODB/ Connection.py, line 596, in _store_objects p = writer.serialize(obj) # This calls __getstate__ of obj File /local/home/dusty/Zope-3.4.0b1/lib/python/ZODB/ serialize.py, line 407, in serialize return self._dump(meta, obj.__getstate__()) File /local/home/dusty/Zope-3.4.0b1/lib/python/ZODB/ serialize.py, line 416, in _dump self._p.dump(state) File copy_reg.py, line 69, in _reduce_ex raise TypeError, can't pickle %s objects % base.__name__ TypeError: can't pickle file objects -- I ran all tests of additional z3c/zc packages, all went well, so it seems there's something wrong in my code, however I don't see where. I don't use any file objects, so I'm clueless... Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ 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: AW: [Zope3-Users] Re: Using svn checkout with zc packages
On Jul 30, 2007, at 10:46 AM, Roger Ineichen wrote: Hi Jeff, Betreff: Re: [Zope3-Users] Re: Using svn checkout with zc packages [...] I feel like I need a training course or consultancy to move to buildout, which requires time and money that we just don't have. Same belongs to me. I'm sitting here and have to debug code like: def foo(self, foo): bar = self.getBar(foo) return getMultiAdapter(bar, self.request) and bang I have to get a dev egg for the package which implements getMultiAdapter just that I can debug into getMultiAdapter. I don't know how somebody can say that's a good concept. For me as a heave *pdb* user it's defently not. Is there another option wich allows me not to checkout the half of the Zope trunk as dev eggs for serious debugging? short term hack: use eggs. go to your eggs directory and rm all of your pyc files. pdb will then work. long term: yeah, this needs to be fixed. Jim's aware of it. Has to do with how eggs are built. AIUI, fixing it would probably happen in setuptools. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.form 1.4.0, z3c.formui 1.1.0, and z3c.formdemo 1.2.0 released!
On Jun 29, 2007, at 10:50 AM, Stephan Richter wrote: Hello everyone, again thanks to the great feedback we received -- especially from David Pratt, Roy Mathew, and Joachim Werner -- we were able to fine-tune our new form framework even more to make it as robust of a foundation as possible for your projects! New features include group support, fully internationalized widgets for number and calendar fields, a richer select widget, refined form templates, and of course a new demo! BTW, congratulations to Roger who became father for the third time last weekend! Congratulations Roger! Again for the curious and impatient ... --- There is also a new demo, of course! The Questionnaire demo provides a form for filling out a simple questionaire about someones Zope community involvement and then provides a very simple results page. Technically this demo (available for the DIV- and Table-based layouts) demonstrates the usage of groups, a new feature of this release, as well as writing attribute value adapters. To run the demos do the following:: $ svn co svn://svn.zope.org/repos/main/z3c.formdemo/trunk formdemo $ cd formdemo $ python bootstrap.py $ ./bin/buildout -N This currently fails. :~/Dev/formdemo gary$ ./bin/buildout -N Develop: '/Users/gary/Dev/formdemo/.' Develop: '/Users/gary/Dev/formdemo/z3c.form' Traceback (most recent call last): File /tmp/tmp-58J2C, line 10, in ? execfile('/Users/gary/Dev/formdemo/z3c.form') IOError: [Errno 2] No such file or directory: '/Users/gary/Dev/ formdemo/z3c.form' While: Installing. Processing develop directory '/Users/gary/Dev/formdemo/z3c.form'. An internal error occured due to a bug in either zc.buildout or in a recipe being used: AssertionError: Should I just check out z3c.form and put a symlink in there? Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Re: zc.queue conflict question
On May 20, 2007, at 6:26 AM, Chris Withers wrote: Gary Poster wrote: Why does adding to identical objects to a queue at the same time result in a conflict? Surely they should both just get added in an artbitary order? Basically, the constraint allows for more powerful conflict resolution, or at least simpler code. Um, can you explain that? How is adding two dissimilar objects different from adding two identical objects? I'd certainly welcome a variation that removed the constraint, possibly in exchange for weaker conflict resolution, if you were willing to contribute it to zc.queue. Sure, but I'm still hazy on what the problem with adding two identical objects is. Can you explain? Sure. The `pull` is actually the interesting part, and it becomes more so when you allow an arbitrary pull. By asserting that you do not support having equal items in the queue at once, you can simply say that when you remove equal objects in the current state and the contemporary, conflicting state, it's a conflict error. Ideally you don't enter another equal item in that queue again, or else in fact this is still an error-prone heuristic: - start queue == [X]; - begin transactions A and B; - B removes X and commits; - transaction C adds X and Y and commits; - transaction A removes X and tries to commit, and conflict resolution code believes that it is ok to remove the new X from transaction C because it looks like it was just an addition of Y). Commit succeeds, and should not. If you don't assert that you can use equality to examine conflicts, then you have to come up with another heuristic. Given that the conflict resolution code only gets three states to resolve, I don't know of a reliable one. Therefore, zc.queue has a policy of assuming that it can use equality to distinguish items. It's limiting, but the code can have a better confidence of doing the right thing. Also, FWIW, this is policy I want: for my use cases, it would be possible to put in two items in a queue that handle the same issue. With the right equality code, this can be avoided with the policy the queue has now. It's worth noting that putting persistent.Persistent objects (or non- persistent objects that refer to persistent.Persistent objects in code used for conflict resolution) into objects with conflict- resolving behavior such as BTrees or zc.queues will stymie conflict resolution code, because persistent.Persistent objects other than the conflicted one are not around. This leads to a problem Jim and I recently discovered with zope.app.keyreference.persistent being used with intids. I intend to write up some blurbs about this and other issues in the zc.queue docs (although they are pertinent to BTrees too) asap. A collector issue would probably be in order too. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: zope.intid and UUIDs
On Apr 19, 2007, at 12:56 PM, Derek Richardson wrote: We've talked a lot about the composition alternative to my idea, but we haven't talked about my idea much. What is suboptimal with the way I'm proposing, other than that it requires changing zope core? Martin Aspeli had some concrete things to say about why subclassing, your proposal, is suboptimal in comparison to composition. He cast it as why composition would be better, which is simply the mirror image. His first point is particularly interesting: the composition approach might let Plone users leverage your code, which introduces it to a large community of users. They (or Zope 2 core? not sure) have their own intid utility. Composition will be simpler, both in the short and long term; or, if you prefer, to relate it to your proposal, the subclassing approach is suboptimal in comparison. Some more thoughts, FWIW: - I suggest that the implementation should be hidden away. One should be able to adapt an object to something like IUUID or IUUIDProvider. That way we can implement a variety of solutions, including a direct key-reference-to-UUID mapping, a intid-to-UUID mapping, a simple annotation, or other approaches. In other words, IMO, the main feature of your package should be an interface (or two, see below). - I imagine you also want to be able to find objects for a given UUID. I'd suggest an interface for that, which is used to look up a utility. Again, the implementation may vary. - In terms of your default implementation, the integer-based approach is interesting as a building block because there may be different integer sources for a given object, not just intids. For instance, I have an app in which I have integer identifiers for virtual objects, which may be fulfilled with different real objects based on current state. One app might want UUIDs to be generated for the virtual object, while another might want UUIDs for the real objects (so intids based on the standard persistent object key references would be appropriate). Or is that a good enough reason to not do it? No, but that certainly raises the bar, as you'd expect. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Unicode for Stupid Americans (like me)?
On Feb 28, 2007, at 5:37 PM, Paul Winkler wrote: On Wed, Feb 28, 2007 at 02:06:39PM -0700, Jeff Shell wrote: On 2/28/07, Philipp von Weitershausen [EMAIL PROTECTED] wrote: That's sorta what zope.publisher does. Actually, it figures that if the browser sends an Accept-Charset header, the stuff that its sending to us would be encoded in one of those encodings, so it tries the ones in Accept-Charset until it's lucky. It falls back to UTF-8. This seems to work. But yeah, it's relying on implementation details of the browser and it's weird. Ugh. I don't know how I missed that header. I was always looking for a content-type on the post, hoping that it had the information. I'm rather late to this particular party, and I'm far from an expert on either unicode or HTTP, but I have to ask: Is it just me, or is HTTP's support for specifying encodings completely inadequate? As far as I can tell, there are only two relevant headers. The request may specify Accept-Charset, whose meaning is given as what character sets are acceptable for the *response* (emphasis mine). The response may specify Content-Type, which again is irrelevant to the request. If there's anything that allows the client to specify the encoding in use *for the request data*, I don't see it. That seems like quite an oversight to make as late as HTTP 1.1 (1999). What am I missing? It's been years since I dug into this, but I'm better than 90% sure that the browser is expected to make its requests in the encoding of the response (i.e., the one set by Content-Type). It's been too long for me to tell you if that's in a spec or if it is simply the de facto rule, though I suspect the former. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] unique integer id as a Token for ITerms ?
On Feb 21, 2007, at 1:23 PM, Christophe Combelles wrote: Hello, When using a vocabulary, one needs to generate a token for each term, then to be able to get the value again from the token. (getTerm/getValue needed by ITerms) Is there a problem using the Unique Integer Id generated by the IntIds utility directly as the token? not at all, if the vocabulary item is appropriate for an intid (usually, but not necessarily, this means a persistent object) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] select field with Choice widget and formlib
On Feb 7, 2007, at 11:30 AM, Dominique Lederer wrote: hi i render a form with formlib which contains a selectbox: form_fields = Fields( Choice(__name__='selectbox', required=False, values=[value1,value2,value3]), ) the rendered output always includes a extra option which contains this message-id vocabulary-missing-single-value-for-edit like: option selected=selected value=Wert aus Vokabular mit einem Wert fehlt/option option value=value1value3/option option value=value2value3/option option value=value3value3/option Your field has required=False. How else are you supposed to show, or allow the choice for, *not* choosing one of your three options? how do i get rid of this? required=True or write a new widget (a subclass would be easy enough probably) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problems reindexing on ObjectModifiedEvent
On Jan 18, 2007, at 4:07 PM, [EMAIL PROTECTED] wrote: I need to investigate this further now, but this problem so far seems to isolated to the ValueIndex. Also, when the ObjectModifiedEvent is replaced with an ObjectCreatedEvent, the object is properly indexed. Hi Kevin. We don't know of any issues with the ValueIndex, nor does this problem sound familiar. While I can't help you diagnose, if you discover the problem and it's in zc.catalog then I will help fix! Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Extent catalog question
On Jan 11, 2007, at 1:42 PM, [EMAIL PROTECTED] ksmith93940- [EMAIL PROTECTED] wrote: In my experience (zope2), large full textindexes require more and more cpu time for every new object added to the point where it takes several minutes for each new article uploaded! To avoid this problem, I was hoping to break the index into smaller pieces by using extent catalogs to filter by year. Can extent catalogs help mitigate a scaling issue like this? Sure. There might be considerations with sharing the lexicon or not, but I don't have any advice off the top of my head. I've been able to instanciate one extent catalog per year, but it doesn't automatically index content like a normal Catalog. It requires a manual reindex. And to automate indexing content, do I need to implement something like these for an extent catalog? Neither of these match our experience. :-( I'm not sure what the difference is between our set up and yours. Did you register the extent catalog as an ICatalog? We do... Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zope.testbrowser and vhost
On Jan 2, 2007, at 2:29 PM, Benji York wrote: Dominique Lederer wrote: i see there is a VirtualHostingBrowser class in zope.testbrowser.testing, but i dont have a clue on how to use this. Use VirtualHostTestBrowserSuite instead of unittest.TestSuite and the tests you add to the suite will be run twice: once normally and again in a virtual hosting environment. Right now it doesn't have the flexibility to do what it sounds like you want (i.e., insert a skin). Some small adjustments could probably make it possible. As long as the default behavior doesn't change I think it would be fine. mea culpa for the lack of docs and tests. They are welcome. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zc.table FieldColumn question
On Nov 17, 2006, at 3:00 PM, [EMAIL PROTECTED] wrote: Ok, so the following works, but if someone with more knowledge could comment on this I'd appreciate it. We have two separate stages (and methods) in our views, update and render. In our views, we *explicitly* call the field columns' input, and then call their update during the update stage. Sometimes we only call input/update if some other event happens, like an Apply button being clicked on the page. Then we render. HTH Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] getId in zope3?
On Nov 5, 2006, at 1:12 PM, Peter Bengtsson wrote: In Zope2 every object has an 'id' which meant that you can use someobject.getId() to find out what name the object is stored under in its container. Is there an equivalent in zope3? __name__ ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: how to catalog principal annotations?
On Nov 3, 2006, at 11:39 AM, Philipp von Weitershausen wrote: Dominique Lederer wrote: I have users residing in an external database.I store user data with principal annotations. Now i want to create a view where users with a special annotation are listed. Is it possible to catalog principal annotations and how? Sure. catalog.index_doc(obj) should do it (where obj is the principal). Then you should have an indices configured to index whichever fields you want to index. Of course, those fields should be coming from an adapter for the principal that you have to create. THe adapter would look at the principal's annotation. This will work if you have a key reference implementation specifically for principals. The default key reference impl. is just for persistent objects, and standard Zope 3 principals are transient, generated for the current request by the pluggable auth utility. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.zrtresource or zc.resourcelibrary
On Oct 31, 2006, at 7:15 PM, Jeff Shell wrote: On 10/24/06, Gary Poster [EMAIL PROTECTED] wrote: It might be nice to have zc.resourcelibrary be able to somehow serve z3c.zrtresource files too...it doesn't right now. FWIW, right now in lieu of zrtresource I just use script ... tal:content=string: /* ... JS that specifies dynamic variables and calls ... */ /script. Simple, and encourages delineation between library and usage; but a bit hacky, and unfriendly to designers. I do a lot inline in my Python code, using our nevow.Stan inspired tag generation system and little bits and pieces I threw together to ease in generating short bits of JS from within Python. In particular, marshalling of basic Python structures to Javascript using a modified `jsonencode` module from the `simplejson` package. What are the modifications? The things you list below all sound like normal simplejson stuff. Among other things, it lets me use normal Python dictionaries, strings, lists, numbers, etc, for use in generating code. `jsonencode` ensures that everything is escaped properly. It gets to be handy to build on, especially when wanting to generate a Javascript call and supply it with a big list of generated dictionaries. Other JS-related bits to know about (you'll have to do your own reading sometime :-): http://zif.hill-street.net/headincludes (WSGI variation on resourcelibrary), http://zif.hill-street.net/gzipper/ (WSGI, gzips all output for smaller browser page sizes), http:// zif.hill-street.net/jsmin/ (WSGI, compresses JS for smaller browser page sizes), and http://svn.zope.org/z3c.javascript/ (resourcelibrary- aware collection of mochikit, dojo, et al). Ah, the real reason for my response here: how does one use third party WSGI Middleware with Zope? zope.paste, maybe (http://svn.zope.org/zope.paste/)? I think that's what Jim Washington has used. Alternately, does anyone have any experience running Zope in another WSGI supporting server? There are quite a few things out there in WSGI land that I'm interested in, but I've never quite understood how they work together on their own and/or with big systems like Zope. By the way - I've had some issues with the dependency tracking in zc.resourcelibrary. Is there a tracker where I can post said issues? (if I can remember and reconstruct them, that is) Yeah, the dependency code was pretty badly broken until Marius Gedminas fixed it within the past week or two. Try it again. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Links / Relationships (again)
On Oct 30, 2006, at 11:56 AM, Stephan Richter wrote: All the zc packages should be up-to-date. In the Lovely projects we use zc.relationship, even though it is much more complicated than it should be. That seems unnecessarily derogatory. :-) But I know where you are coming from. As the author, I'd say more low level than most people want. The low-level interface--the index--is precisely what I needed for the projects for which it was developed. The containers in the relationship package were experiments at a more friendly wrapper. Other friendly wrappers that constrain the capabilities in exchange for the greater ease of use found in packages like the zc.schooltool code have been threatened by others. That would be great. Meanwhile, I am as sure as I can be without having used it myself that the zc.schooltool relationship package is easier to use for common use cases. If you need something more flexible, you may want to look at the zc.relationship index. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] z3c.zrtresource or zc.resourcelibrary
On Oct 24, 2006, at 8:41 AM, Peter Bengtsson wrote: Which one should I use for my new zope 3 site? z3c.zrtresource or zc.resourcelibrary? I don't understand the difference between them and I don't have hours to spare on evaluating both. I'm sure they do different things and do them differently well. My aim to be able to smoothly define css, images, js without too much magic for my one and only skin. It sounds like you may just want the standard Zope 3 resourcedirectory: just makes JS, CSS, images, et al available. z3c.zrtresource: a way to write dynamic css and js files. For instance, you have a css file that wants to refer to an image served by Zope, taking virtual hosting into account. Particularly suitable for situations when you are working with a shop that has a separate design team. Of course, can be effectively used in other environments as well. zc.resourcelibrary: a resourcedirectory-based tool to define and use resources with dependencies. For instance, one part of your assembled page, like a widget, needs MochiKit; another part, maybe a widget, needs a custom library that uses MochiKit; and another part needs a second custom library that depends on MochiKit.New, that itself depends on MochiKit; all three are assembled dynamically, and need to put JS/CSS code in the head, preferably without duplication, and in the right order. It might be nice to have zc.resourcelibrary be able to somehow serve z3c.zrtresource files too...it doesn't right now. FWIW, right now in lieu of zrtresource I just use script ... tal:content=string: /* ... JS that specifies dynamic variables and calls ... */ /script. Simple, and encourages delineation between library and usage; but a bit hacky, and unfriendly to designers. Other JS-related bits to know about (you'll have to do your own reading sometime :-): http://zif.hill-street.net/headincludes (WSGI variation on resourcelibrary), http://zif.hill-street.net/gzipper/ (WSGI, gzips all output for smaller browser page sizes), http:// zif.hill-street.net/jsmin/ (WSGI, compresses JS for smaller browser page sizes), and http://svn.zope.org/z3c.javascript/ (resourcelibrary- aware collection of mochikit, dojo, et al). Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Links / Relationships (again)
On Oct 16, 2006, at 6:48 PM, Jeff Shell wrote: I see there's a `zc.extrinsicreference` in the svn.zope.org repository. Is that in a usable state? As Benji said, yes, and it sounds like it might fit your use cases. You might be interested in http://mail.zope.org/pipermail/zope3-users/ 2006-July/003950.html and ff., if you didn't read it already, to clarify our/Jim's concept of when to use what kind of relationship tool. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: NTLM credential plugin
On Sep 13, 2006, at 2:30 AM, Philipp von Weitershausen wrote: Simon Hang wrote: Hi, I'm thinging to write a NTLM credential plugin for zope3. But as I know, ntlm use 4-way handshake procedure, that means it needs two round-trips between server(zope3) and client(browser). When I look in the credential plugins, it has challenge mothed. But seems it is only design for 1 round-trip protocol. It can issue one challenge, and return to parent script. I don't see how the PAU only allows one round-trip. AIUI (I just looked up NTLM last night out of curiosity: see http:// www.innovation.ch/personal/ronald/ntlm.html), the problem is that the 4 way handshake has to happen *within a single connection*. Apparently MS abuses HTTP to perform this. Implementing it in pluggable auth made me scratch my head a bit, so I didn't reply. You would need to slurp the request, then push back to the response, then slurp the same request again, then push back to the response, then slurp one more time, and finally reply with the real request. Describing the problem to Benji, he mentioned WSGI--that does seem like the only way I can imagine this working, and that would be tricky enough, especially if you needed to reach into Zope for the managed credentials. Once the WSGI plugin did its magic, it would need to put something in the WSGI request that a pluggable auth plugin was willing to accept as authentication. On the bright side, if you did this with WSGI you might be able to offer this as a generic Python WSGI NTLM tool that required only minimal integration with the back end app server. I'm glad I'm not tasked with this. :-D It sounds interesting, though. Also, maybe I misunderstand: read the link if you want to come up with your own interpretation. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: NTLM credential plugin
On Sep 13, 2006, at 11:47 AM, Chris McDonough wrote: The right thing to do here is probably to just use something like http://modntlm.sourceforge.net/ and trust the REMOTE_USER environment variable passed by Apache... let somebody else worry about maintaining it. ;-) One strategy for doing this is described at http://plone.org/documentation/how-to/singlesignonwindowsdomains/ #step1 . +1! Good to file away. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Time for a Decimal field type in zope.schema?
On Aug 31, 2006, at 9:56 PM, Darryl Cousins wrote: Hi Marius, Cheers. I don't have checkin rights so I'll leave it to you (or another) if it considered is worthwhile. Darryl, your decimal field changes would be welcome, as would a currency field. Unfortunately, having one person check in another's work in the Zope repository has legal complications, and in fact, in this transition period to the ZF, only ZC has the right to check in another's work. Generally, it is /much/ better for a contributor to check in his own work. Would you be willing to become a contributor? Until the ZF is in full swing, the following procedure is still available and has the least ambiguity (from http://www.zope.org/DevHome/Subversion/FrontPage): ContributorIntroduction (http://www.zope.org/DevHome/Subversion/ ContributorIntroduction) gives background information on the approach. ContributorFAQ (http://www.zope.org/DevHome/Subversion/ ContributorFAQ) summarizes questions and answers. Finally, the Zope Contributor Agreement (http://www.zope.org/DevHome/Subversion/ Contributor.pdf) is the legal agreement that gets signed and returned. For reference, once the ZF is in full swing, the relevant parallel documents are here: http://www.zopefoundation.org/ Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] New open-sourced Zope Corporation packages
Zope Corporation is happy to announce a number of newly open-sourced packages. All are in use, in development, or both. We release these packages in the strong hope that others will contribute to them, from maintenance through extension to refactoring. The maintainers are effectively zope3-dev@zope.org. Since we rely on them, ZC will generally do some of those tasks ourselves; and we will have a strong stake in making sure that their development continues to support our internal needs. These packages are tested two or more times a day against the Zope 3 trunk. We hope to make 3.3 branches when 3.3 is released. In several cases, these will need a newer version of zope.testing than the one shipped with Zope 3.3, but otherwise we expect them to work in Zope 3.3 without too much tweaking. As we move our internal projects to zc.buildout, these projects will gain eggs, PyPI registration, and thus better documentation of their dependencies over the next weeks and months. Here are quick lists of the new packages, with summaries and status notes. Each project can be found on http://svn.zope.org/ with the given name, such as http://svn.zope.org/zc.comment/;. The actual code is found in trunk/src/zc/[package], such as http://svn.zope.org/ zc.comment/trunk/src/zc/comment/. The current svn-only distribution means that the code is currently largely in the realm of experienced Zope developers. The egg and PyPI work mentioned above will hopefully lower the bar when it is done. First, here are the packages that are largely stable and that we are using in active projects. - zc.comment An annotations-based drop-in aspect (i.e, no change to a class is necessary) that gives objects a comments tab. In production; maintenance mode. - zc.copy A pluggable `copy` function, replacing the one in zope.location; and an ObjectCopier that uses it. This allows object copies to be cleansed efficiently. In use by active projects; maintenance mode. - zc.freeze A way to spell freeze requests, and a few implementations and approaches. In use by active projects; maintenance mode. - zc.index Text extraction for XML, HTML, Word, OO, PDF, and RTF files, for the purpose of indexing. In production; maintenance mode. - zc.notification Simple user notification framework. Currently includes email notification, with email templating. Somewhat unstable API (need to review for scalability). In use by active projects; maintenance mode, though we would like to have time to return to it. - zc.objectlog TTW log with automatic changesets. In production; maintenance mode. - zc.preview File previews based on zope.mimetype interfaces. Currently somewhat minimal. In production; maintenance mode, though we would like to have time to return to it. - zc.security Simple user search. Not a big release, but a dependency for some packages such as the previously released zc.sharing. (Already released, but this is the first announcement.) In production; maintenance mode. - zc.selenium A way to write selenium tests in Python rather than in HTML tables, including a way to push and pop ZODB state from within selenium. In use; maintenance mode. - zc.tokenpolicy A small variation on the zc.sharing policy that makes the security policy enforce zope.locking tokens. Useful on its own and as an example of enforcing the pure-policy zope.locking tokens. In use by active projects; maintenance mode. - zc.vault A subversion-like repository stored in the ZODB, complex but powerful and useful for many low-level tasks. In use by active projects; maintenance mode for core, with occasional development of add-ons. - zc.winauth A pluggable authentication plugin for interacting with Windows authentication. In production; maintenance mode. - zope.html A zope form widget for HTML, using FCKEditor (thanks to Roger Ineichen for his version, from which he graciously helped us learn). In production; maintenance mode. Second, the following three packages are newly added and under development. We will make additional announcements as they become more stable. - zc.async Heir to Zope 2 zasync, and learning from its successes and failures, this supports asynchronous application calls, particularly as driven by end users in real-time. Alpha, but working in tests. - zc.set A persistent object akin to the persistent list and persistent mapping classes in the persistent package, but with a standard Python set API. (Note this has the same limitations as the persistent mapping and list classes--changing the contents means the whole set needs to be rewritten to the database, not just buckets as with BTree sets.) Beta. - zc.twist A partial for making ZODB calls from a Twisted reactor. Beta, but currently relies on some ZODB internals. Also note that we have a new zc.site package that is broken
Re: [Zope3-Users] New open-sourced Zope Corporation packages
On Aug 24, 2006, at 12:14 PM, Martijn Faassen wrote: Gary Poster wrote: Zope Corporation is happy to announce a number of newly open- sourced packages. All are in use, in development, or both. [snip long list] Awesome! And thanks for this announcement! And here Infrae's with only 3 hurry packages last year - I feel totally inadequate. :) I think your lxml work gets you a decent amount of credit ;-) Echoing some of the recent discussions, we should really focus on getting a web presence for these. Just a web page with some minimal information would already be very valuable. Anyway, that's just a note to myself - it might be a next project to tackle after we get a better Zope Foundation website, we'll see. Agreed generally. We're hopeful that PyPI registrations (as I mentioned we hope to provide soon) will provide some of this. Perhaps Stephan's initiative will also bear fruit. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zope3's TAL ZPT reference
On Aug 7, 2006, at 11:10 AM, Florian Lindner wrote: Am Montag, 7. August 2006 14:57 schrieb Michele Amori: Hello all, actually I'm a zope newbie. I must develop web applications with zope 3.2, in the next future, so I'd like some help from this ML. I'm searching for a ZPT (or TAL) reference for Zope 3...where is it? Take a look here: http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ AppendixC.stx That's maybe a good intro, but will include some information that is out of date for Zope 3 (context vs. here comes to mind). The specs are still valuable, for information in the abstract. http://www.zope.org/Wikis/DevSite/Projects/ZPT/TAL http://www.zope.org/Wikis/DevSite/Projects/ZPT/TALES http://www.zope.org/Wikis/DevSite/Projects/ZPT/METAL Also, the two Zope 3 books (by Philipp von Weitershausen and Stephan Richter, respectively) are still reasonably up-to-date in regards to ZPT in Zope 3. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] searching and relations
On Jul 23, 2006, at 4:12 AM, Darryl Cousins wrote: Gary Poster wrote: If the relationship is intrinsic to one object's data model but not to the other's, then it makes sense to have a Python pointer on the first object. Hi Gary, Am I right that 'a Python pointer on the first object' is defined by simply defining the schema field, eg:: mypointer = Object( title=Pointer to object, schema=IInterfaceOfTheTarget) Then everything else will fall into place. I could even use formlib to edit the object being pointed to from within a form editing the 'first object'. The second object would not even know it is pointed to. For it to know I would need to use a relationship as you go on to discuss. Have a correctly understood? Yes, precisely; and for what it is worth, the Object schema value lets formlib work, and specifies part of your software's contract, but is not necessary for the most basic story. The simplest clear case (Where `app` represents some ZODB folder, like the application root): class DemoSubject(persistent.Persistent): pass class DemoObject(persistent.Persistent): pass app['demo'] = DemoSubject() app['demo'].mypointer = DemoObject() By the way, a small but possibly important subtlety about the object widgets that are associated with the schema object fields is that (unless you manage your form pretty carefully) they change value by creating new instances of the sub-object and replacing it on the main object, not by modifying an old sub-object instance, IIRC. Sometimes Choice fields with a custom vocabulary or source are what you want, if you want to make a pointer to an object that already exists somewhere in the database. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Persistent subclasses in tests
On Jul 23, 2006, at 6:59 PM, Darryl Cousins wrote: Hi, I've have a problem with the following and I hope someone can shed some light for me ... Yup, you need to handle a case like that specially. See zope.testing.module Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] searching and relations
On Jul 22, 2006, at 4:47 AM, Lorenzo Gil Sanchez wrote: El vie, 21-07-2006 a las 10:21 -0400, Pete Taylor escribió: Lorenzo, I've run into a very (very!) similar situation, and ended up writing some wrapper/simplification utilities for zc.relationship. zc.relationship is wonderfully powerful, but a bit complex. It's use is intuitive once you wade through the 2000+ lines of documentation (which is worthwhile reading), but it's a bit intimidating at first. Ok, I was afraid of an answer like this because in a recent thread I've read Jim Fulton saying that we are trying to use zodb as a relational database which is a shame and I think I agree with that quote. So that's why I tried not to use external packages like zc.relationship and stick to a plain object model with intrinsic relations modeled as simple object attributes. Heh. I gave that Jim Fulton quote, and encouraged the direction you describe; *and* I wrote zc.relationship. ;-) They are not mutually exclusive. Let's take a simple two-member directional relationship as an example--something like A depends on B. If neither object should inherently know about the relationship--it's not intrinsic to either of their data models--then it makes good sense to have external relationship objects that model the connection. The relationship container in zc.relationship is a simple example of a solution for that use case. If the relationship is intrinsic to one object's data model but not to the other's, then it makes sense to have a Python pointer on the first object. If you need to ask questions, such as simple backpointers, then you can set up an extrinsic reference or you can set up a zc.relationship index to index the first object. For a simple backpointer case, an extrinsic reference is sufficient and simpler. If you need more sophisticated queries than just backpointers then the zc.relationship index can be a real win: you can adapt the first object to a relationship interface that breaks the relationship down into parts that match the queries you want to make. That works nicely. If the relationship is intrinsic to both objects' data models, all you can really do is choose one of the previous two approaches and put some sugar around it. AIUI, schooltool's relationship code does something like this: you can specify both sides of a relationship in a class definition (and an interface, I believe) and behind the scenes it keeps track of the relationship for you in an external data structure, no matter which side of the relationship you modify. zc.relationship's index could be used to build functionality like this, but it has not been done to my knowledge. The obvious question is: does this allow powerful queries like the ones I mentioned in my first email or I should switch and use extrinsic relations for this kind of features? zc.relationship indexes can be combined with other catalog indexes to do what you described, but doing so efficiently will require knowledge of catalog indexes and the BTree module. The README for zc.relationship touches on this when it discusses filters: | If relationship tokens (from 'findRelationshipChains' or 'apply' or | 'findRelationshipTokenSet', or in a filter to most of the search methods) are | to be merged with other catalog results, relationship tokens should be based | on intids, as in the default. For instance, if some relationships are only | available to some users on the basis of security, and you keep an index of | this, then you will want to use a filter based on the relationship tokens | viewable by the current user as kept by the catalog index. The filter is not the only approach--you will sometimes want to merge *results* from a relationship index and other indexes, for instance-- but if you are doing transitive searches it may be preferred for efficiency. zc.relationship is a bit of a powertool. Projects like the one Pete describes to make a friendly, more constrained usage of it will be very useful. Also, don't forget SQL. I prefer the ZODB, and stay there if I can make a reasonably convincing case (almost always ;-) ), but sometimes an app really calls out for a hybrid approach. Gary___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] IRelationshipMapper
On Jul 10, 2006, at 10:09 PM, Gary Poster wrote: Jim built the nice-n-simple zc.extrinsicreference package for a good way to make back- references to Python references. Apologies: Benji York built the nice-n-simple zc.extrinsicreference package. :-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Non-owning references in Zope3
On May 24, 2006, at 4:27 PM, Alek Kowalczyk wrote: Tom Dossis wrote: [EMAIL PROTECTED] wrote: Hi, I am relatively new to Zope3. I could not find anywhere an example, what is the 'right way' to make non-owning reference to another object in Zope? Every piece of zope3 docs is full of examples of containers, this makes a good tree like structure. But how to refer from one object to another in right way? Can/ should I do that with Object field? One offering is zc.extrinsicreference ... http://svn.zope.org/ zc.extrinsicreference/trunk/src/zc/extrinsicreference/ extrinsicreference.txt I'm not aware of any zope.schema / FieldProperty stuff to do this; it would be pretty useful though. Thanks! I have also found a references library in 'schooltool' project. It seems to be similar to RDF and adapts any Annotatable object. But I'm looking for something more straightforward - both approaches (extrinct and schooltool) seem to be too complex and not pythonic... It sounds like you just want to make python references? That works. given A and B, two objects whose classes inherit from persistent.Persistent, A.foo = B and B.bar = A will work as you expect. Haven't seen clear requirements for this from you, but maybe I missed them. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Internationalization, Widgets, and Currency
On May 9, 2006, at 1:37 AM, Tom Dossis wrote: David Johnson wrote: I am trying to implement a currency input using a Float widget. This wasn't your question, but, eek! Currency should use a python decimal.Decimal, never a float. I don't think we have schema field and widget yet, but it would be trivial to add (the widget would effectively be identical, I believe). Using floats for money is a bad idea (a classic example: 3.3 3.2998 import decimal decimal.Decimal(3.3) Decimal(3.3) ) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] More fun with WSGI/zope.paste
On May 7, 2006, at 4:47 PM, Jim Washington wrote: Following along from Gary's idea that zc.resourcelibrary could be done as WSGI middeware, I am now previewing headincludes, a wsgi middleware filter with an alternative implementation of zc.resourcelibrary. It usurps a lot of zc.resourcelibrary configuration for compatibility, so they cannot be used at the same time. But reconfiguring is just a matter of a few files. For more information go to http://zif.hill-street.net/headincludes . The readme is at http://zif.hill-street.net/headincludes/README.txt . development status: works for me :-) awesome! What do you think about some or all of the following: - moving development of all three of these to zope.org svn? - putting them in a namespace? - merging zc.resourcelibrary and headincludes? - the possibility that we might want to include things not only in the head later (some old JS code wanted to be at the end, for instance) and so resourcelibrary, or at least something less specific than headincludes, might be a better name? More concretely, I suggest three new projects in zope.org: z3c.resourcelibrary (deprecating zc.resourcelibrary) z3c.gzipper z3c.jsmin You could also choose zc--that could stand for zope community as much as zope corporation--but it might cause confusion. z has also been proposed. :-) The zope namespace means from the Zope project, not specifically for zope (see zope.interface, for instance) so there's ample precedent for general things going in a z* namespace... What do you think? Getting the code in a publicly-accessible repo, ideally svn.zope.org, is my primary desire--everything else is peripheral. (I don't have as much use personally for your JSON-server right now, btw, but maybe that would be good to put in the repo too?) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] More fun with WSGI/zope.paste
On May 8, 2006, at 4:41 PM, Benji York wrote: Shane Hathaway wrote: Benji York wrote: Gary Poster wrote: z has also been proposed. :-) That strikes me as a good replacement for z3c. What about zf, for Zope Foundation? I was thinking more about code that doesn't belong to the Foundation, but that's a good choice for code that does. Contributor now == Zope Foundation member soon. zf is fine by me too. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] More fun with WSGI/zope.paste
On May 8, 2006, at 5:15 PM, Jim Washington wrote: Oops. Forgot to cc the list. Gary Poster wrote: [...] What do you think about some or all of the following: - moving development of all three of these to zope.org svn? OK. I do not have commit privileges on zope.org svn. But you do, and I do not mind if you put these packages up there. Checking in the code is an assertion of provenance/license: for instance, I wouldn't have known about the Plone code, which is potentially a problem because of GPL vs. ZPL (see below). Wanna get commit privileges? :-) It's the easiest way for you to assert the code's status. - putting them in a namespace? Probably a good idea. If it was only one... well, but I do seem to have gotten prolific. :) :-) Go for it (on whichever namespace gets decided). These three projects, I feel a need to reiterate, need zope.paste and Paste.Deploy (or a similar stack), to use with zope3, so deprecating zc.resourcelibrary may not be a good idea until more folks are on-board with the wsgi filters idea. I think the project is on board with wsgi. paste is maybe not as mainstream in the Zope world yet, so yes, maybe we need to let that settle out. If there are no issues with the paste-based version, though, I'd like zc to use it. gzipper and jsmin really have no particular ties to zope at all, except that I used Zope3 for developing them, and they probably work OK in Zope3 as a consequence. (PS. er, actually, the packer in jsmin came from Plone.) eek! GPL can't go in zope.org. Do you know what the license is to that particular component? You could also choose zc--that could stand for zope community as much as zope corporation--but it might cause confusion. z has also been proposed. :-) The zope namespace means from the Zope project, not specifically for zope (see zope.interface, for instance) so there's ample precedent for general things going in a z* namespace... What do you think? Getting the code in a publicly-accessible repo, ideally svn.zope.org, is my primary desire--everything else is peripheral. I agree. (I don't have as much use personally for your JSON-server right now, btw, but maybe that would be good to put in the repo too?) jsonserver is sitting happily in z3labs, where Balazs Ree and I are working (slowly) on a unified package for zope2 /five and zope3. It's a moving target, and we keep going off on interesting tangents. :) So, to recap, I have largely positive thoughts about your suggestions. And please feel free to put whichever of these packages you feel are appropriate wherever you wish on svn.zope.org. How's that for flexibility? With the caveats above, sounds great. :-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] More fun with WSGI/zope.paste
On May 8, 2006, at 5:39 PM, Benji York wrote: Jim Washington wrote: OK. I do not have commit privileges on zope.org svn. But you do, and I do not mind if you put these packages up there. AFAIK, you'd still have to sign a contributor agreement. (PS. er, actually, the packer in jsmin came from Plone.) Is the packer code GPL? Heh. That's pretty much what I said. Benji wants to get me a shirt that says -vvv :-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Formlib and invariants?
On May 4, 2006, at 7:44 AM, Bernd Dorn wrote: On 04.05.2006, at 13:35, Gary Poster wrote: On May 3, 2006, at 11:51 PM, Bernd Dorn wrote: yes, this should really be fixed up in the default implementation of formlib because interface.Invalid has no registered multiadapter to zope.app.form.browser.interfaces.IWidgetInputErrorView you have to raise a WidgetInputError an example for such an error: from zope.schema import Datetime,Bool,ValidationError from zope.app.form.interfaces import IWidgetInputError class FromGreaterThanTo(ValidationError): uFrom-Date is after To-Date # this is needed to adapt to a view for formlib implements(IWidgetInputError) Well, you can raise any error from an invariant that extends...zope.interface.Invalid, maybe? The invariant interface says what is allowed somewhere in zope.interface. ...I suppose we could have a generic view for Invalid errors that simply said This is invalid, try again? Doesn't seem very useful to me. You are responsible for making sure you have a reasonable exception view of an exception you raise. I'm inclined to think that this is a documentation bug at worst. yes, because in form.txt Invalid is used directly, wich implies that this should work Would you mind putting in a collector issue for this? Thanks Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Checking if an interface is provided by an object or could be adapted to
On May 1, 2006, at 2:56 AM, Bernd Dorn wrote: On 01.05.2006, at 01:55, Stephan Richter wrote: On Sunday 30 April 2006 19:34, Bernd Dorn wrote: component.queryMultiAdapter((bar,baz), IFoo) is not None or False this way you always get True or False ok, for this case it is ok but when you have a class that uses __conform__ None may be returned when you use this IFoo(context,False) or am i wrong? It might return None, which according to our semantics means that the adaptation failed. Since None has a False meaning in a boolean context, Stephan's version will work out. However... Why not just: component.queryMultiAdapter((bar,baz), IFoo, default=False) ...this assumes that the adapter evaluates to a boolean True, which is not generically (reliably) the case. As a pattern, Bernd's version is safer, although the trailing or False is superfluous. component.queryMultiAdapter((bar,baz), IFoo) is not None Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Referencing objects in auto-generated forms
On Apr 18, 2006, at 3:31 AM, Frank Burkhardt wrote: Hi,. On Sun, Apr 16, 2006 at 01:48:37PM -0500, Jeff Rush wrote: [snip] Frank, I thought vocabularies were being de-emphasized though, in favor of the newer 'sources' component? Vocabularies were good for short lists of choices, but because it read them all into memory at once not so good at lazy evaluation. Sources supposedly uses an iterator and is good for both short and long lists, as I roughly understand it. No, actually, both can be used for infinite choices or finite choices. The primary difference to me is purity: sources break apart the token functionality--an aspect of display that widgets need--from the data definition. Up until fairly recently (i.e., post-3.2, I believe) you couldn't even express a finite source. There are still more vocabulary widgets than source widgets in zope.app.form. Sources are slated to replace vocabularies, but the uptake has been slow: I don't know of a hard date. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: Sending data to widgets
On Apr 18, 2006, at 10:19 AM, Frank Burkhardt wrote: Hi, On Tue, Apr 18, 2006 at 04:04:43PM +0200, Philipp von Weitershausen wrote: Hi Frank, My problem is not about data the widget should display but about data that controls the widget's behaviour. In this case my form consists of some widgets representing a schema interface plus a special I18NController widget which is e.g. used to define, in which order different language versions of the form's fields should be displayed. (-This is about I18Nd content, stored in dictionary-fields) Problem is: Some of the Widgets that should receive data from the I18NController are not known to the formlib because they are multiadapter- queried inside e.g. a ListInputWidget. The request + the context seem to be the only objects accessible to all the widgets - but I don't want to store language order information in zodb which leaves the request object only. Is there really no chance to store information as attributes of the request? Perhaps there is, but I would still advise against it. In this case I would recommend to make use of the adaption feature of zope.formlib. The context of the form and widgets doesn't necessarily have to be the persistent object itself. It can be an adapter. That way you can generate schema-based forms using schemas that aren't even provided by the object you're editing. zope.formlib will automatically adapt the object to the schema. The adapter will be responsible for mediating between formlib and the object. An example is the Metadata tab in the ZMI. The schema is something like IZopeDublinCore (at least some Dublin Core metadata), though no object really provides this data. However, there's an adapter that the data can be written to and that knows how to modify the object accordingly. In your case your adapter would probably behave like the original context except that it also stores this i18n ordering that you don't want to be stored persistently but still need for the form. Perhaps it's overkill to write adapter for all my content objects. I think I found a solution. The Request object might be RO but I can smuggle an object reference inside the reponse headers and removed it after all the widgets are processed. augh! :-) Philipp is leading you correctly. I might even be tempted to write a custom form that directly set the data for the widgets myself; maybe that would be a quicker and easier approach to the same road. If you still don't want to listen to him, please don't do the response hack you are talking about. the request has an `annotations` attribute which experts can use to stash things away. Beware: this is a road that has bitten many in Zope 2, and is easily abused. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Time for a Decimal field type in zope.schema?
On Apr 7, 2006, at 8:35 AM, Jeff Rush wrote: Perhaps this is an old topic, although I've done searches. I've seen the brief discussion about security proxies and the Decimal type on zope3-users, but (to zope3-dev) what about getting it added to the zope.schema as a first-class field type? So we can have auto-generated HTML forms and such? Has anyone already done this, in some Zope3 branch or private development? Not as far as I know. If not, is there any good reason it should not happen? Must Zope3 support Python versions prior to the introduction of the Decimal type? Not as far as I know. I'm willing to tackle it and make a submission, otherwise. +1 Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] formlib confusion
On Apr 6, 2006, at 7:27 PM, Alen Stanisic wrote: Hi Pete, I assign templates in view classes when using formlib: from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile class ConsumerRegistrarForm(form.Form): . . template = ViewPageTemplateFile('registrar.zpt') . . That's the way you do it, or with a named template, or with a custom render method. I would also be interested to find out if zcml template directive could still be used with formlib forms. Nope. Maybe you could write a render method that looked in the right place; I don't remember those details anymore. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] pau scenario
On Mar 28, 2006, at 10:43 AM, Pete Taylor wrote: Hi all, I've been off working on some other projects recently (zope3 projects, but none that involved specific logins and users, just data capture from a public site), and just got back to working with PAU, and had an interesting scenario presented to me. I'm trying to sell a co-developer on zope3, and we were discussing user management, roles, permissions, etc. after i finished extolling the virtues of zope3's user management system, he asked the following question: say you're operating a site as a portal to some set of functionality. similar functionality, but with different groups of people accessing it. as an example, say different civic groups around town. the odds of having a john smith at the Civic Media Center and a john smith at Center for Cultural Awareness (I'm making these up ;) ) are, for our example, very high. what if we don't want to force each group to maintain unique logins across the board, since to each unique group, 'jsmith' is a perfectly unique signifier? what if we want to create our login schema along the lines of group, username, pass instead of just unique username/pass? is this feasible? I can't think of a way to do it, off the top of my head. I admit, I need to spend more time thinking about it, but I was wondering if anyone else has come across anything similar? There are three elements of the default pau set-up: user id, login, and password. user ids must be unique. *Combinations* of logins and passwords must be unique. In theory, then, you can have USERID jsmith.cmc LOGIN jsmith PASSWORD 123456 and USERID jsmith.cca LOGIN jsmith PASSWORD asdfgh That's the way I learned it last, anyway. :-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)
On Mar 20, 2006, at 5:58 PM, Tom Dossis wrote: Tom Dossis wrote: Gary Poster wrote: Use the ones in zc.catalog.catalogindex.py instead: they do the necessary mixing-in for zope.app.catalog friendliness, without a patch. Looks like I missed it - thank you. The purpose of the patch was to convert documentCount workCount to methods for the advanced view. I'll try it out. Turns out I was using zc.catatlog.catalogindex.SetIndex and the patch was to convert the above attributes to methods. From memory they were showing up as repr's in the advanced catalog page. Maybe there was a way to achieve this via zcml? Just looked into this. They are not methods, they are callables: BTrees.Length.Length objects return their values when called. The indexes comply with the zope.index interfaces, and in fact are tested to do so. That said, you and Thierry are quite right that they do not display correctly in the advanced catalog view. We don't use it, so I didn't care. I just added the necessary security declarations to make this work. Unfortunately I had to reach out of the package to make a security declaration on BTrees.Length.Length.__call__; this is a bit ugly, and ideally we'd address this sometime. svn up to get the necessary changes. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)
On Mar 20, 2006, at 6:51 PM, Thierry FLORAC wrote: On Mon, 2006-03-20 at 17:37 -0500, Gary Poster wrote: On Mar 20, 2006, at 5:14 PM, Thierry FLORAC wrote: But I'm just trying to use a simple (not subclassed) SetIndex, and then to access my catalog Advanced management page...! I don't build any specific template for this. Should I build any specific SetIndex subclass ? Or define a specific template ?? [...] Modification is OK (at first, see below) for the first indexes, but an error is raised while starting Zope for the DateTime indexes, because class attribute points to a method name : zope.configuration.config.ConfigurationExecutionError: exceptions.TypeError: type_ must be a type, class or module, not a function DateTimeValueIndex at 0xb672510c in: File /usr/local/zope/3.2/var/lib/python/zc/catalog/ configure.zcml, line 58.3-66.3 content class=.catalogindex.DateTimeValueIndex require permission=zope.ManageServices interface=zope.app.catalog.interfaces.IAttributeIndex zope.index.interfaces.IStatistics set_schema=zope.app.catalog.interfaces.IAttributeIndex / /content Ah yes, my recommendation was made too quickly. The last two should not have been there. This third stanza would do the trick. content class=.catalogindex.NormalizationWrapper require permission=zope.ManageServices interface=zope.app.catalog.interfaces.IAttributeIndex zope.index.interfaces.IStatistics set_schema=zope.app.catalog.interfaces.IAttributeIndex / /content I made this change in svn. After removing this modification for the two last indexes, I can access catalog's advanced management screen without error, but information is not really fine : on a SetIndex for example, Document Count and Word Count columns are displayed as security proxied BTrees.Length.Length instance at 0xb4dc052c instead of their numeric values... Right, then it needed a declaration for BTrees.Length.Length.__call__. This is in svn now too. Try getting rid of your changes and getting the new version from svn. It should do what you want. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)
On Mar 20, 2006, at 5:32 PM, Stephan Richter wrote: On Monday 20 March 2006 17:14, Thierry FLORAC wrote: Should I build any specific SetIndex subclass ? Or define a specific template ?? I think in this case it is a bug. Feel free to report it in the issue tracker. :-) See email I just sent to Thierry. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)
On Mar 20, 2006, at 5:34 PM, Tom Dossis wrote: Thierry FLORAC wrote: Should I build any specific SetIndex subclass ? Or define a specific template ?? When I last used SetIndex from zc.catalog.index it didn't quite match the interface(s) required zope.app.catalog. It was simple enough to patch - which I can send you if you like. Use the ones in zc.catalog.catalogindex.py instead: they do the necessary mixing-in for zope.app.catalog friendliness, without a patch. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)
Tom Dossis wrote: Tom Dossis wrote: Gary Poster wrote: Use the ones in zc.catalog.catalogindex.py instead: they do the necessary mixing-in for zope.app.catalog friendliness, without a patch. Looks like I missed it - thank you. The purpose of the patch was to convert documentCount workCount to methods for the advanced view. I'll try it out. Turns out I was using zc.catatlog.catalogindex.SetIndex and the patch was to convert the above attributes to methods. From memory they were showing up as repr's in the advanced catalog page. Maybe there was a way to achieve this via zcml? Ah-ha! No, sounds like I just misimplemented. I'll fix that up soon (unless you'd like to check in the fix with some small easy tests?) Thanks Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zc.table - how does sorting work?
On Mar 14, 2006, at 11:54 AM, Laurence Rowe wrote: Hi there, I'm trying to use zc.table to format the output of one of my forms. it seems to work ok for the unsorted formatter, but not for the StandalonSortFormatter. Here is the code that works with plain formatter: columns = ( GetterColumn(name=u'dn', title=u'Distinguished Name', getter=lambda i, f: i.dn, subsort=True), GetterColumn(name=u'displayName', title=u'Name', getter=lambda i, f: i.displayName, subsort=True), GetterColumn(name=u'mail', title=u'Email Address', getter=lambda i, f: i.mail, subsort=True), ) class LDAPFilterForm(form.Form): form_fields = form.Fields(interfaces.ILDAPFilter) @form.action(Search) def handle_search_action(self, action, data): search = interfaces.ILDAPSearch(self.context, None) results = search.search(data['filter']) self.table = table.Formatter(self.context, self.request, list(results), columns=columns) return self.table() but when I change the Formatter to StandaloneSortFormatter, I still get the same html output. I have tried adding in this from the zc.table readme: for c in columns: directlyProvides(c, zc.table.interfaces.ISortableColumn) Yes, you want this. @adapter(IRequest) @implementer(Interface) def dummyResource(request): return lambda:'/@@/zc.table' provideAdapter(dummyResource, name='zc.table') No, you don't want this. But then I get the following traceback: 2006-03-14T16:34:32 ERROR SiteError http://localhost:8080/@@/zc.table Traceback (most recent call last): File /usr/lib/python2.4/site-packages/zope/publisher/ publish.py, line 135, in publish object = request.traverse(object) File /usr/lib/python2.4/site-packages/zope/publisher/ browser.py, line 500, in traverse ob = super(BrowserRequest, self).traverse(object) File /usr/lib/python2.4/site-packages/zope/publisher/http.py, line 451, in traverse ob = super(HTTPRequest, self).traverse(object) File /usr/lib/python2.4/site-packages/zope/publisher/base.py, line 289, in traverse subobject = publication.traverseName( File /usr/lib/python2.4/site-packages/zope/app/publication/ publicationtraverse.py, line 56, in traverseName ob2 = ob.publishTraverse(request, nm) File /usr/lib/python2.4/site-packages/zope/app/publisher/ browser/resources.py, line 40, in publishTraverse locate(resource, sm, name) File /usr/lib/python2.4/site-packages/zope/app/location/ location.py, line 72, in locate object.__name__ = name TypeError: func_name must be set to a string object exceptions.TypeError: func_name must be set to a string object /usr/lib/python2.4/site-packages/zope/app/location/location.py(72) locate() - object.__name__ = name Using the debugger I can see: (Pdb) name u'zc.table Any ideas? I'm stumped. Not sure, but I'm guessing it is the dummy adapter. Try again without it. Also, as I wrote yesterday, we have an alternate sorting implementation that we ought to get in zc.table. I sent it to Martijn Faassen; if you think you might look at it and maybe merge it, I could send it to you too. :-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Principal annotations
On Mar 11, 2006, at 3:14 AM, Thierry FLORAC wrote: On Thu, 2006-03-09 at 01:14 -0700, Shane Hathaway wrote: Your idea of annotating InternalPrincipals rather than Principals seems to work, but I apparently did something wrong, because edited annotations don't persist! I can save edits, but when I reload the page, they're gone. I don't know why. As said in a previous (and un-replied :-( !) post a few days ago, I have the same kind of problem with an adapter using annotations : if I set my attributes using a property attribute, the setter is not called and modifications are lost when page is reloaded ; I have to call the setter directly (after modifying the interface, of course) from my adapter for modifications to be stored... I haven't had time to read much or reply, so these may not be what you and Shane are talking about, but I just saw this... - yes, don't annotate principals. principal objects are not persistent, and like the Zope 2 PAS are created and discarded within a request. annotating internal principals is not recommended either: it won't work with other plugin designs. Use principal annotations. Make sure that the adapter providing IAnnotations for principals returns the principal annotations. (I thought I had done this for Zope 3, but maybe I just did it for some internal work...) - Thierry, send me a link to your email and I'll try to look at it (especially if it is short :-) ). It could be that you are not using a persistent-aware data structure (PersistentDict or a BTree). We successfully do the sort of thing you seem to be describing, so I suspect some disconnect. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Visionaire! (All your problems, solved)
On Mar 1, 2006, at 7:42 PM, Jeff Shell wrote: [...] - Zope 3 CA: The Zope Component Architecture. Core services. Would include zope.publisher and most other current top level zope.* things. Usable as a library, as a publisher for other environments, perhaps as a simple standalone server. Easy to deploy against WSGI, Paste.deploy, whatever. - Zope 3 AS: The Zope 3 Application Server. A Zope 3 CA stack using the ZODB, ILocation, and most of the zope.app services but without any content objects. Perhaps only an application server configuration skin (process management) but no ZMI. Maybe have the current configuration installable as an option. - Zope Suite (or Zope Web or Zope DE): This is the full application server perhaps Jim is envisioning. A comprehensive web based user interface, based on features (and implementations) of both Zope 2 and Zope 3 application servers and offerings. This would meet what I'm looking for...but I don't think I'll be one of the hard ones to convince. ;-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: redirects in a formlib EditForm
On Feb 27, 2006, at 6:52 AM, jürgen Kartnaller wrote: Gary Poster wrote: [...] Yes, we write custom templates that use hidden input fields. We reuse the existing template by putting the default template on another attribute of the view class, and then saying 'metal:use- macro=view/...' For instance class MyForm(zope.formlib.form.EditForm): base_template = zope.formlib.form.EditForm.template template = (...a named template if you want, or just a page template directly...) Then in your template, you can refer to macros in the original like this: 'metal:use-macro=view/base_template/macros/extra_info' Thanks a lot for this. The above metal statement doesn't work, I do it this way : metal:use-macro=view/base_template/macros/main and then metal:fill-slot=extra_info Heh, yeah. Thanks for clarifying. Gary___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: redirects in a formlib EditForm
On Feb 27, 2006, at 8:39 PM, Joel Moxley wrote: Damn, I still can't get this working right after following all of the instructions here. I can successfully stash the refering url in a hidden form, but it's not showing up in my request. I can think of two possible things. One is that you are maybe getting a form validation error and then pressing Apply, or that you are using a widget that redraws the screen. Another is that we might have a bug that makes form variables be stomped on by header names. :-( First try changing def referer(self): return self.request.getHeader('HTTP_REFERER') to def referer(self): return self.request.form.get('HTTP_REFERER') or self.request.getHeader('HTTP_REFERER') Then if that doesn't work, try changing it to def referer(self): return self.request.form.get('referrer') or self.request.getHeader('HTTP_REFERER') and changing your template to have input type=hidden name=referrer value= tal:attributes=value view/referer / (Sadly, the spec made a spelling error with referer. :-) ) By the way, my svn update had a conflict at src/zope/interface/common/. I deleted the old one and it worked fine, but I guess I'll note it here. Yeah, they are rearranging things at PyCon. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] zodb objects backup
Alen, please see http://www.zope.org/Wikis/ZODB/FileStorageBackup Shaun, many of the other questions in this thread--and others recently--are answered in this guide: http://www.zope.org/Wikis/ZODB/FrontPage/guide/index.html It is highly recommended reading if you are doing serious Zope 3 apps. Both of these are found in the ZODB wiki, which has some other helpful docs: http://www.zope.org/Wikis/ZODB/FrontPage Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] syncing object view after an attribute change
On Feb 21, 2006, at 8:22 AM, Joel Moxley wrote: Hi all, I've been developing an app, and I keep running into this problem. Briefly, the object view loaded in my page will be one step out of sync with a change I make on the object. This seems to be something very basic that I am missing, but I have not been able to find an appropriate fix and instead rely on the simple workaround of pressing refresh in my browser. By way of an example, I have a parent container with child objects. In the container page template view, I have a simple input form that calls a function deleting all child objects. td colspan=7 tal:define=result view/formClearAll form input type=submit name=CLEAR_ALL value=Clear All/ /form /td When I press Clear All, the new page shows the views on the old child objects. When I press refresh, the new page now correctly has removed the child objects. Can someone please give me a pointer on how to remedy this and get my views back in sync? This sounds like an update bug: you are rendering, or collecting some data for the rendering, before you have finished updating your data for the transaction. This is why formlib has two explicit stages, update and render. I'd think about dividing up your work in those two categories: you'll probably catch what the problem is. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: [Zope] Debugging doctests
On Feb 23, 2006, at 10:10 AM, Benji York wrote: [...] if 1: ... import pdb;pdb.set_trace() ... a = 1 ... b = 2 ... c = a + b Oh yeah. I've had to do stuff like that too. :-) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] nextURL: add vs edit
On Feb 17, 2006, at 1:42 PM, Shaun Cutts wrote: Ok, In AddView.update, self.request.response.redirect(self.nextURL()) is called, but this is not called in EditView... so change isn't as simple as moving nextURL. However, if you put this line into EditView.update as well as moving nextURL, then my redirect works fine. But does this break anything else? Is there some reason why the editview doesn't do redirect? I have gotten offlist feedback that I'm not the only one interested in this Thanks, - Shaun This behavior is by design. add forms need the nextURL because it is advisory to the IAdding. edit forms can just use the changed hook to call self.request.response.redirect('http://whereever.you.want/to/go') Or use formlib, and be able to be fully in charge the way you'll eventually want to be. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] (Beginner's) Questions concerning ZopeX3 Component Communication
On Feb 17, 2006, at 4:24 PM, Lennart Regebro wrote: On 2/17/06, Reinhold Strobl [EMAIL PROTECTED] wrote: I mean, is a remote call in that kind possible? No. The client and server are two different computers. For that reason you must use some kind of network protocol to communicate between them. Well, some people are doing stuff a bit like that with direct ZEO connection (which has a protocol itself, yes), but there's no inherent security over the ZEO connection, so you have to be really careful (or excessively carefree), I'd think. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Lists dont accept default values
On Feb 16, 2006, at 3:55 AM, Frank Burkhardt wrote: I wrote a schema like this to have a list of objects on a content object: class IMyContent(Interface): mynumbers=List( title=_(uCool Numbers), required=True, value_type=Int( title=_(integer) ) default=[1,2,3,5,7] ) FWIW, I just think it's a bug that this doesn't work. Have you put it in the collector? Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Authentication, Principals and PAU...
On Feb 13, 2006, at 6:17 PM, luis wrote: hi all, I'm trying to get started with zope3, and while I think I'm beginning to understand parts of it, I'm still having a hard time with other parts, so I hope someone here can help me out a bit. my first questions are concerning authentication/ users / pau... as a learning-excercise i want to create an example app, where users can register themselves, login and upload files. I added one PAU to my site which uses session credentials and a principalfolder.. so now I can create users in that folder and can log into the system. that works, but when I tried to add additional information (mail, etc) using the principal annotation utility, it just doesnt work... There are many ways to add annotations for a user. If you already have a principal object, and your zcml has included the principalannotation package (as I expect Zope 3 does by default), then you can just say from zope.app.annotation.interfaces import IAnnotations annotations = IAnnotations(principal) annotations['my.package.name'] = 'whatever' # or a btree or whatever Lots of other ways to do it, but that's one. I created the interface and class to store the data, and tried to register them with a zmcl adapter and browser:editform for=zope.security.interfaces.IPrincipal, but nothing happened... so far I've been able to trace it down, the objects in the principalfolder do not implement IPrincipal, but only IInternalPrincipal, so my mapping in zcml is not active for my users. I'm not clear what you want to do here. to be honest, the difference between principals, internalprincipals and principalinfos is not that clear to me. IPrincipals are the primary security interface for principals. The others I expect (without bothering to look at the code) are implementation specific for a given authentication utility. With the pau, principals objects are generated as needed, on the fly, and not persisted themselves. I then downloaded schooltool to have a look how they implemented users there, and they don't use the pau at all, but created an own authentication utility. and they don't use the principal annotation util either, but store the person details as annotations on the objects themsleves.. That's one of the wonders of Zope 3: don't want to use implementation X of interface A? Write your own implementation Y for interface A and register it instead. As long as it complies with the interface, the intent, and the reality whenever I've tried it, is that you should be good to go. I don't know schooltool's history. There could be many reasons for them rolling their own. ...so...is this the recomented way of doing things? is the pau only meant to be an example auth-utility and applications are supposed to implement their own auth. mechanism? or maybe use the pau as a basic framework, but implement your own principalfolder as a pau-plugin? The pau is a basic framework, with a number of reasonable basic implementations. Plugins, such as the LDAP plugin in the svn.zope.org repository, can add capabilities to the pau. something else i noticed, is that in the pau the principalfolder lives inside the pau itself (the pau acts as a container) in software space (++etc++site), while in schooltool the users live in the persons folder in content space. is there a difference between software and content space for this?, specially in regard to users being able to register on their own, user-search or something else that can only be done in content- space but not in software/configuration-space or viceversa? It's a design decision. We have provided views in content space that manipulated objects actually over in ++etc++site. Also, since many pau plugins are utilities, when Jim's 'put utilities anywhere' proposal comes in you could in theory do precisely what schooltool did with a principals folder in content space but the auth utility still in ++etc++ Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] newbie design questions for UI to external data
On Feb 13, 2006, at 10:33 PM, Shaun Cutts wrote: Um... I guess I must have asked too many questions at once :) :-) and this is still a bit much for me. I've implemented a first pass of a container for external data and got it working on some of my collections. I've included the (first pass of the) base DBContainer and DBContained objects for criticism, and would be very grateful if anyone would like to take a crack at it. It looks like an interesting approach--more low-level than I would have expected for a first cut, and *maybe* more low-level than necessary. I wish I had more time to look at it. Keep in mind, this is my first time working with the system, so I'm sure I'm going about some things the wrong way. In particular, I already think: 1) Instead of have the contained object update the container, I should rely on the event notification system. Events are a tool for disconnected notification. calling a method on an object is sending a message directly to the interested party. Not everything should be an event. If a communication between two components is a core aspect of your design, maybe direct method calls are more appropriate. 2) Right now, the system works by translating objects at the border (in IExternalContainer). Some translation is necessary, for instance, to move from mx.DateTime to datetime.datetime, but still I think I should somehow be making use of the adaptor interface. If there's not an object to adapt then you have to start somewhere. My glance at the code seemed to show that you were making a reasonable choice. Another approach might be to have an abstract row object that could represent any columns (a dict or something), and named adapters registered for the row interface plus the name of the generating table. I dunno, do what your app needs and refine it as you discover what works. 3) Along these same lines, IDBContainer._containedType should really be an interface (Object( schema = IDBContained )) Note: is there a tutorial on writing containers anywhere I should have read? I mainly figured this out by banging on it and fishing around in the code. I'd love to figure out, for instance, what is really happening with the traversals (with some interaction diagrams). I do think it was harder than it should have been. (But, then again, I think that about most things...:)) Don't know of a tutorial. Sounds like you are interested in traversal, though, which is different. Look at zope.app.traversing, or zope.app.container.traversal. The headline is that there are two kinds of traversal: URL path traversal and TALES path traversal. They have different adapters. BTW in my humble opinion, ILocation.__name__ is not well named. When I first got an error referring to __name__ I thought it was expecting a class object. And what happens when, for some strange reason, someone wants to put a class in a container, and doesn't like its default name? Not sure if that's a real use case for an ILocation. That said, it's a reasonable POV to say that Zope shouldn't claim __*__ names. But we do, so, well, yeah, we do. ;-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] What attributes are made persistent
On Feb 14, 2006, at 4:52 PM, Florian Lindner wrote: Hello, in a class derived from Persistent, which attributes are stored? All or only those thar are declared in the interface? All. def __init__(self): self.queue = {} self.queue seem is empty each time I restart Zope. Mutable objects, such as sets, lists, and dicts, can't inform their persistent parents when they change, so changes to them are not persisted. Use a persistent mapping in the persistent package (or a btree); or set obj._p_changed=True when the dict changes; or use an immutable data structure that must be replaced on the object instead. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Getting request from subscriber ?
On Feb 13, 2006, at 6:02 AM, Thierry FLORAC wrote: Hi, Probably a simple question... I need to extract request's content from an event handler defined via a subscriber. request doesn't seems to be in a subscriber's context. So how can I get it ?? option 1: make the subscriber listen for an event that has a request attribute (perhaps one you generate). option 2: see if there's another way to do what you want option 3: grab it by force from the thread locals--something like this: import zope.security.management from zope.publisher.interfaces import IRequest def getRequest(): i = zope.security.management.getInteraction() # raises NoInteraction for p in i.participations: if IRequest.providedBy(p): return p raise RuntimeError('No IRequest in interaction') Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Absolute url of an object
On Feb 10, 2006, at 9:11 PM, Paulus Zegwaard wrote: Hi, OK, thanks to Alen and with some further digging, I can sort of answering my own question, I found some answers here: zope3-for-zope2-developers.pdf from Phillip von Weitershausen. Thanks Phillip for thinking of these legions of poor old fashioned zopistas! ;-) So for the other newbies out there (if they search the archives later): * from Python do this: zapi.getView(obj, 'absolute_url', request) # obviously import zapi first Or see zope.app.traversing.browser.absoluteurl.absoluteURL. * from a page template: obj/@@absolute_url Also without doing any extra, it seems that objects don't know their name anymore. No getId() or title_or_id(). But as Alen pointed out the parent normally does some magic, so: you have __name__ (id in Zope 2 speak) and __parent__ (is obj.getParent() in Zope 2) as long as the object provides zope.app.location.interfaces.ILocation. Mmm, I guess I'm gonna roll my own ordered containers See zope.app.container.ordered . I thought there was a folder variant as well, but don't see it. Probably needs views in any case. and pages that have a title attribute. Not sure what you mean/want. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Javascript and custom widgets
On Feb 9, 2006, at 12:38 PM, Rupert Redington wrote: I'm missing something... again... I've started writing some widgets for my current project, some of which will make use of some javascript. This is precisely what we use zc.resourcelibrary for. It has some warts, but we use it, we want to improve it, and it does what we want. See http://svn.zope.org/zc.resourcelibrary/trunk/src/zc/resourcelibrary/ and specifically http://svn.zope.org/zc.resourcelibrary/trunk/src/zc/resourcelibrary/ README.txt?view=auto Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Generations of Zope and Enterprise Culture
On Feb 9, 2006, at 5:20 PM, Edward Pollard wrote: [...] Since I really can't explain the environmental factors in any depth, let me rephrase: How do you sell Zope 3 as a solution? It depends on the audience. It also depends on who's talking. The people who do this selling on a regular basis don't often hang out here. Here's an attempt by a developer. Whoever you talk to, you can talk about the success of Zope 2, the CMF, and Plone. If the audience is people interested in through-the-web programming, you steer them to a Zope 2 based solution (at least right now). If the audience is comprised of experienced programmers, ideally with Python experience, and even more ideally with ZODB experience, you might mention the years of experience that went into the Zope 3 redesign. You might talk about the clean design, the excellent test culture, the emphasis on documentation, the better reuse options, and the embracing of other Python projects. You might point out the two Zope 3 books available in such a relatively short time after the Zope 3 release. If the audience is interested in the ZODB, you talk about the ACID compliance, the recent improvements to the conflict handling (MVCC), and so on. If the audience is further comprised of people who work on big sites, you talk about the scalability of ZEO, and the open-source front-end options. If the audience is concerned about yet-another-Zope-3-rewrite, you first acknowledge their are no guarantees. Then you can mention that Jim Fulton, Zope Pope, has said that he won't write a Zope 4. You can also talk about some of the Zope 2/Zope 3 efforts, which I mention below. Maybe others can offer more. I'm just moving on to the next question. :-) And what do you do to overcome the perception that our investment in Zope 2 will have little to no payoff in a Zope 3 developed project? It's likely that you have four kinds of knowledge from your Zope 2 investment: - Python knowledge (good for Zope 3) - Templating knowledge (good for Zope 3: DTML and ZPT exist) - ZODB knowledge (good for Zope 3) - Zope 2/CMF tool knowledge (you'll want to forget a lot of this, although concepts like object publishing, tree traversal, object file system, and CMF tools carry over in some recognizable ways) So you're losing part of the fourth category. The relative percentage loss that represents for you is something only you can answer. The return for switching is a clean, powerful, test-driven architecture: pretty exciting, to me. There are two side issues: First, ColdFusion and ASP are the other candidates, so while I don't want to encourage and dwell on specific comparisons, I would be lying if I said they wouldn't come in handy. I'm afraid my knowledge of these is very out of date. Python is an obvious important differentiator, though perhaps .Net's CLR and the upcoming 1.0 release of IronPython might change that story. Second, the existence of Zope 3 has completely shot any support for Zope 2 continuation out of the water in our environment. Is this fair, or is there life left to the Zope 2 tree we've developed some experience in? Should I be considering pitching a Zope 2 solution instead? I don't know: that's a very hard question. I'll mention a few interesting data points, FWIW. I think most or all of the big Zope-based companies still make their living mostly on Zope 2 code. Some are moving towards Zope 3 via Zope 2/Five, and some are moving their applications piece by piece to Zope 3, whole cloth. Jim Fulton, Zope Pope, works for a company like that, and has voiced significant interest in Zope 2 merging with Zope 3. Many others in the community feel that way too. No easy answers. ;-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] New User: Zope 2, or Zope 3?
On Feb 8, 2006, at 6:05 PM, Chris Cogdon wrote: Hi folks! I'm starting work on a from-scratch web application, and I'd like to use this as a first-time-application using Zope. (Actually, this is not really the first time... but my previous was something really simple way back in the Zope 1 days, so... just pretend this is first-time). I'm trying to get started quickly (of course), and want to do it reading as much documentation as possible, without depending on you fine folk too much for help. From my research it seems that there's a bunch of documentation and tutorials geared around Zope 2, but not anywhere near as much for Zope 3, and Zope 3 seems a vastly different beast than '2'. Yes, it is. So, my question is... should I stick with Zope 2 for the moment (with its plethora of documentation), or dive right into Zope 3 and battle it out (and depend more on the community for any lack of documentation)? In particular, I DO want a decent tutorial to work through to get me started (and I cant find one of any depth at all for Zope 3). Jim's tutorial is a very good start. Philipp's book is a bit out of date but still generally very valuable and would probably be your next stop. Stephan's book is usually recommended for working after Philipp. Or... can I use the Zope 2 tutorials to work through Zope 3 ?? Nope. They share the ZODB, and basic object publishing concepts. Recently, Zope 2 has begun integrating Zope 3 technologies, but it's still more like Zope 3 knowledge can be back-ported to parts of Zope 2, but not vice versa, much. My background: I'm a seasoned python developer, and have written my own web-frameworks for various applications. Sounds like you are a Zope 3 candidate then. If you want through-the- web development, Zope 2 is what you want (ATM, at least); if you want more standard python development, Zope 3 is what you want. This time I want to use something more 'mainstream' so other developers on the project have something 'familiar' to work with, or at least something that will be useful to learn. The application will need to connect to a PostgreSQL database, and would like some simple authentication plugins so end-users of the application can create accounts, log in, and have data restricted based on logins. Nothing much more fancy than that. Sounds like a good Zope 3 app. The authentication stuff should be custom plugins for zope.app.authentication. I don't remember where the DBA for PostgreSQL is, but it's in the svn.zope.com repository someplace (and others can point it out). Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Zope 3 Marketing Competition? (was Re: [Zope3-dev] Re: Selecting a code name)
On Feb 6, 2006, at 5:37 PM, Martin Aspeli wrote: [...] This is about getting people to *understand* what Zope is about, to understand that we *care* that they understand and that we made an *effort* to make it easy for them to get into it. It's about lowering the barrier to entry and the risk that they'll spend time learning something that'll turn out to be a dead end. It's about showing off that Zope can be sexy and knock the socks off the competition. It's about generating some excitement, not just a dreary list of technical blather. [...] How about we have a marketing competition? :-) The goal would be to set a date, like end of February or end of March, at which point everyone would submit their entries. Entries would be something like a one-to-three page brochure website. We'd vote...maybe within categories like 'marketing copy', 'layout', 'logo', and 'overall concept'. Winners would have net fame, and we'd put top contenders up on a zope*.org site. Maybe we could do something else small for the winners too? Any ideas? Minimal requirements to get this to happen: - final submission date - enough people committing to have an entry (maybe 10? 15? I think *everyone* potentially has something to offer here, so the numbers would ideally be even bigger...but I won't hold my breath :-) - someone willing to organize - a web site to post the results to. ;-) If the due date is in March or later, I'll volunteer to organize, if there's enough interest and then enough commitments to enter. That said, if someone else wanted to volunteer to organize, I'd gladly hand the reins over. ;-) Is this crazy? Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Nine new ZC Zope 3 packages on zope.org
Zope Corp has released nine new packages as standalone Zope 3 projects on zope.org. Three are completely new to the zope.org repository, and six were previously part of the zc Sandbox on zope.org. These three packages are brand new to zope.org. zc.shortcut Our (second) take on the symbolic link use case. zc.displayname What we use for drawing breadcrumbs and such; a dependency of zc.shortcut. zc.relationship A very new cut at a ZODB-friendly directed graph, based loosely on some old ZC work. These next six projects were already in the zc sandbox, and are now moved to full-fledged projects so collaboration is possible and so we share the state of the art. zc.datetimewidget A datetime widget that uses the now-standard mishoo LGPL calendar widget. zc.extrinsicreference One-way references designed to be back-references for standard attribute pointers. zc.form Some *extremely* useful but sometimes undertested widgets, including timezone widgets and choice widgets that remember the last chosen value per user. zc.listcontainer A persistent linked list that might be more appropriate than ordered container for some use cases. Well tested. zc.resourcelibrary An approach to letting page components dynamically request javascript and css resources during page composition. Wants a publishing pipeline to be able to get rid of a heavy-handed replacement of the browser request factory. Good idea, usable and useful now, but could use more polish. zc.table A very useful and powerful table rendering implementation, including the ability to have table-based forms. It has some rough edges that could use polish. ZC has released many other useful standalone projects on zope.org over the past few months, including zope.file, zope.ucol, zope.locking, and zc.catalog. They all are worth a look. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Please Guido, pick me, pick me!
On Feb 3, 2006, at 1:16 PM, Joel Moxley wrote: [...] Overall, I think the time has come for communication of Zope 3 identity to move hand in hand with development. This was a great post. I want it go someplace, and I want you to be involved in getting it there. :-) Those were some fun, good ideas. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] How To Solve in Zope 3
On Feb 3, 2006, at 9:32 PM, matt wilbert wrote: I have exactly the same situation, as I am writing a network management tool. I am using one big container and a local catalog. Then you can slice and dice as best suits you. I also think it is more extensible if you ever think you might add new object types. There is also the relationships stuff in Schooltool. I haven't needed it yet, but I was thinking it might be useful. That's GPL, if that makes a difference to you, and designed for intrinsic relationships. There's also - zc.relationship, which is ZPL, relatively simple in concept, designed for extrinsic relationships between persistent objects, and pretty flexible; - zope.agxassociation, which is ZPL, relatively simple in concept, and designed for intrinsic relationships; - zemantic, which is extrinsic, RDF-based, and designed for the full flexibility of RDF; - Jean-Marc Orliaguet's relationship code, which is based on extrinsic triadic relationships, GPL, and used for CPSSkins; - Helmut Merz's relationship code (http://svn.cy55.de/viewcvs/Zope3/ src/cybertools/trunk/relation); - and more, I bet! Whew! :-/ Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Please Guido, pick me, pick me!
This is an interesting thread. Some opinions and observations: Guido will do what Guido does. His seeming antagonism to Zope is a little annoying, but he's opinionated on other topics too, and sometimes admits to being wrong and human. As some folks mentioned, it does sound like he maybe wants something simpler and more constrained in scope than Zope 3. Maybe Jim's Bobo would be it, or maybe someone else will be able to assemble some Zope 3 bits into a small approachable kit. I am hopeful that Zope 3 will continue strong whether it has huge buzz or not, as Stephan, Kevin, Joel and maybe others said. However, I agree with Joel, Martin, and others that buzz and community would undeniably be helpful. I can even conceive of it being absolutely essential: sadly, trusting on merit alone is a scary and probably naive road. I truly wish we could get the word out about Zope 3. The Zope development companies (such as ZC) are probably only a limited resource: they are making money on Zope, sometimes without their clients knowing or caring that Zope is the tool behind the software. The companies are already often contributing significantly to the development of Zope 3 and/or of an open- or mixed-source platform, and simply don't have too many other further resources to give. I appreciated what Martin said: [...] Note that I'm not saying that the same people who produce the code (and great code it is, which is why I care so much about this) should be doing this. In fact, the Plone experience tells us they probably shouldn't. But *someone* ought to[...] The Zope Foundation, which is probably coming pretty darn soon, might help catalyze contributors a bit. It will own the zope3.org domain, the zope.org domain, and probably lots more, and all of the software. But before or after the foundation, I think small steps are more likely to succeed than grand plans. Someone writing an impressive brochure-ware site about Zope 3 is going to be easier and more impressive than trying to get folks to agree on a grand Zope 3 software site. Someone assembling some of the word-smithing in this thread might even generate a simple impressive advocacy *page* that could be linked to from the front of zope.org. I thought Joel's post had some ring to it, for instance. Whether or not we have a Zope 3: Rebel Angel rename :-), it would be great to see Joel or Martin or someone step up to put some advocacy out there. If I can help with trying to figure out who to ask for what, let me know. Again, ZC is *giving the zope.org site away to the new Zope Foundation*: it will be up to community members and corporate members together to make the site the compelling sales pitch and welcoming documentation that it could be. Just make *small* steps. :-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Still trying to figure out PAU
On Feb 2, 2006, at 4:41 PM, Florian Lindner wrote: Hello, I'm still desperately trying to figure out the PluggableAuthentication. Since no one has replied, I'll try my 30-second remediation technique again. ;-) That means I didn't really follow exactly what you are doing, and I'm just trying for low-hanging fruit to help you. :-) I perform the following steps: 1) Create an instance of my folderish, possible site (named A), content object. 2) I create a site in it. 3) I add a PAU in the default software space 4) I add a SessionCredentialsPlugin and a PrincipalFolder as plugins. 5) I create a internal principal with Title = zope.Manager (tried also other ones). name = abc 6) In the SessionCredentialsPlugin I leave to loginForm.html. I've a loginForm.html view in my A-object) 7) I register all components (SessionCreadentiasPlugin, PrincipalFolder and PAU) So that means that http://127.0.0.1:8080/++etc++site/default/test.pau/ @@configure.html (or similar) has one credentials plugin in the right column (Session Credentials (a utility)) and one authenticator plugin in the right column (PrincipalFolder (a utility) or something like that). Right? If not, make it so. :-) If that doesn't work, try making the right column of the Credentials Plugins field be No Challenge if Authenticated (a utility) first and then Session Credentials (a utility) second. That's probably what you want anyway. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Looking for PathIndex
On Feb 1, 2006, at 3:12 AM, Thierry FLORAC wrote: Hi ! I'm actually trying to create a Zope3 application, where I may be able to make queries : - looking for content in the whole site - looking for content in a given sub-site or list of sub-sites, eventually including all it's sub-folders. With Zope2, I was commonly using a PathIndex (mixed with other Text of Field indexes), but I can't find any reference to this index type in Zope3... Is it deprecated ? What is the best way to handle such queries with Zope3 ? Thanks for any help, Thierry P.S.: are the DateIndex and DateRangeIndex also deprecated ? They were very useful for me in Zope2... For code similar in effect to the Zope 2 DateIndex and DateRangeIndex, look at http://svn.zope.org/zc.catalog/trunk/src/zc/catalog/index.py?view=auto The bottom of the file has a DateTimeValueIndex and a DateTimeSetIndex. There's some discussion on what's going on here. The DateTimeValueIndex and DateTimeSetIndex are normalized versions of the value index and set index in the package. The value index, set index, and normalizing features all have their own .txt document. http://svn.zope.org/zc.catalog/trunk/src/zc/catalog/valueindex.txt? view=auto http://svn.zope.org/zc.catalog/trunk/src/zc/catalog/setindex.txt? view=auto http://svn.zope.org/zc.catalog/trunk/src/zc/catalog/ normalizedindex.txt?view=auto For all of the indexes' features, it needs to be used in an extent catalog, also in the zc.catalog package. For a path index, you could just have a set index (also in http://svn.zope.org/zc.catalog/trunk/src/zc/catalog/index.py?view=auto ) that was configured via an adapter to index the containing paths of any given object. For instance, if an object were at /foo/bar/baz/ bing, your adapter should return ['/foo', '/foo/bar', '/foo/bar/baz', and '/foo/bar/baz/bing'] Then searches for Give me everything in '/foo/bar' will return this object (as well as any others that are in the path). This approach would probably also work with the keyword index in standard Zope, but I haven't looked at that in a while. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] test() in TALES in Zope3
On Feb 1, 2006, at 3:17 AM, Frank Burkhardt wrote: On Wed, Feb 01, 2006 at 09:04:36AM +0100, Frank Burkhardt wrote: [snip] div tal:attributes=class python: 'foo' + test(condition == True,' bar','') / Is this possible? Impressing simple solution :-) . FWIW the classic Zope 3 solution is to say Don't do that in the template! Do it in the view class!. I'll let others add vigor, if they wish. I just wanted you to know the purist answer in case you cared. ;-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] test() in TALES in Zope3
On Feb 1, 2006, at 8:07 AM, Andreas Jung wrote: --On 1. Februar 2006 07:56:47 -0500 Gary Poster [EMAIL PROTECTED] wrote: FWIW the classic Zope 3 solution is to say Don't do that in the template! Do it in the view class!. I'll let others add vigor, if they wish. I just wanted you to know the purist answer in case you cared. ;-) If you have only one python: statement within your template then a view class is pretty much overhead (and a waste of manpower to write it)... I hear ya. I figured someone ought to wave the purist flag, at least half-heartedly, though. :-) Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] generations and utilities
On Jan 31, 2006, at 11:16 AM, Paolo Invernizzi wrote: Hello, I've developed a content object for zope and I'm using the install.py script in a generation package to install some prebuild content instances in a folder, and everything works well. I'm now trying to add a Catalog plus IntIds to do some search... but I'm doing something wrong... This smells like an unhelpful exception, swallowing the real problem down deeper in the code. I bet it's just that you haven't added the key reference package or something like that. Have you included zope.app.keyreference in your ZCML? Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: generations and utilities
On Jan 31, 2006, at 11:48 AM, Paolo Invernizzi wrote: Do you mean if there's a zope.app.keyreference-configure.zcml in the instance/etc? Yes, it's a standard zope 3.2.0 created instance... Ah well, sorry. Your recipe looks fine. If I were in your shoes my next lazy attempt would be to try committing the transaction with the intids and catalog before adding the indexes. Beyond that I'd have to start digging. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Re: generations and utilities
On Jan 31, 2006, at 12:23 PM, Paolo Invernizzi wrote: Gary Poster wrote: Your recipe looks fine. If I were in your shoes my next lazy attempt would be to try committing the transaction with the intids and catalog before adding the indexes. Ok, I added the transaction... still bangs, the full traceback is at the end... Heh, ok, I'll try just one more one-second diagnosis then. ;-) Are you setting the site? old_site = zope.app.component.hooks.getSite() zope.app.component.hooks.setSite(object) try: # ...add the utilities and indexes in here... finally: zope.app.component.hooks.setSite(old_site) If that doesn't do it, then we'll see if somebody else can suggest Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] User management in Zope3?
On Jan 27, 2006, at 1:57 AM, Roman Susi wrote: Hi! Maybe this is a very naíve quiestion from Zope3 beginner, but is there any ready module for user management in Zope3? For example, certain subfolder needs LDAP auth. Am I to write myself all the code? (zope.org has draft of User management API proposal... disturbing) If there are many ways to do it, then what is the most obvious? You want to look at zope.app.authentication, and for LDAP I believe you'll want to hook zope.app.authentication in with the code in http://svn.zope.org/ldappas and http://svn.zope.org/ldapadapter . Gary___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Permissions of a given object
On Jan 17, 2006, at 10:38 AM, Frank Burkhardt wrote: Hi, On Sun, Jan 15, 2006 at 11:20:47AM -0500, Stephan Richter wrote: On Thursday 12 January 2006 08:13, Frank Burkhardt wrote: but the problem remains: canAccess returns True for all inaccessible objects. It is hard to guess where your setup is wrong. Does it not work for unit tests, ftests and/or the full application? The full application. In a browser:view I want to query my Catalog to return a list of objects: list = catalog.searchResults(content='findme') list contains a list of objects containing the word 'findme'. Now I want to filter the list to contain only obj, the current principal has access to. permitted_list=[] for obj in list: if canAccess(obj,'__call__'): permitted_list.append(obj) But there's no security proxy wrapping 'obj' s from 'list'. How do I securityproxify 'obj' before being checked by canAccess so that the result of canAccess reflects if the current principal is allowed to access 'obj' ? 1) adding a security proxy is done with zope.security.checker.ProxyFactory 2) canWrite and canAccess already do this for you: the code you list should work without modification of the sort that you describe. Maybe I'm completly wrong and there's another way to filter searchresults for objects, the user has access to? The meaning of objects a user can access varies significantly from application to application. You will probably want to optimize this filter by creating an index eventually. For some policies and questions, this might be hard to do well. We'll be releasing an index that does this sort of thing for one kind of use case soon, but it doesn't precisely match what you are doing here. You'll probably want to think about this problem for your app and see how you can index the data. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Convert from string to class
On Jan 17, 2006, at 5:10 PM, Florian Lindner wrote: Hello, I've a string like zope.app.folder.Folder and I want to get the class zope.app.folder.Folder from this string. How can I do that? It's probably more a python problem that Zope... but I hope you excuse. Was just rewriting this for myself, as a matter of fact--something I need now and then. This is today's spelling: def getImport(s): ... try: ... return __import__(s, globals(), {}, ['ignored']) ... except ImportError: ... elements = s.split('.') ... last = elements.pop() ... mod = '.'.join(elements) ... mod_obj = __import__(mod, globals(), {}, [last]) ... return getattr(mod_obj, last) ... getImport('xml.sax.saxutils.unescape') function unescape at 0x28b630 getImport('xml.sax.saxutils') module 'xml.sax.saxutils' from '/Library/Frameworks/Python.framework/ Versions/2.4/lib/python2.4/xml/sax/saxutils.pyc' Could be refined a bit, but that's the idea. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Anyone had any success with ZCatalog in Zope 3?
On Nov 17, 2005, at 9:05 AM, Johan Carlsson wrote: Johan Carlsson wrote: Ivo van der Wijk wrote: On 11/17/05, Johan Carlsson [EMAIL PROTECTED] wrote: The code you gave me shows the same showed the same problem as Jürgen pointied out, the IntId needs to have '' as id. I remember having some real issues with IntId / Catalog, I doubt if they ever really got fixed. Check the patch in INSTALL.txt: https://secure.m3r.nl/repos/opensource/zope3/cubic/trunk/doc/ INSTALL.txt It once used to work for me, at least :) Ah, thanks for the heads up. Now I see, that's exactly what been bitting my butt all along. The patch fixes the problem! Hm. A very quick look at the patch concerns me a bit. Am I right that, if you apply the patch, then requests that are currently raising a NotYet for you will instead silently fail, not cataloging what you requested? That seems undesirable to me. I'd prefer the exception. If I'm on the right track here, then the extentcatalog in the zc.catalog package in the sandbox probably is one of possibly many other better solutions than the patch. It postpones cataloging to the end of the transaction, which I believe will remove the NotYet exceptions *and* successfully catalog your data. Apologies if my quick patch read is off base. Gary___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] First time install problem
On Oct 18, 2005, at 3:47 PM, Tim Penhey wrote: Hi All, I am using Kubuntu 5.10 (Breezy Badger) and after failing to use the pre-packaged zope3, I tried to download and install the one from zope.org. Using Python 2.4.2 and gcc 4.0.2. Since I don't have python2.3 installed (and env 'aint in /bin), I had to change the first line of the test.py from #!/bin/env python2.3 to #!/usr/bin/env python ./install.py build worked fine, however ./test.py -v fails on one test: Failure in test testRunIgnoresParentSignals (zdaemon.tests.testzdrun.ZDaemonTests) Traceback (most recent call last): File /usr/lib/python2.4/unittest.py, line 260, in run testMethod() File /home/tim/Zope-3.1.0/build/lib.linux-i686-2.4/zdaemon/tests/ testzdrun.py, line 237, in testRunIgnoresParentSignals self.assert_(is_started, spawned process failed to start in a minute) File /usr/lib/python2.4/unittest.py, line 309, in failUnless if not expr: raise self.failureException, msg AssertionError: spawned process failed to start in a minute test was run as normal user. What next? Given that I am trying to go through the text of Zope 3 Developer's Handbook and Web Component Development with Zope 3 is it something that is going to matter to me? Nope. Is it a known problem, bug, or problem with my install? Known problem AFAIK. I believe this is the same one as Jim addressed here: http://mail.zope.org/pipermail/zope3-dev/2005-September/ 015851.html Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] searching content objects on created datetime
On Oct 5, 2005, at 9:00 PM, Alen Stanisic wrote: Hi, I am trying to search my content objects on their creation datetime. For example, a user can enter From and To dates and I would like to retrieve all content objects based on the date range. Hi Alen. Take a look at zc.catalog in the sandbox. It has some code to specifically do what you want (assuming I understand it). http:// svn.zope.org/Sandbox/zc/catalog/ Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] benji york's quick_start.txt
On Oct 5, 2005, at 1:12 PM, Matthew Russell wrote: Hi, I'm following Benji's quick_start.txt ... TypeError: ('Could not adapt', zope.publisher.browser.BrowserRequest instance URL=http://localhost:8080/hello/@@edit.html, InterfaceClass zope.interface.common.idatetime.ITZInfo) Hi Matt. Looks like that might be an omission from the quick start, and a reasonable one at that. We (Zope 3 devs) need to have a default story for adapting request to timezone if formlib is to be part of the trunk (and it is now). Here's a workaround (sorry that it makes you maybe do more than you should have to do for a quick start). Make a file, maybe called adapters.py in your package, with this in it: import pytz from zope import interface, component from zope.interface.common.idatetime import ITZInfo from zope.publisher.interfaces.browser import IBrowserRequest @interface.implementer(ITZinfo) @component.adapter(IBrowserRequest) def tzinfo(request): return pytz.timezone('US/Eastern') # or whatever timezone you wish I dunno if Benji is having you use zcml yet. If you are, add this to your zcml: adapter factory=.adapters.tzinfo / *Otherwise* try adding this to the end of your file-- component.provideAdapter(tzinfo) --and make sure you import the adapters file from someplace so that it will actually run. Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users