[Zope-PAS] Basic auth/challenge problem
Recently upgraded from PAS 1.4 to 1.5.3 (and Zope 2.8.8 to 2.11.2). I'm having a new problem with basic auth; namely, that basic auth information is ignored when using wget. Browsers work fine, ZMI asks for basic auth creds. wget (and lynx, for that matter) doesn't. For example, I'm doing: wget --user myuser --password mypassword http://localhost:8080/path/to/thing I threw a breakpoint in ZPublisher/HTTPRequest.py:275 to see what auth information was in the request environment; there is none. I also tried wget http://user:p...@localhost:8080/, just for kicks, but of course the same problem. A key datapoint: it works when I pass the --no-auth-challenge option to wget. For all intents and purposes, this is a vanilla install of PAS and Zope. The plugins that are active appear identical to a Zope 2.8.8/PAS 1.4 instance that /does/ work. Any ideas? --Ian ___ Zope-PAS mailing list Zope-PAS@zope.org http://mail.zope.org/mailman/listinfo/zope-pas
[Zope-dev] Re: [Repoze-dev] repoze.bfg
Chris McDonough wrote: I had planned to create another package named repoze.lemonade which: ... - Did indexing of content. What were you thinking of for indexing? Just catalog stuff? More general? There's been a tension in the opencore stuff with the catalog, mostly that it's easy to setup and use for things, but it doesn't really work for things outside of the ZODB. Or, I guess theoretically you could catalog things not in the ZODB, but it's never happened. That said, there's a real need for cross-system indexing of different kinds. There's text search indexes, but other kinds of more strict indexes also make sense. It would be very handy to have an index that wasn't tied to the ZODB, a database, or anything else. (It could be implemented using the ZODB or a database, of course.) -- Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Repoze-dev] repoze.bfg
Chris McDonough wrote: There's been a tension in the opencore stuff with the catalog, mostly that it's easy to setup and use for things, but it doesn't really work for things outside of the ZODB. Or, I guess theoretically you could catalog things not in the ZODB, but it's never happened. IMO, mostly it's a matter of deciding what index and catalog means for searching. If you only need full-text search, some indexing systems are totally inappropriate. Likewise, if you only need field indexes that match just one particular value, it's sometimes vastly simpler just to come up with your own system based on, e.g. a relational table, than it is to try to use somebody else's indexer or catalog. They are similar in that they both need to get information about updates, and a way to reindex. Full text search can be a little lazier, as being 100% up-to-date isn't such a big issue. That said, there's a real need for cross-system indexing of different kinds. There's text search indexes, but other kinds of more strict indexes also make sense. It would be very handy to have an index that wasn't tied to the ZODB, a database, or anything else. (It could be implemented using the ZODB or a database, of course.) Xapian seems like a good choice too. It has its own persistence mechanism and reasonable Python bindings (although from experience maybe slightly memory-leaky). Yes, once you get the documents into it. Actually, it's really a many-to-many notification system that's needed. We have one that needs documenting and review (http://www.openplans.org/projects/cabochon/project-home) but while it handles notifications and events (as do several other systems), that doesn't cover reindexing the site. And then you also need a set of useful endpoints, but those can grow over time. -- Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope] How can I import this module in python script ?????
Hi, I am playing around trying to make something happen on a workflow state change. Beacause I cannot import the module I need in the python script I am getting an error: global name 'getMemberById' is not defined how can I import this module or better still code this so I am not importing anything at all (i imagine the restrictions on importing modules was done for a reason). #import the module we need from Products.CMFCore.utils import getToolByName # Get the content object we're publishing review_state.object # How can I import this module? #from Products.CMFDefault.MembershipTool import MembershipTool mt = getToolByName(context, 'portal_membership') listed_ids = mt.getRoster() contentObject = review_state # Start with an empty list, ready to be filled with the addressed # of people we're dispatching to mailList=[] mailhost = context.MailHost mailhost = getattr(context, 'MailHost', None) # Iterate through all the site's users # context.portal_membership.listMembers(): for id in listed_ids: member = getMemberById(id) email = member.getProperty('email') # add them to the list of people we're emailing mailList.append(email) mMsg = 'Crop notification sent' mTo = email # and send it mailhost.send(mMsg, mTo, '[EMAIL PROTECTED]', 'New Crops available') # The change in indentation signals the end of the loop, so we've # now sent all the emails. Let's now send a confirmation that we've done it. # We'll be building the email as a string again, but we have to convert our # list data elements into a string before we can append the information recipients = string.join(mailList) mMsg = 'These people were sent e-mails' #mMsg += contentObject.absolute_url() + mMsg += recipients mailhost.send(mMsg, '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', 'Lizard Leaves Announcement email confirmation') thx []'s Ian F U cn rd dis U mst uz Linux. ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope-dev] Re: ploneenv - Or how using workingenv for a common Zope2 project might look like ;-)
Daniel Nouri wrote: [...] - There is a single file that shows me what eggs and development eggs make up my package. This makes it easy to add new eggs, for example - and also easy to remove them again. With workingenv-based solutions, you can specify a file full of eggs to install when it's first set up, but from that point onwards, the environment can grow as you easy_install new things. It's not immediately clear to me how you reconcile all the eggs you've installed (not all of which may be needed when you're done trying things out, and some of which may just be dependencies you don't want to think about directly) into a list that are clearly dependencies of your application. Querying the list of installed eggs is what tools like Yolk[5] are good for. Note that for setuptools packages, the setup.py file lists all dependencies. If you develop for e.g. Listen and Plone, you only need to keep track of Listen and Plone. One of the things that I think is pretty easy with workingenv, and a bit confusing with buildout, is moving one package into development. In workingenv you get the package you want (however you do that -- check out a branch, make your own local repository, unpack a tarball, etc), and you run (after activating the environment) python setup.py develop. Or if the package isn't using setuptools, python -c 'import setuptools; execfile(setup.py)' develop. Note that this is actually one of the few places you actually have to activate the environment. And heck, if I just compiled a little something into bin/python then even that wouldn't be necessary. (Maybe even a hard link would be enough, I'm not sure.) In buildout it's a bit more complicated. You can move an egg into develop-eggs, but that relies on buildout finding the right package. That's not really that easy, especially because setuptools only really understands packages being newer or older, it doesn't understand things like branches. It's hard even when you don't have this problem. - With workingenv, when I run easy_install SomePackage I need to worry about whether I'm actually in the global environment or the workingenv of the instance. That is, workingenv requires activation (putting your shell into a special state where the python environment is the one in your workingenv, until you deactivate it). By contrast, other people may not like the add to buildout.cfg, re-run buildout dance that buildout uses instead. If you use the easy_install script in the workingenv bin/, then you don't have to activate the environment. Very similar to buildout, workingenv scripts contain their path/environment. - It works in Windows. :) I have no idea how hard it's to make ploneenv work on Windows, but I hope it's not too bad. The scripts Hanno wrote do give us a near-proper zopectl for Windows as well, which is nice. I imagine these could be adapted to be used with plain Zope instances, though. I assume workingenv gives us setuptools script support locally as well. Support for Windows should be fairly trivial. I would appreciate it if someone (Hanno?) gave it a try. Basically, all we need is the correct way to patch bin/zopectl so that it runs the bin/activate.bat script before startup. We shouldn't seriously consider runs on Windows as an argument for ploneout, just because ploneenv hasn't seen a Windows developer yet. :-) Workingenv does, as far as I know, work with Windows. At least I've received several patches (I've never used it myself). -- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: ploneout - Or how using zc.buildout for a common Zope2 project might look like
Jim Fulton wrote: Ian Bicking wrote: What I would *like* the distinction between workingenv and buildout to be is that workingenv is interactive (i.e., install with easy_install) and buildout is declarative (i.e., specify your environment with buildout.cfg). Well said. I was looking for a way to bring this up in the discussion. This is a key difference. When you use workingenv, how to you reproduce an existing workingenv? Is there something you can check in and later check out to get the same workingenv? Or is this just not in scope? Maybe it should be out of scope, but I have built something into workingenv for it. You specify a file or URL with --requirements, a text file of things to install. You can also indicate --find-links and --editable in the file, as well as refer to another requirements file. The files look like: Pylons==0.8.2 # Adds several eggs and links that aren't on PyPI: -f http://pylonshq.com/download/0.8.2/ ZPTKit SQLObject==0.7.2 Then it will install all these packages. You might then put this at http://svn.myrepo.org/svn/projects/pylons_project.txt and then create another like: -r http://svn.myrepo.org/svn/projects/pylons_project.txt -f http://svn.myrepo.org/svn/projects/project_index.html -e MyProject This would set up the basic Pylons environment, but also add an editable version of MyProject into src/, including activating the file. (Notably MyProject *should* require Pylons and the other packages, seemingly rendering the pylons_project.txt useless, but probably *shouldn't* require exactly Pylons==0.8.2 because then you'd have to break that requirement to even test if such an exacting requirement was actually true.) workingenv also saves some of these settings (like the requirements file) so you can rerun it on a directory. If the requirements file had changed you'd get the updates, or if workingenv had changed it'd rewrite its files. Ideally you'll switch things around, rerun your tests, do some development, and once you've reached a stable state push those changes back into the requirements file. Another motivation for this was to make a simple command for people to try out a new framework, like: wget http://svn.colorstudy.com/home/ianb/workingenv/workingenv.py # You might also have several files attached to specific tutorials or # use cases: python workingenv.py \ -r http://some-framework.org/requirements.txt MyProject cd MyProject source bin/activate cd src paster create -t some_framework MyCode cd MyCode paster serve development.ini And they'd have an editable hello world at that point pretty reliably, without any system dependencies that might make the installation finicky. I had this bootstrapping idea in mind when I added --requirements, I wasn't really thinking much about deployment. It doesn't work well for things like database drivers (which are often needed for tutorials), which are often hard to install with easy_install; this is probably why I should make --site-packages default to on, and then just tell developers to use --no-site-packages to tests their requirements files. But anyway, with the goal of bootstrapping new developers without having to explain the tedious details of Python's packaging conventions, I think workingenv does reasonably well. -- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: ploneout - Or how using zc.buildout for a common Zope2 project might look like
Jim Fulton wrote: Similarly, say I had two applications, one in Zope and one in Pylons, part of the same deployment (possibly interwoven using wsgi). If I installed elementtree as an egg in buildout.cfg, I'd expect it to be available to both. If that means patching some of pylon's confg files or startup scripts to explicitly reference eggs that buildout is managing, it would mean that I'd need a very specific recipe for Pylons development that would need to know a lot of detail about how that sets up its environment Yes, depending on how complex Pylon's setup was. For example, if Pylons exposed it's scripts using setuptools entrypoints, you you could install them with buildout. Pylon's doesn't have its own scripts. Generally an application will require Pylons, Pylons requires PasteScript, and PasteScript provides a paster script. A quirk in buildout was that asking for the paster script to go in bin/ didn't seem to work unless I specifically was installing PasteScript. Anyway, they all use entry points, so that part is fine. I've considered encouraging each WSGI/PasteDeploy application to ship its own script that hides the existence of paster (or any specific framework). But that doesn't seem quite right either, since a WSGI application can be (and in production usually is) used as a library in addition to a stand-alone application. At that point it becomes similar to a Zope product, or Plone content type, or... well, I guess there's limits to the similarity as I try to find analogs. I guess that's the style differences between Zope and... all the other frameworks. I'm not sure what name really describes the difference in pattern. (in the same way, the z2c.recipe.zope2instance recipe knows about how the zopectl and runzope scripts set their PYTHONPATH and patches them). Zope startup scripts are sort of interesting because they are instance specific -- combining instance-specific configuration with software definition. This is something that setuptools entry points don't handle very will by themselves. That's why buildout has custom script generation facilities that alllow definition of extra initialization code and entry point arguments. I wouldn't be surprised if Pylons had similar needs. You just have to give the config file as an argument when you start the server, there's nothing setup that binds a script with a config file. I played with a #! setup where the config file became a script, but I found it rather hard to work with (there's a lot of problems with how #! works across platforms). So for now it's just always explicit, and if you want something else you have to set up your own shell scripts. -- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: ploneout - Or how using zc.buildout for a common Zope2 project might look like
Jim Fulton wrote: Ian Bicking wrote: Martin Aspeli wrote: whit wrote: actually, in my current workplace, workingenv is the standard way to set up one's dev environment. but in the context of the previous statement, familar is perhaps a better word. I'm still not clear how widely used workingenv is? Is it officially endorsed anywhere else? It steps more lightly than buildout does. What does that mean? It implements less and relies more on what other tools already do. It's also mostly equivalent in mechanism to virtual-python, which is used quite widely. Both use setuptools conventions more closely than buildout does. It would be nice if I could say then you get access to all the setuptools-related management tools, except there are almost none :( But if they *did* exist you'd get access to them ;) I suggest that workingenv and buildout are both such tools. Build stuff seems surprisingly contentious. The debate around setuptools itself has always been far more difficult than it should be; there's a lot of stop energy. So the Python community as a whole is moving very slowly on this stuff. I suggest that, other than contention, this is somewhat healthy. People with different goals will often need different tools and make different tradeoffs. Sure, but I'd also like if there was a clear story for people doing this sort of stuff. I hate the difficulty describing how to do this general stuff, especially when describing it to people who don't even know what their goals are and just need *one* good solution rather than a choice of solutions. Which is to say, I'd rather we try to figure out... something, rather than just chock it up to different goals and go our separate ways. I haven't yet figured out what that something is, and probably that's the hard part. Maybe part of it is a clear and simple scaling from something fairly ad hoc (like a workingenv that you've manually installed stuff into) into something more formalized (like a buildout). Casual and beginning users work best with something they can directly touch and inspect. In a more formalized system it's better to have a central place that described intention and the full system -- the casual user probably hasn't figured out their intention or the full system until well after they've completed their task. Of course, some of buildout's scope is outside of workingenv's -- like building non-Python libraries, and setting up specific application instances. I think it's fine if non-Python libraries require a more advanced setup, but application instances are something I'd like to have a better story for. (Indirectly I'm still trying to figure out the best way to create application instances for PasteDeploy apps too -- I have some stuff in there, but I'm not terribly happy with it, and I haven't figured out what instance creation should be attached to.) -- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: ploneout - Or how using zc.buildout for a common Zope2 project might look like
Martin Aspeli wrote: Eggs exist to pkg_resources (the runtime portion of setuptools) simply by being available on a path. E.g., if you have lib/python/ on the path, and lib/python/Foo-1.0.egg/ exists, then if you do pkg_resources.require('Foo') that will add lib/python/Foo-1.0.egg/ to the path, and you can import from it. When you can actually import from the egg it is active. You can also see its entry points at that time, but not if it is just available. If lib/python/Foo-1.0.egg/ is on the path to start with you can import from it directly. This is what zc.reipe.egg does I believe. It activates (i.e., adds eggs to the path) in the scripts. I think setuptools' egg activation will be superfluous at that point, because a complete and consistent set of eggs is activated up-front. I'm not even sure if you can activate any extra eggs (that might be available on eggs/ or something) at that point, because the containing directory isn't on the path. But since buildout controls those directories that would be fine, I guess, assuming you don't put anything in those locations on your own. In that way I suppose lib/pythonX.Y/ would be a misnomer of sorts, as eggs/ is just a storage area for eggs that are managed elsewhere (in buildout.cfg). OTOH, easy_install and setuptools generally has no problem dealing with eggs that *aren't* on the path, if you use a .egg-link or .pth file to point to the egg (preferably both). So while Jim hopes to have a centrally located repository of eggs (where buildouts only draw on a subset), this is already possible using setuptools' conventions. Then lib/python could become (BTW, existing Zope 2 stuff often seems to prefer lib/python/ over lib/pythonX.Y/, for reasons I don't really understand -- it basically prefers the distutils --home option over the --prefix option. So using workingenv with Zope I use workingenv.py --home, which sets up the environment slightly differently) Secondly, have you seen this proposal? I'm sure you'd have something to add. http://wiki.zope.org/zope2/EggifyingZopesExtensionMechanismQuotProductsQuot zc.buildout also uses entry points for its recipes, and several people have talked about entry points instead of ZCML slugs, so I think things are moving in this direction. I left some comments over here a while back: http://wiki.zope.org/zope3/ZopeConfigurationEggSupport But that's more about ZCMLy things. Philipp's proposal looks fine to me, though it doesn't seem to address how products would be activated or not (it seems to mention that eggs wouldn't be installed as products by default, but doesn't propose a mechanism to select the products). Because of the difficulty scanning for entry points if the egg isn't activated, I'd advocate sticking to something like enumerating (or blacklisting) distribution names. Then if you have: [zope2.products] CMFDefault = Products.CMFDefault the entry point name CMFDefault wouldn't be significant. Or you could select not just distributions, but distributions+entry_point name. In Paste I use egg:Package#entry_point_name (where entry_point_name defaults to main). I believe buildout uses Package:entry_point_name, where entry_point_name defaults to default. If we could all agree on a convention, that'd be nice. I strongly prefer main, because that's really what I think the unnamed entry point is, not just default -- default just refers to the parsing/locating strategy, not the intent. I also would like something that is unambiguously different from a Python object specifier, so that you could take either an explicit object reference or an entry point in the same place and be able to clearly tell the difference. But if we can agree on something and document it, I'm willing to update Paste Deploy to support the new/standard syntax. Ian ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: ploneout - Or how using zc.buildout for a common Zope2 project might look like
Martin Aspeli wrote: whit wrote: actually, in my current workplace, workingenv is the standard way to set up one's dev environment. but in the context of the previous statement, familar is perhaps a better word. I'm still not clear how widely used workingenv is? Is it officially endorsed anywhere else? It steps more lightly than buildout does. It's also mostly equivalent in mechanism to virtual-python, which is used quite widely. Both use setuptools conventions more closely than buildout does. It would be nice if I could say then you get access to all the setuptools-related management tools, except there are almost none :( But if they *did* exist you'd get access to them ;) Build stuff seems surprisingly contentious. The debate around setuptools itself has always been far more difficult than it should be; there's a lot of stop energy. So the Python community as a whole is moving very slowly on this stuff. Ian ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: ploneout - Or how using zc.buildout for a common Zope2 project might look like
Martin Aspeli wrote: I don't have a usecase for executing the scripts with any python interpeter other than the one which ran setuptools to generate them, and therefore don't care for the hard-wired path manipulation I would agree that having to mangle multiple scripts is annoying. On the other hand, I find the activate/deactivate dance annoying. I rather think that the scripts that buildout has created should not require any special activation or introduction to a particular environment. workingenv doesn't require that you activate before running scripts, each script contains in effect what active/deactive does. Basically it munges script creation to do: #!/usr/bin/python -S import sys, os sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib/python%s.%s' % (sys.version_info[0], sys.version_info[1])) import site virtual-python -- which might be the better/simpler solution, if you just ignore the tree of symlinks -- selects the environment through the interpreter itself (i.e., #!/path/to/virtual-python/bin/python). Ian ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: ploneout - Or how using zc.buildout for a common Zope2 project might look like
Martin Aspeli wrote: I don't have a usecase for executing the scripts with any python interpeter other than the one which ran setuptools to generate them, and therefore don't care for the hard-wired path manipulation I would agree that having to mangle multiple scripts is annoying. On the other hand, I find the activate/deactivate dance annoying. I rather think that the scripts that buildout has created should not require any special activation or introduction to a particular environment. Perhaps a solution is to let buildout put things in standard places (as I'm typing this, we now have all the ploneout .egg and .egg-link files/directories in ${buildout}/lib/python) and then have an optional workingenv at the root of the buildout that could be activated when you want that, but let the buildout-managed scripts (e.g. zope start/stop and test runner) not require this? I have a feeling there's more to this than agreeing on directory layout though. But I hope it oughtn't be *that much more*. I did some experimentation with this. Basically, I did: - make egg-directory and develop-egg-directory in buildout.cfg be lib/python2.4 (which is what workingenv uses) - run the buildout again - create standard workingenv (python workingenv.py .) in the root buildout directory The results are fairly encouraging: - buildout-installed eggs don't work in the workingenv jail... - ...but they do if I manually add them to lib/python2.4/easy_install.pth - easy_installed packages (i.e. installed with workingenv's easy_install) are available to zope This was only a brief test, but seems to me that if buildout was managing the easy_install.pth file we wouldn't be a million miles off something where the source bin/activate dance was optional and would work as a generic solution, but would not be required for zope's startup and other buildout-managed scripts. I would assume that buildout is specifically disabling easy_install's updating of easy-install.pth -- buildout is still installing packages with easy_install, but with some monkeypatches of the command. workingenv also monkeypatches easy_install, but only to change script creation (as noted in another email) and to keep it from rejecting workingenv's site.py. Anyway, if easy_install was allowed to do its thing then they'd be more compatible. However, I'm not sure whether and how buildout should manage easy_install.pth in a non-hacky way. A hacky way would be to have a buildout recipie that, if included, would just patch that file up based on buildout['buildout']['eggs'] (i.e. the list of eggs listed in buildout.cfg under the main [buildout] section). I don't really understand the purpose of easy_install.pth and why it matters here, though, so suggestions welcome. :) Eggs exist to pkg_resources (the runtime portion of setuptools) simply by being available on a path. E.g., if you have lib/python/ on the path, and lib/python/Foo-1.0.egg/ exists, then if you do pkg_resources.require('Foo') that will add lib/python/Foo-1.0.egg/ to the path, and you can import from it. When you can actually import from the egg it is active. You can also see its entry points at that time, but not if it is just available. If lib/python/Foo-1.0.egg/ is on the path to start with you can import from it directly. The eggs listed in easy-install.pth are put on the path, and hence are activated by default. You can still require a different egg version (e.g., Foo==1.1), and I believe setuptools will (if it can) switch the path to remove the default activated egg and put on the new egg. If you install a package with easy_install -m (multiversion) then none of the versions go on the path, and eggs will only be added when they are specifically required. Any egg listed in install_requires in setup.py will get added as soon as you require the original egg, and when you run a script from an egg it'll activate that egg as well, so if you are thorough with your requirements then none of the eggs need to be activated. One problem if you are using entry points is that if your egg isn't activated and you are searching entry points by name (not by egg) then your egg has to be activated to work (Buffet and paster create templates are both searched by name, for example). I have expected this to cause more problems than it has, but since people have stopped leaning too heavily on setuptools versioning (thanks to virtual-python, workingenv, and buildout) I think it hasn't come up much. Anyway, if Zope was to start using entry points to replace some of its ZCML (which I personally think would be a good idea) this is something to be aware of. Ian ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman
[Zope-dev] Re: ploneout - Or how using zc.buildout for a common Zope2 project might look like
whit wrote: Not everybody likes the activate dance. With buildout, you don't need it. The recipes make sure that the scripts that get installed into the buildout's 'bin' directory have the right PYTHONPATH set and have access to the eggs you requested for the buildout. is there really a difference between zopectl and source bin/activate? I guess the main difference here is where PYTHONPATH gets set and how people work with it. for example, if you just start python and want to play with code sounds like with zc.buildout you are out of luck for things installed in the buildout. In our situation, we might have multiple versions of software running on different processes started in different workingenv (often not even using zope).being able to contextualize the python path is a useful development tool; this is understandable for buildout to avoid(as a deployment tool), but if we are considering using buildout as a prescribed way for people to manage their development environments, it seems lacking. I think this is the basic difference -- workingenv is development-centric, while buildout is deployment-centric. This does not necessarily mean the best tool for the job, because focusing on development and ignore deployment isn't a good job, nor the other way around. At TOPP we know how to address both stories with workingenv. We haven't figured it out with buildout, despite trying. And we definitely aren't satisfied with just a deployment tool that doesn't address our development needs. But there's a lot of use cases for Plone specifically where carefully developing just a deployment solution makes sense. That doesn't make sense for us, because we're not in the kind of consulting business where the relative scale of development and deployment works like that. But eh; the presence of a buildout for Plone doesn't hurt our position any. Anything that gets rid of another ad hoc crappy deployment is good by me. And if other people are working on it, all the better! If *Plone* becomes incompatible with workingenv that'd be bothersome (though it was not compatible with workingenv without some work in the first place). But if a buildout is incompatible, eh... who knows, it might even make sense to create something like a freeze this workingenv as a buildout script. That one directory structure can't be both at the same time isn't a huge problem in my mind. I'm not too fond of zc.buildout's directory scheme eiher. In particular, I wish that it would use 'lib/python' instead of 'eggs' and 'src' instead of 'develop-eggs'. I don't know enough zc.buildout details to be able to say whether that can be chagned by remimplementing the egg installation recipe. I would sure hope it is. +1 this may be all that is required to make the two play well together(or have buildout respect an existing workingenv when doing it's local install of eggs). Maybe it's just a matter of zc.buildout seeing workingenv is in effect and not composing special pythonpaths. harmony is my interest here. workingenv is pretty low-level and works hard to work well with python. there is no reason that zc.buildout should have a problem with that.. it just needs to do less when appropriate. Path names aren't really the problem. We got a little guerrilla war going on over the setuptools' script-generating monkey patches. We'd both probably prefer a proper way to change how setuptools generates scripts, but it's not clear that we could really be compatible -- enumeration vs. changing the path is a totally different strategy. I'd rather see easy-install.pth become a better package database, or some other strategy of external requirement specifications, instead of building it into scripts. I understand the issue Jim is trying to solve here, but putting everything into the buildout.cfg and then imperatively setting up the files from there bothers me and does not make development easy IMHO. That's mostly the problem. Then workingenv would do its part by monkeypatching distutils and setuptools to install things locally, and changing site.py to not automatically pick up things globally. And buildout could do its stuff that applies to other more complicated setups than just setting up some libraries, which is about where workingenv stops. Well, what I'd *really* like is an idea of a working environment that applies more widely than Python, because other languages (including but not limited to the dynamic languages) have all these same problems, and we all have half-assed solutions. But I don't even know how to start that conversation. And don't get me started on how the distributions are going to look at all this! Ian ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope
Re: [Zope-dev] Re: ploneout - Or how using zc.buildout for a common Zope2 project might look like
Jim Fulton wrote: If *Plone* becomes incompatible with workingenv that'd be bothersome I agree. But if a buildout is incompatible, eh... who knows, I would hope that buildout would not have to be compatible with workingenv, whatever that means, in order for Plone to be compatible. Then again, I'm not sure what compatibility means in this context. It would be a concern if, for instance, Plone started depending on buildout recipes for installation, without plain distutils recipes. Of course right now there are no distutils recipes for old-style Products. So actually it's an active issue -- if buildout enables Plone to keep from moving to distutils/setuptools/egg-style package deployment (because buildout is flexible enough to support the old patterns) then that would make it harder for workingenv. But I don't think anyone is proposing that buildout means that Plone (and Zope 2/Five) shouldn't continue its move towards traditional Python packaging. So basically I would just hope that Plone doesn't lean to heavily on buildout. it might even make sense to create something like a freeze this workingenv as a buildout script. That one directory structure can't be both at the same time isn't a huge problem in my mind. Deployment involves far more than getting the software installed. Yes; in a workingenv model you start with an environment, then you actually make your deployment using tools of your choice. workingenv doesn't deploy for you. Admittedly your choice isn't always good, because maybe you didn't want to make a choice ;) Path names aren't really the problem. We got a little guerrilla war going on over the setuptools' script-generating monkey patches. We'd both probably prefer a proper way to change how setuptools generates scripts, but it's not clear that we could really be compatible -- enumeration vs. changing the path is a totally different strategy. Um, we're both changing the path -- just in different ways. Maybe enumeration vs adding a directory of eggs is a better description. Setuptools controls the directory of eggs (via easy-install.pth), while buildout controls the scripts and doesn't give setuptools that control. I'd rather see easy-install.pth become a better package database, or some other strategy of external requirement specifications, instead of building it into scripts. We certainly disagree there. OTOH, I wouldn't be opposed to having a recipe for generating scripts that used the .pth files created by workingenv. I'm not sure what the problem would be? I appreciate the desire for a set of requirements that is different from the requirements of the package, and workingenv has some support for that (with the --requirements option), but it's a different style from buildout. easy-install.pth would almost be okay, except for the fact that it is constantly pointing to things that don't exist, has setuptools' hacks in it (to work around the atrocious Python standard site.py), and doesn't describe intent, it's just an enumeration of what is available and activated (i.e., available without specifically requiring something). Besides all that, it's still a workable foundation IMHO. -- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: ploneout - Or how using zc.buildout for a common Zope2 project might look like
/activate lets you into that jail, and lets you work there. There is no way into a buildout. I'm not familiar with bin/activate, but it sounds like an interpreter script created with buildout. It's created by workingenv, and you have to source it because basically its only function is to add the workingenv/lib/pythonX.Y to $PYTHONPATH. Adding that path to $PYTHONPATH is the only thing that really activates a workingenv. Frankly this weirds me out, and is a big part of my past frustration with it. Maybe that's because I'm in the relatively uncommon situation that I actually know what's going on under the hood of Python imports and packaging, and so it bothers me that I can't debug things directly. Anyway, neither requires activation when using scripts generated in the environment. And bin/activate is really just something that sets PYTHONPATH and then does other non-essential things like changing the prompt and $PATH -- I should probably document that more clearly. sounds a lot like an buildout interpreter script. Once you've changed $PYTHONPATH any Python script will notice the change. This can actually be a bit awkward if you have fully isolated the working environment, as it means a script may not see the global Python paths. But if you don't isolate the environment, the script can see the workingenv path in addition to its own. Neither can be entirely compatible with a system-wide Python installation, because Python's standard site.py f**ks up the environment really early in the process, and avoiding that isn't all that easy. This reminds me of a place where buildout is looser than workenv. buildout doesn;t try to disable anything in the system python. It just augments it. I always use a clean python, so avoiding customizations in the Python I use isn't a problem. If I wanted to take advantage of something in a system Python, as I occasionally do, I can do that with buildout. I find the isolation useful when testing things for release; I can be sure that I haven't been using any packages that I don't explicitly include in the egg requirements or instructions. But it can be annoying in other cases, like when there's a library that doesn't install cleanly (of which there's still quite a few). Anyway, if you do want to include the global packages, --site-packages will change your workingenv to do so. It could be argued that workingenv's default should be to include site-packages. Another option would be to have a tool that allows you to easily include something from the system Python (probably just a tool to manage a custom .pth file, which works even when setuptools' fairly heroic attempts to fix broken setup.py's doesn't work). -- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope] Migrating to Zope 2.10.1 breaks unrestrictedTraverse
I'm trying to get an object by walking a path. Previously, I used baseobject.unrestrictedTraverse(path). Upon migrating to 2.10.1, though, doing the same thing often produces the following error: File /usr/local/zenoss/Products/ZenModel/Organizer.py, line 148, in getOrganizer return self.getDmdRoot(self.dmdRootName).unrestrictedTraverse(path) File usr/local/zenoss/lib/python/OFS/Traversable.py, line 259, in unrestrictedTraverse AttributeError: REQUEST The problem appears to be that the Traversable mixin assumes that self.REQUEST will be available; since we're calling it from outside Zope, though, there is no request. Any thoughts? Why was this changed, and is there an extant way to get the same result without just writing a simple method that walks the path? Thanks, Ian McCracken ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope-dev] After migrate to 2.10.1 ManagableIndex throws TraversalErrors
I'm migrating the Zenoss code to Zope 2.10.1. I've moved to Five 1.5.1, CMFCore 1.6.2. Does anyone know if there's a quick fix for this problem? Traceback (most recent call last): File /usr/local/zenoss/Products/ZenEvents/zenxevent.py, line 87, in ? z = ZenXEvent() File /usr/local/zenoss/Products/ZenEvents/zenxevent.py, line 37, in __init__ EventServer.__init__(self) File /usr/local/zenoss/Products/ZenEvents/EventServer.py, line 69, in __init__ component=self.name)) File /usr/local/zenoss/Products/ZenEvents/EventServer.py, line 105, in sendEvent self.zem.sendEvent(evt) File /usr/local/zenoss/Products/ZenEvents/MySqlSendEvent.py, line 52, in sendEvent event = self.applyEventContext(event) File /usr/local/zenoss/Products/ZenEvents/MySqlSendEvent.py, line 141, in applyEventContext device = devices.findDevice(evt.device) File /usr/local/zenoss/Products/ZenModel/DeviceClass.py, line 351, in findDevice ret = self._getCatalog().evalAdvancedQuery(query) File /usr/local/zenoss/Products/AdvancedQuery/eval.py, line 40, in eval rs = _eval(query, cat) File /usr/local/zenoss/Products/AdvancedQuery/eval.py, line 16, in _eval rs = query._eval(_QueryContext(cat)) File /usr/local/zenoss/Products/AdvancedQuery/AdvancedQuery.py, line 82, in _eval return context._applyIndex(self, term) File /usr/local/zenoss/Products/AdvancedQuery/AdvancedQuery.py, line 276, in _applyIndex return _wrapLookup(cat.indexes[index].__of__(cat)._apply_index({index:spec})[0]) File /usr/local/zenoss/Products/ManagableIndex/ManagableIndex.py, line 332, in _apply_index t = prenorm(t, None) File /usr/local/zenoss/Products/ManagableIndex/ManagableIndex.py, line 570, in _prenormalizeTerm return normalizer._normalize(value, object) File /usr/local/zenoss/Products/ManagableIndex/Evaluation.py, line 132, in _normalize return evaluator._evaluate(value,object) File /usr/local/zenoss/Products/ManagableIndex/Evaluation.py, line 86, in _evaluate v= EvalAndCall.inheritedAttribute('_evaluate')(self,value,object) File /usr/local/zenoss/Products/ManagableIndex/Evaluation.py, line 58, in _evaluate return expr(context) File usr/local/zenoss/lib/python/zope/tales/expressions.py, line 217, in __call__ File usr/local/zenoss/lib/python/Products/PageTemplates/Expressions.py, line 122, in _eval File usr/local/zenoss/lib/python/zope/tales/expressions.py, line 124, in _eval File usr/local/zenoss/lib/python/Products/PageTemplates/Expressions.py, line 74, in boboAwareZopeTraverse File usr/local/zenoss/lib/python/zope/traversing/adapters.py, line 161, in traversePathElement zope.traversing.interfaces.TraversalError: ('No traversable adapter found', 'captainapollo') I've been told it may involve a rewrite of ManagableIndex to use Zope 3 adapters...any thoughts? Ian McCracken Zenoss, Inc. ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope] Zeo question
Ola, thx maciej and Jonathan...your answers have helped a lot Each zope instance can access multiple ZODB's (as Maciej mentions later), which means that the zope instance can access both a shared zodb and a local zodb which is specific to the zope instance. auaua...i didn't know that ;)...this is really cool. Now the inevitable question - 'Is there any documentation about how to set this up ?' Maybe I just define another zodb_db in my zope.conf and mount it into a folder like maciej said and just customize this folder. What i need to do is just create a custom skin on each zope instance to show that it is Manaus,Belem or wherever serving the information but have the same global content shown in each instance. From what you have said it seems this should be possible with a bit of tweaking Zope is very flexible! You just need to build a configuration which meets your use case! welcome to OSS, eh ! []'s -- Ian Lawrence http://ianlawrence.info Centre for Bioinformatics INSTITUTO NACIONAL DE PESQUISAS DA AMAZÔNIA-INPA RUA ANDRÉ ARAÚJO N º .2936 , BAIRRO DO ALEIXO MANAUS-AMAZONAS-BRAZIL Research Program in Biodiversity http://ppbio.inpa.gov.br PHONE: 055-92-3643-3358 CEP. 69011 -970 | Please do not send me documents in a closed | format.(*.doc,*.xls,*.ppt) | Use the open alternatives. (*.pdf,*.html,*.txt) http://www.gnu.org/philosophy/no-word-attachments.html return [type for type in types if type not in types_to_exclude] If you can see the beauty, then Python got you ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Zeo question
Ola, You can easily do this by changing the 'display' routines on each zope instance I feel so stupid asking but what do you mean by this...i have googled but cannot find anything about 'zope display routines' ... Do you mean this: In the zope instances I can create a folder custom and place my customizations in there.. -- so I create logo_manaus.jpg for Manaus and this goes in the folder custom on the zope instance in Manaus and then i create logo_belem.jpg for Belem in the folder custom on the zope instance in Belem...and we live happily ever after ;) -- I think my problem is that i do not really understand what is stored in the ZODB...is it just content or is it content and configuration []'s -- Ian Lawrence http://ianlawrence.info Centre for Bioinformatics INSTITUTO NACIONAL DE PESQUISAS DA AMAZÔNIA-INPA RUA ANDRÉ ARAÚJO N º .2936 , BAIRRO DO ALEIXO MANAUS-AMAZONAS-BRAZIL Research Program in Biodiversity http://ppbio.inpa.gov.br PHONE: 055-92-3643-3358 CEP. 69011 -970 | Please do not send me documents in a closed | format.(*.doc,*.xls,*.ppt) | Use the open alternatives. (*.pdf,*.html,*.txt) http://www.gnu.org/philosophy/no-word-attachments.html return [type for type in types if type not in types_to_exclude] If you can see the beauty, then Python got you ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Zeo question
Hi, Hope you can help 1. I am having trouble connecting a zope client to a zeo database.The server and client are in different goegraphical locations and behind different proxies and firewalls. I read that they communicate using a 'custom RPC protocol'...what does this mean and does it have any influence on which firewall/proxy rules we need to implement on our network?? 2. I can create a custom skin on each zope (in reality plone) instance right or is each zope instance is just a mirror of the other? thx -- Ian Lawrence http://ianlawrence.info Centre for Bioinformatics INSTITUTO NACIONAL DE PESQUISAS DA AMAZÔNIA-INPA RUA ANDRÉ ARAÚJO N º .2936 , BAIRRO DO ALEIXO MANAUS-AMAZONAS-BRAZIL Research Program in Biodiversity http://ppbio.inpa.gov.br PHONE: 055-92-3643-3358 CEP. 69011 -970 | Please do not send me documents in a closed | format.(*.doc,*.xls,*.ppt) | Use the open alternatives. (*.pdf,*.html,*.txt) http://www.gnu.org/philosophy/no-word-attachments.html return [type for type in types if type not in types_to_exclude] If you can see the beauty, then Python got you ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] Ecommerce solutions
Has anyone used Zopewith a shopping cart such as AgoraCart to create an online store? Best RegardsIan Nunn ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope-dev] Granularity of Persistent Objects
Or shall I wrap each one in a custom class that subclasses Persistent? That is usually an even better idea. And for big dictionaries, you may want to use the BTree objects for storage. So in my containing class, I just have class MyContainer( Persistent ): subObject = None def __init__( self ): self.subObject = BTree() and etc.? That's all there is to it?? Thanks, ..Ian ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Granularity of Persistent Objects
Greetings. I'm developing a Zope (2.7) product, and I've got a particular persistent object that's going to be a real bottleneck, in that there will be many threads trying to change the state of the object more or less simultaneously. I'd like to spread out the problem by taking member fields of the object (lists, dictionaries, etc.) and making them persistent sub-objects in their own right. That way, changes made to one of them can be saved to the ZODB without causing thread conflicts with changes being made to others, removing at least some of the thred conflicts. However, I don't know how to do this. Is it as simple as using a PersistentMapping where I'd normally use a standard Python dictionary? Or shall I wrap each one in a custom class that subclasses Persistent? Does my parent object have to handle these in any special way so that the ZODB knows to give them their own DB records? I've tried looking at how ObjectManager does things, and found it less than enlightening. Thanks, ..Ian Beatty University of Massachusetts Amherst ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [ZPT] Re: RFC: TALES adapters and TAL/Tales variable namespaces
Jim Fulton wrote: One disadvantage I see with the cast notation is that it's a bit jarring in: a/b/(adapter)c/d as the adapter is applied to a/b/c. The order just doesn't seem quite right. That is indeed jarring, especially since c isn't an object, it's just a name, and a/b/c is the object in question. This would look somewhat better with the current : mechanism, like a/b/c:adapter/d My concern with this use of : was that it looked like it should be parsed like (a/b/c):(adapter/d), as opposed to ((a/b/c):adapter)/d -- maybe using something other than : wouldn't imply this grouping. Or maybe if I got used to it the grouping would seem more natural. I guess my intuition is that / binds more closely than : (even if there isn't any real precedence at all in TAL expressions). -- Ian Bicking / [EMAIL PROTECTED] / http://blog.ianbicking.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [ZPT] RFC: TALES adapters and TAL/Tales variable namespaces
Jim Fulton wrote: I've posted two proposals: http://dev.zope.org/Zope3/TALESPathExpressionAdapters Not much opinion. Though I fear that (adapter)object could lead to this syntax in Python itself, which would be horrid ;) I agree that adapter(object) is a bad direction. object*adapter looks fine to me, and it seems reasonable that only a specific set of adapters would be available in TAL expressions (i.e., adapters which provide ITALESAdapter). Proposes a mechanism for easily using adapters in TALES expressions. http://dev.zope.org/Zope3/ZPTVariableNamespaces proposes a mechanism for qualifying names defined in TAL and used in TALES expressions. I'm suspicious of namespaces, as they seem redundant. Namespaces in Python, after all, are expressed like any other attribute traversal (e.g., os.path.exists). The analog in TAL would be adapter/foo. This is how TAL works right now in practice, with a small number of namespaces like request, container, etc. I see a few problems with the current situation: 1. There's no clear way to indicate that you want to use a name as a namespace, as opposed to a normal name. So there may be a conflict between the adapter you want to use as a namespace, and a template that someone writes that happens to use the variable adapter in an unrelated way. This is fine now, because there is a fairly fixed number of namespaces (six or seven, I think), and you just don't use those names -- as namespaces are added (especially on a per-metal-template basis) this conflict is more likely, and you may not know what names will cause conflicts in the future. But I'm not sure how bad the name conflict really is. In my experience it's not too bad in Python code, and when it's a problem it's fairly easily resolved. Or maybe another one or two namespaces can be added which would sufficient, and we don't need to extend the number of namespaces indefinitely. Like an adapter namespace and a metal namespace (maybe you'd use things like metal/name_of_template.pt/variable_name). To some degree this could even be convention, instead of building it in explicitly. 2. Another issue might be the difficulty of creating a namespace for use with templates -- with the proposal all namespaces start out empty and ready to accept new values, but if you use normal variables they start out as undefined, and you'd have to assign them to {} or something. (A little thought: if you had def namespace(): return {}, then tal:define=adapter namespace would work and reads fairly well) 3. Explicit namespaces support deeper, structured assignment (but only a *little* deeper). Does TAL currently allow tal:define=var/attr something? I've never tried it. It should. Maybe the specific semantics of this assignment could be refined to resolve (2) -- e.g., if you get a LookupError during the second-to-last segment of the traversal, try to assign it to {}. Anyway, whenever I look at a language with explicit namespaces (e.g., Ruby), it seems really pointless. I think they should be avoided, and that normal TAL path expressions can be refined instead. It's also annoying that we'd have namespace['adapter'] in Python expressions. Namespaces might be a way to introduce a more accessible set of typical functions, like DTML's nl2br and other formatting functions -- these are currently too hard to get to. But these have to be used with Python syntax (at least currently), and doing namespace['formatters']['nl2br'](options['message']) is just bad. I don't much care for tal:define=nl2br formatters:nl2br either, as it feels like boilerplate. I suppose path('formatters:nl2br')(path('options/message')) is maybe a little better, but only a very little. -- Ian Bicking / [EMAIL PROTECTED] / http://blog.ianbicking.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] ZODB for Java?
Greetings. Does anyone know of a good (stable, reliable, fast enough for production use in a web app) ZODB-equivalent for persisting Java objects? Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Researchvoice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-9337 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Threads, Locks, Volatility, and Angst
Greetings. I'm looking for a little wisdom -- specifically, about thread locks and Zope. I'm developing a Python-based product. One of the classes needs to hand out unique IDs to clients as they connect for the first time. I generate these by keeping an index integer in the instance that starts at zero, incrementing it by one for every new client, and using the new value for the unique ID. In order to prevent race conditions when two clients connect almost simultaneously, I have another instance variable in my class that holds a threading.lock(). I call acquire() on that lock just before the increment-and-report code, and release() just after. So far so good. That seemed to work just fine yesterday when I coded it. Then I shut down Zope overnight and started it up again today. Now, I cannot create a new instance of the class without getting the Zope error UnpickleableError: Cannot pickle type 'thread.lock' objects. (I'd swear it was working yesterday, though.) I thought Okay, no problem. I'll just make the lock variable volatile, since I don't really care whether it persists when Zope shuts down. So I renamed the lock to begin with '_v_'. That solves my UnpickleableError problem nicely. Unfortunately, it introduces a different problem: the code that calls acquire() on the lock now throws AttributeError: 'NoneType' object has no attribute 'acquire'. I'm sure I initialize that variable to a threading.Lock() in the object's __init__ method. So now I'm worried that Zope is doing all kinds of pickling-unpickling activity behind the scenes, and anything I have that's volatile can disappear without warning. Are there any thread-wise Zopistas out there who can steer me right? Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Product Access to Files
On 2004-03-11 7:04 AM, Chris Withers is reputed to have said: I'm overriding '__getitem__' and using Python's os package to directly access the local file system. I just sniff the file name extension and set the response content-type, then return the contents of the named file. Simple and stupid. Ooo... I hope you're confident in what you're doing :-S Not in the least! =8-0 I've never mucked around this deep within Zope before. What's the danger... threading issues? Should be vaguely okay, provided you're not writing to those files with the os module. No writing, only reading. Mindyou, Apache could serve 'em a LOT faster... It's a whole lot easier to have those files nicely packaged inside my product, so that all someone needs to do is install the product and be done with it. No separate directory of files to put somewhere, no Apache configuration to do, no URL issues. I'm wide open to suggestions for a better way to do this! (If anyone's curious, I'm using a Zope product for a back-end to a Mozilla/XUL front-end. This static file stuff allows the product to provide the XUL, JavaScript, and CSS files needed to define the Mozilla-based interface.) Cool :-) I think so! ;-P In the long run, I may set up the XUL/etc. to be installed into the user's Mozilla Chrome, and then it would be permanently resident. So it would only be downloaded once per user, which makes efficiency less important and Apache (hopefully) unnecessary. Cheers, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Product Access to Files
On 2004-03-10 10:14 AM, Chris Withers is reputed to have said: Ian Beatty wrote: I've been messing around with DTMLFile and ClassicHTMLFile and the like, haven't been able to figure out how to get it to work for arbitrary paths. They also require all my file names end in '.dtml', which is quite a pain. Any suggestions? Local FS? What Sandor said? Apache and rewrite rules? I'm overriding '__getitem__' and using Python's os package to directly access the local file system. I just sniff the file name extension and set the response content-type, then return the contents of the named file. Simple and stupid. I actually delegate the file-serving to a helper class, and use recursion to handle arbitrary-length paths for arbitrary-depth file system hierarchies. Simple, stupid, and inelegant, but it seems to work. FileSystemSite seemed geared towards providing ZMI access to static files. I just want my product to be able to dish out preset files that are part of the product. (If anyone's curious, I'm using a Zope product for a back-end to a Mozilla/XUL front-end. This static file stuff allows the product to provide the XUL, JavaScript, and CSS files needed to define the Mozilla-based interface.) Thanks for all the suggestions. Cheers, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Product Access to Files
Greetings. I'm developing a Python-based product that needs to serve up a variety of XML files out of the product's directory. That is, certain URLs handled by instances of a product-defined type need to return an XML file that's on disk along with the product's DTML views and the like. Let's say that the URL http://localhost/foo/bar resolves to an object my product class defines. Then I'd like http://localhst/foo/bar/static/a to serve a file named 'a' in a directory named 'xml_files' in my product's directory. Similarly, http://localhst/foo/bar/static/b/c should serve a file named 'c' within a directory named 'b' within 'xml_files' in my product's directory. I'd rather not hard-code every single file in the Python module, since there will be many, and they'll be changing a lot during development. I've been messing around with DTMLFile and ClassicHTMLFile and the like, haven't been able to figure out how to get it to work for arbitrary paths. They also require all my file names end in '.dtml', which is quite a pain. Any suggestions? Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Product directory?
Greetings again. This has to be an easy one. From within my Python-based product's code, how do I get access to the product's directory on the filesystem? os.getcwd() seems to provide the working directory of the shell used to launch Zope, at least when running in debug mode. I've tried ferreting it out from the source to DTMLFile and etc., but I can't trace it. Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Catching extra path
Hi again. I'm chipping away at the problem I asked about earlier (Product Access to Files) -- or perhaps just beating my head against it -- and I've got another question. If I'm writing a Python script within the ZMI, any URL that resolves to my script will invoke the script, even if the URL has extra stuff appended: http://host/folder/script/a/b/c will invoke a script at /folder/script. Furthermore, I can get at the a/b/c part from within the script by accessing 'traverse_subpath'. The question is, how can I do this from within a Python-based product? Calling http://host/folder/object/method/a/b/c fails to invoke the method 'method' on my custom object 'object'. Instead, I get a Cannot locate object page. It's hard to believe there's something I can do with a ZMI Python script that I can't do in a Python product... Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Re: Custom class: cut,copy,rename?
On 2004-03-02 2:15 PM, Ian Beatty is reputed to have said: Here's what I have now: a hierarchy of five custom classes, pretty close to identical for now. All five subclass ObjectManager, CatalogAware, PropertyManager, and SimpleItem in that order. The top one (A) may be added to any old Zope folder; B may only be added to A; C to B; D to C; and E to D. Standard Zope Images may be added to E. I can now freely rename A, C, D, and any images within an instance of E. I *cannot* rename B or E; when I try, I get The object term_0 does not support this operation ('term_0' is an instance of B) On 2004-03-02 9:55 AM, Chris Withers is reputed to have said: I suspect the way you're trying to ensure only certain types of object can go in certain containers is to blame here... Aah, finally, I figured it out. So simple. You were right, Chris. For the problem classes, B and E, the meta_type value defined in the class definition wasn't exactly the same as the type name specified in the container class' all_meta_types' field. *Sigh* And I thought that value in all_meta_types was simply to provide the visual label in the combo box. Thanks for the help, folks. I definitely needed it. Cheers, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Schizophrenic ObjectManager?
Greetings. I'd like to create a type in a Python-based product that's kind of like two folders fused together. What I mean by that is I've got a folderish object type -- let's call it 'F' -- that inherits from ObjectManager. I've set it up so that it can contain objects of type 'A' and nothing else, by using the all_meta_types property. So far so good. Now, I want to have it also contain objects of type 'B', but displayed and managed through a separate tab in the ZMI. If I click on the Contents tab of an instance of F, I get the list of contained A-type objects, with cut, copy, paste, delete, etc. If I click on another tab named, say, OtherStuff, I want to see exactly the same kind of contents-list management page, but for contained B-type objects. I'm thinking that I might try having F contain an instance of ObjectManager as a property, and delegate all B-managing functionality to that. Management of A would be handled through F's inherited ObjectManager behavior. What concerns me is that the encapsulated second ObjectManager wouldn't have a container in the usual way, and that could seriously mess up acquisition. Another possibility is to maintain only one collection, but to create the illusion of two separate collections by having two copies of the contents ('manage_main') page, each modified to display only one kind of child. Any thoughts, oh masters of Zope Zen? Cheers, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Custom class: cut,copy,rename?
On 2004-03-01 7:21 PM, Max M is reputed to have said: So if SimpleItem is before ObjectManager the traversal order of the parent objects will make shure that you get the wrong methods :-( So this will *not* work... Aha... that explains a lot of my irreproducible behavior. After correcting the order of inheritance, *most* of the bizarre behavior is gone. But not all. Here's what I have now: a hierarchy of five custom classes, pretty close to identical for now. All five subclass ObjectManager, CatalogAware, PropertyManager, and SimpleItem in that order. The top one (A) may be added to any old Zope folder; B may only be added to A; C to B; D to C; and E to D. Standard Zope Images may be added to E. I can now freely rename A, C, D, and any images within an instance of E. I *cannot* rename B or E; when I try, I get The object term_0 does not support this operation ('term_0' is an instance of B), with the following traceback: Traceback (innermost last): Module ZPublisher.Publish, line 100, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.CopySupport, line 230, in manage_renameObjects Module OFS.CopySupport, line 247, in manage_renameObject Module OFS.CopySupport, line 393, in _verifyObjectPaste Copy Error: HTML HEAD TITLENot Supported/TITLE /HEAD BODY BGCOLOR=#FF FORM ACTION=manage_main METHOD=GET TABLE BORDER=0 WIDTH=100% CELLPADDING=10 TR TD VALIGN=TOP BR CENTERBFONT SIZE=+6 COLOR=#77003B!/FONT/B/CENTER /TD TD VALIGN=TOP BRBR CENTER The object EMterm_0/EM does not support this operation. /CENTER /TD /TR TR TD VALIGN=TOP /TD TD VALIGN=TOP CENTER INPUT TYPE=SUBMIT VALUE= Ok /CENTER /TD /TR /TABLE /FORM /BODY/HTML I've scrutinized all five classes, and I can't figure out what makes B and E different from the rest. On 2004-03-02 9:55 AM, Chris Withers is reputed to have said: I'll talk about the top 3. I've got things set up so that I can create instances of A within my Zope root (or any other normal Zope folder), I can create instances of B and only B within A, and I can create instances of C and only C within B. How have you tried to make that happen? My __init.py__ file registers all five classes, but all except the top one (A) have the line 'container_filter = containerFilter_makePrivate,' where 'containerFilter_makePrivate' is a trivial method that returns zero. In other words, classes B through E reject all containers. Then each of the classes declares all_meta_types for the classes it is supposed to contain, like this (from A): all_meta_types = ( { 'name':'Type B', 'action':'manage_addProduct/MyProduct/manage_BAddForm' }, ) Since explicitly calling the constructors avoids the container_filter, this has the effect that I want. I presume you mean for cut, paste, rename, etc. If I remove PropertyManager, my 'Properties' ZMI tab disappears. That's odd, I could have sworn ObjectManager used that. Hmmm, maybe use Folder instead of ObjectManager ;-) I've been tempted to subclass Folder instead, but I'm not sure what other undesired functionality I might unwittingly inherit. The HTML would be handy ;-) Okay, see the traceback above in my response to Max M. What version of ZOpe are you using? Zope 2.7.0 rc2, which claims to be (unreleased version, python 2.3.3, darwin) in the ZMI. I suspect the way you're trying to ensure only certain types of object can go in certain containers is to blame here... I tried removing all the container_filter statements from the registration code in __init.py__, so that all classes are addable to any Zope folder. I still can't rename an instance of B that's inside A, but if I add a B to the ZMI root folder, I **can** rename it there! Same with E. So the class isn't intrinsically un-renamable; it's either a function of how it was added, or of the container. I still can't get my head around why the problem only occurs for B and E. Thanks for the thoughts. Is there a better or more standard way to create a folderish object that can only contain a specific set of other object types, other than using all_meta_types? Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts
[Zope-dev] Custom class: cut,copy,rename?
Greetings. I've created a package in Python with some basic classes. They work in the ZMI, except for the fact that the ZMI paste and rename functionality fails with the message The object xxx does not support this operation. I've dug into the source code for standard types ('OFS.Folder', 'OFS.SimpleItem', etc.) and discovered some tantalizing bits (such as 'manage_renameObject' in 'OFS.CopySupport'), but I can't figure out how to put it together to make my classes renameable and pasteable. I'm rather surprised that behavior doesn't come automatically when inheriting from the standard base classes. One of my folderish classes subclasses the following bases: OFS.ObjectManager.ObjectManager Products.ZCatalog.CatalogPathAwareness.CatalogAware OFS.PropertyManager.PropertyManager OFS.SimpleItem.SimpleItem Am I not inheriting from the proper set of base classes? Is there an easier way? According to the ZDG (2.4 edition, vs. my Zope 2.7), OFS.SimpleItem.Item (subclassed by OFS.SimpleItem.SimpleItem) is supposed to provide cut-and-paste functionality. So, how might I be breaking it? Bewildered, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: Custom class: cut,copy,rename?
On 2004-03-01 3:44 PM, Chris Withers is reputed to have said: Ian Beatty wrote: OFS.ObjectManager.ObjectManager Products.ZCatalog.CatalogPathAwareness.CatalogAware OFS.PropertyManager.PropertyManager OFS.SimpleItem.SimpleItem I'm pretty sure all you should actually need is: OFS.ObjectManager.ObjectManager Products.ZCatalog.CatalogPathAwareness.CatalogAware I presume you mean for cut, paste, rename, etc. If I remove PropertyManager, my 'Properties' ZMI tab disappears. I'm not quite sure what SimpleItem provides for me, but it's in the examples I'm trying to work from. OFS.SimpleItem.Item (subclassed by OFS.SimpleItem.SimpleItem) is supposed to provide cut-and-paste functionality. So, how might I be breaking it? Show us some error messages, exceptions, types ,values and tracebacks adn amaybe we can help ;-) Okay. This is bizarre. I've got a containment hierarchy of several classes; I'll talk about the top 3. I've got things set up so that I can create instances of A within my Zope root (or any other normal Zope folder), I can create instances of B and only B within A, and I can create instances of C and only C within B. When I try to rename an instance of A, the ZMI gives me the standard rename-object form; but when I type in a new ID and click 'OK', I get a ZMI page with a red exclamation mark, an 'OK' button, and nothing else except the word '_notifyOfCopyTo'. The error log shows a Copy Error with the following traceback: Traceback (innermost last): Module ZPublisher.Publish, line 100, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.CopySupport, line 230, in manage_renameObjects Module OFS.CopySupport, line 252, in manage_renameObject Copy Error: [html snipped] Now, If I view the ZMI for A, select a contained item of type B, and try to rename it, it fails but with a different signature: the notification page says 'The object term_0 does not support this operation' instead of '_notifyOfCopyTo'. (term_0 is the ID of the B instance.) The error log shows a Copy Error with this traceback: Traceback (innermost last): Module ZPublisher.Publish, line 100, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.CopySupport, line 230, in manage_renameObjects Module OFS.CopySupport, line 247, in manage_renameObject Module OFS.CopySupport, line 393, in _verifyObjectPaste Copy Error: [html snipped] Attempting to rename an instance of C within B fails in the same way as renaming A (i.e., with a '_notifyOfCopyTo'). I've currently got A subclassing ObjectManager, CatalogAware, and PropertyManager; B subclassing the same plus SimpleItem (just as an experiment); and C subclassing the same as A. If I remove SimpleItem from B's list of superclasses, I still get the same set of errors, *except* when attempting to rename C. Now, I instead get the failure message 'You do not possess the permission required to call manage_addProduct/KBProduct/manage_KBCourseAddForm in the context of the container into which you are pasting, thus you are not able to perform this operation.' The Error Log traceback is: Traceback (innermost last): Module ZPublisher.Publish, line 100, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 40, in call_object Module OFS.CopySupport, line 230, in manage_renameObjects Module OFS.CopySupport, line 247, in manage_renameObject Module OFS.CopySupport, line 378, in _verifyObjectPaste Copy Error: [html snipped] I'm completely bewildered here. Any suggestions would be tremendously appreciated. By the way, if this isn't the appropriate venue for this kind of question, please point me in the right direction. This list seems to focus on Zope's internals, but the Zope Users list seems a bit low-level for Python-based product development. Thanks, ..Ian -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- Dr. Ian Beatty [EMAIL PROTECTED] Physics Education Research Group voice: 413.545.9483 Department of Physics fax: 413.545.4884 Univ. of Massachusetts AIM: (available upon request) Amherst, MA 01003-4525 USA http://umperg.physics.umass.edu/ -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- --- -- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
[Zope-dev] Making a custom class addable to another class in product, but not to Zope
Greetings. I'm relatively new to Python-based development of Zope products. I've got two classes in my product; let's call them Container and Thing. I want to have Container addable to any old folder in the ZMI; that's no problem, I just register it in my product's __init__.py file. I want Container to allow instances of Thing to be added to it, and nothing else; that's also no problem, using all_meta_types. However, I want Thing to be addable to Container, but not to any other ObjectManager-based object. I can't figure that one out. I assumed I could do it by having an entry for Thing in Container's all_meta_types property, and by *not* registering it in __init__.py. Unfortunately, that fails. If I click on the Add Thing button in the ZMI when viewing the content of a Container, I get Cannot locate object at http://localhost:8080/kb0/manage_addProduct/ [ignore line break] MyProduct/manage_addThingForm If I register Thing in __init__.py, then the Add Thing button works perfectly, but I can add a Thing to any folder in the ZMI. It looks like the registration process is necessary to get manage_addThingForm added to whatever registry of constructors manage_addProduct['MyProduct'] accesses. Is there a way around this? I'd think what I'm trying to do is pretty standard, but I can't find anything enlightening. Thanks, ..Ian ___ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Structured Text Plus
Michel Pelletier wrote: As I understand things from reading the STXNG Wiki stuff, it's largely an internal rewrite which adds 2 or 3 new features, namely images and tables. This is only a small feature compared to what STXNG really adds to structured text. STXNG turns structured text into cross-format Document Object Model (DOM) in two stages and then into a final format. The first stage turns it into a simple DOM that reflects the paragraph structure, but not the markup (italics, bold, links, etc.). Yes, the new processing architecture is great and I fully intend to leverage it as much as possible. I'm not sure if I'll need to make some additional changes to the core classes as well? If I do, I don't expect them to be large. Ian C. -- This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this e-mail are the opinion of the writer only and are not endorsed by Mincom Limited unless expressly stated otherwise. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Structured Text Plus
Andreas Jung wrote: - Original Message - From: Ian Clatworthy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 10, 2001 9:52 PM Subject: [Zope-dev] Structured Text Plus I've put together the design for an extended version of Structured Text which I'd like some feedback on before I go too much further. At this stage, the design is explained via a series of user-level How-To's, e.g. Writing Documents Using Structured Text Plus. Could you please summarize the benefits compared to STXNG ? As I understand things from reading the STXNG Wiki stuff, it's largely an internal rewrite which adds 2 or 3 new features, namely images and tables. STXPlus is a lot more ambitious than that wrt new features, i.e. * there are 3 levels of features above'Classic', namely Topic, Document and Book * each level adds half a dozen new features. You are targeting also the single-source approach for documents with STPlus - what are the benefits compared to working solution like Docbook ? Upwards compatibility with STX, i.e. something more readable than XML. Ian C. -- This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this e-mail are the opinion of the writer only and are not endorsed by Mincom Limited unless expressly stated otherwise. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Structured Text Plus
I've put together the design for an extended version of Structured Text which I'd like some feedback on before I go too much further. At this stage, the design is explained via a series of user-level How-To's, e.g. Writing Documents Using Structured Text Plus. The home page is: http://www.zope.org/Members/ianc/StructuredTextPlus/home Ian C. -- This transmission is for the intended addressee only and is confidential information. If you have received this transmission in error, please delete it and notify the sender. The contents of this e-mail are the opinion of the writer only and are not endorsed by Mincom Limited unless expressly stated otherwise. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] ZPatterns: commitSubtransaction() gives AttributeError on commit_sub
Dear Brian, req = context.REQUEST context.propertysheets.info.manage_changeProperties(longdesc=req.f orm['longdesc']) context.commitSubtransaction() req.RESPONSE.redirect(req['URL1']+'/edit_longdescForm') context is a DataSkin instance. When I submit the form, I get an Attribute Error on commit_sub (traceback below in case it helps anyone). As far as I can see from the ZPattern's source, I'm making the call correctly and it is an appropriate call. Any clues? This is Zope 2.3.1b1 and Steve's convenience release of ZPatterns. --RDM Traceback: AttributeError: (see above) I believe we've tracked this down and fixed it properly - the fix will be in 2.3.1 b2, but I've a attached a copy of the updated Transaction.py that you can drop into lib/python/ZODB, then restart. It would be great if you get a chance to confirm the fix and let me know how it goes... Note I've cc'ed a few other folks who have run into this specific problem - if any of you can spare a few moments to verify the fix and let me know if you still see any problems, I'd really appreciate it. That sorted everything for me. Thanks very much. Just for info, I'm still using Zope 2.2.5 and just dropping the updated Transaction.py into that worked fine. Thanks again. Cheers, Ian ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope] default page is zope_quick_start! - Zope 2.3 release for windows
A little problem I'm having with the new Zope 2.3 - Windows version. I edited index_html and it works fine if I enter http://host.com/index_html but if I enter http://host.com it gives me the quick start page zope_quick_start! Does anybody know off hand where this page is stored so I can edit it directly? A workaround until 2.3.1 is released. or better where to fix this in the code! Ian Thomas ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Recall: default page is zope_quick_start! - Zope 2.3 release for windows
Ian Thomas would like to recall the message, "default page is zope_quick_start! - Zope 2.3 release for windows". ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] BUG: subtransaction not handled correctly in manage_addFile
Dear all, Does anyone fancy earning a bit of pocket money? I've got a Zope problem that I can't solve because my Python isn't good enough and my understanding of the ZODB is pretty much still zero. We've got a simple Zope application that allows users to upload files without going near the Zope management screens. For more information on this and what the problem is, see: http://www.egroups.com/message/zope/48084 The basic thrust is that when a large file is uploaded and subtransactions are needed, something goes wrong. Dieter Maurer sent a reply helpful reply (thanks Dieter) that's archived at: http://www.egroups.com/message/zope/48116 In it, he said: On the other hand, the bug is triggered by something. I would expect, it is an exception in "ZODB.Transaction:261", AttributeError "commit_sub". You can verify this, if you put an "import traceback; traceback.print_exc()" below line 270. Problably some non-subtransaction object managed to enter in "subjars". Sure enough, Dieter was right. I get: Traceback (innermost last): File "/usr/local/zope/lib/python/ZODB/Transaction.py", line 261, in commit j.commit_sub(self) AttributeError: commit_sub Dieter told me to file a bug report (and he's told a couple of other people the same thing since) but I haven't yet because I'm having trouble replicating the problem. I can't replicate it by just copying the two salient methods to a fresh Zope installation of Zope 2.2.5. Other messages (e.g. http://www.egroups.com/message/zope/48492 ) made me suspect that it was a problem with a Product, but installing the Products I'm using (SiteAccess, ZOracleDA, ZPyGreSQLDA and smbUserFolder) to this fresh installation didn't replicate the bug. I only see it if I copy over the Data.fs from the original installation. Other people seem to have come across the same problem in different contexts. Have a look at: http://groups.yahoo.com/group/zope/messagesearch?query=commit_sub We need to get this fixed ASAP so my boss has told me to send this message to the list and offer 400 pounds (sterling) to anyone who can fix this bug. Any takers? Cheers, Ian ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] BUG: subtransaction not handled correctly in manage_addFile
Dear Chris, We need to get this fixed ASAP so my boss has told me to send this message to the list and offer 400 pounds (sterling) to anyone who can fix this bug. Any takers? What version of Zope are you using? 2.2.5 on Red Hat 6.2. Zope version: Zope 2.2.5 (source release, python 1.5.2, linux2) Python version: 1.5.2 (#1, Nov 18 2000, 20:03:24) [GCC egcs-2.91.66 19990314/Linux (egcs- System Platform: linux2 Cheers, Ian ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Zope digest, Vol 1 #1150 - 54 msgs
8 ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Zope digest, Vol 1 #1151 - 61 msgs
8 ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Adding to an XMLDocument through web forms
Hi, I`m looking for a way to give a user the ability to add new data to an XMLDocument through web forms, does anyone have experience of this or would be able to point me in the direction of an example or howto? I have a file similar to: channel event ... /event announcement ... /announcement /channel So i`d have two web forms, one to add a new event and another to add an announcement, taking the data from a form is obviously simple but adding this to my XMLDocument has stumped me. Any help would be appreciated. Ian ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Unexplained Slowdown
When I upgraded to Zope 2.2.5 access to my Zope over the web slowed down dramatically and I haven't been able to figure out why. I am interested in ideas I can try to track it down the problem or at least quantify/benchmark the slowness. Some background. 1) I am a computer teacher teaching Zope to my second year web development students who have already learned HTML and been introduced to JavaScript. 2) The server is a my test machine that my students and I use for learning. 3) The "production" server still running 2.2.4 continues to preform normally. 4) The machine is Celeron 500 mhz 64 meg ram running Windows 2000 Server 5) I run Medusa server that comes with Zope to server the web pages. 6) There is no gateway set up on this machine so that it is only visible from within the school. Notes. 1) It is much faster if I access via localhost on the server. What I have tried. 1) Installing 2.2.4 on another port. It ran just as slow. 2) Today I removed the 2.2.4 installation and installed 2.3beta, again it seems just as slow. What Next? The next thing I was thinking was to serve the webpages from IIS using PCGI. I am interested in other ideas. I. Thomas ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Re: manage_addFile problem
Dear all, I sent the following message to the list just before Christmas, but didn't get any replies. I've tried changing the admin_addfiles method to: dtml-call expr="manage_addFile(filename, file='', title=filetitle)" dtml-let newfile="_.getitem(filename)" dtml-call expr="newfile.manage_upload(file)" dtml-call expr="newfile.manage_addProperty('author', fileauthor, 'string')" dtml-call expr="newfile.manage_addProperty('maintainer', filemaintainer, 'string')" dtml-call expr="newfile.manage_addProperty('description', filedescription, 'string')" but I still get the same error. Has anyone got any advice? I can't see how this is different from adding a file using the management screens. I've got a really simple little Zope application that allows staff here to upload documents into a folder of their choice without seeing the Zope management screens. There's a form that looks like this: form action="admin_addfiles" method="POST" enctype="multipart/form-data" input type="file" name="file" size="40" etc... The admin_addfiles method then actually creates the file and applies some properties to it (that also come from the form): dtml-call expr="manage_addFile(filename, file=file, title=filetitle)" dtml-let newfile="_.getitem(filename)" dtml-call expr="newfile.manage_addProperty('author', fileauthor, 'string')" dtml-call expr="newfile.manage_addProperty('maintainer', filemaintainer, 'string')" dtml-call expr="newfile.manage_addProperty('description', filedescription, 'string')" /dtml-let It all works fine until I try to upload a file that's greater than about 128 kb. When I try that I get the following error: Error Type: AttributeError Error Value: abort_sub Traceback (innermost last): File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/zope/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: Traversable) File /usr/local/zope/lib/python/ZPublisher/Publish.py, line 175, in publish File /usr/local/zope/lib/python/Zope/__init__.py, line 235, in commit File /usr/local/zope/lib/python/ZODB/Transaction.py, line 290, in commit AttributeError: (see above) I don't see this if I add a similar-sized file using the Zope management screens. Anyone done anything similar and seen this? Cheers, Ian ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Logfile analyzer
On Tue, Aug 29, 2000 at 03:36:25PM -0700, Kapil Thangavelu wrote: Anyway, I've been thinking of polishing and expanding what I've written some, so it's suitable for public use (or at least use by people who know Zope/Python fairly well). But this requires work that I probably wouldn't do for myself -- so I'm writing to see if there are enough people who have interest in this to make it worth it. [Or if this already exists and I just haven't found it] zope's logs are in a pretty standard format so most of your loganalyzers should handle them well and several of them can be customized to ignore certain ips or urls. Of course. I'm actually parsing Apache logs on my own site, as this covers both the Zope and non-Zope portions of my page. The basic analysis isn't Zope-specific, just more Zope-accessible. For instance, hits are returned as a list of page/count pairs, and then you can format then as you wish with DTML. Any of these things that I've done could be done by other log analyzers, and I expect they have been. They could probably be done better: the real advantage of what I'm doing (in my own experience) is that I have a fair amount of control to do whatever I want, not just what was included in the software. Anyone who knows some Python would be able to have a similar amount of control. i've been told that http://www.webalizer.org/ is pretty nice. a zope web logs analyzer that makes images with PIL integrated into the control panel, is on my list of things to do although its pretty low at the moment. I hadn't been thinking of using PIL myself -- though it would be relatively easy, I suppose, to add another layer that creates graphs from the (relatively) raw data. -- Ian ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] The tree tag, SQL and what should be simple
"Rik Hoekstra" [EMAIL PROTECTED] writes: Unless I do not quite understand you I think you missed Anthony Baxter's tree_and_sql howto (http://www.zope.org/Members/anthony/tree-coding-tricks ). It will probably give you either exactly what you want or enough ideas to get you further. Hi Yes, I looked over that document and unfortunately it doesn't help me. It talks about a *one* file structure where each item in a file can be related to another item. I'm looking at a simple two file structure of records and categories and being able to display those categories in a shallow, two level tree. I've given up for the moment and written my display screen in a way which probably makes more sense but I'd still be interested to know for the future how it works Cheers Ian ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Logfile analyzer
I've been making some log analysis code on my site, and have realized that a lot of other analyzers aren't that great -- or, at least, that it's nice to have the control that editting the actual code can give. (for instance, I ignore all requests that come from my ISP, since I don't need to know what my surfing habits are; I ignore all pages that end in "manage.*"; etc.) Anyway, I've been thinking of polishing and expanding what I've written some, so it's suitable for public use (or at least use by people who know Zope/Python fairly well). But this requires work that I probably wouldn't do for myself -- so I'm writing to see if there are enough people who have interest in this to make it worth it. [Or if this already exists and I just haven't found it] Cheers, Ian ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Case sensitivity
One of my pet peeves with web servers is that : mysite.com/Members is different to : mysite.com/members (but there is no difference between MYSITE.COM and mysite.com) is there any way of making Zope case-insensitive? - Ian Sparks. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Comfirming Hotfix is installed.
Is there any way to confirm that the hotfix has been installed? I extracted the files and restarted Zope but it would be nice if there was a way to confirm that it is installed. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Traversable DTML methods
The one reason that may still exist for not making DTML Methods traversable as you're suggesting would be if you want to call a DTML Method within the acquisition context of another... something that some people may want to do (I never have though). If a DTML Method chops off everything that follows in the URL, then that remaining part of the URL can't be used for acquiring other methods. I don't see DTML Methods as "chopping off" the URL so much as "consuming" parts of it. SQL Methods have this behaviour now : www.mysite.com/flavor/cherry/showme Where "flavor" is a SQL Method which takes a single parameter "cherry" and "showme" is a DTML Document which makes some use of the flavor SQL Method. In this instance "flavor" consumes the next part of the url because it is looking for a parameter and when it is finished hands on control to the next, unconsumed part of the URL "showme". Notice though that I have to have the "showme" DTML Method to actually display the results. If "flavor" was a parmeterized DTML Method my URL could become : www.mysite.com/flavor/cherry which makes more sense to me. In this case the "flavor" DTML Method would consume the "cherry" parameter, perhaps call some SQL Method to get the data for the "cherry" display and then display itself. If the parameters could have defaults then I could have URL's like : www.mysite.com/members/ian/ www.mysite.com/members/ian/home www.mysite.com/members/ian/preferences www.mysite.com/members/ian/todo Where "members" is a DTML method which takes parameters username,subsite (default : "home") and decides what to display based on the parameters passed. This allows my "users" to become virtual (by which I mean DB-based). I can do the last 3 URL's now with SQL Methods ("home", "preferences" and "todo" become DTML documents or methods which are aquired) but I can't do the first URL because SQLMethods don't do any rendering for display. Well, that got rambling but it lays my argument out in full I think. - Ian. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Traversable DTML methods
Kevin Said : Hmm... what does it mean, exactly, to "traverse a DTML method"? DTML Methods don't have subobjects, so it seems like you're basically trying to look up other objects or information via information passed in the URL. That seems like the kind of program logic that is much cleaner in python and that people are trying to keep out of DTML. DTML really does start getting ugly and hairy when you try to put complex logic in it. Dieter Said : Your DTML Methods have (keyword) parameters. From DTML: "method(_.None,_,param1=value1, param2=value2, )" From HTML: "URL to method?param1=value1param2=value2" everything after "?" is URL(plus)encoded. Dieter is right, DTML methods can get parameters from the URL but they don't do it in the same way as SQLMethods and that, to answer Kevins question, is what I mean by making DTML Methods "traversable" (apologies if my terminology is off). I'd like to be able to pass a parameter to a "members" DTML method with a syntax like : www.mysite.com/members/ian which is much nicer than : www.mysite.com/members?user=ian which is what Dieter suggests. From my Zope-newbie perspective I don't see that allowing parameters to DTMLMethods, framed as part of the URL is any more complex than what goes on with SQLMethods but I admit this may be because I have not grasped the Zen of Zope. - Ian Sparks. - Original Message - From: "Dieter Maurer" [EMAIL PROTECTED] To: "Ian Sparks" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, June 11, 2000 7:03 PM Subject: Re: [Zope] Traversable DTML methods Ian Sparks writes: It seems strange to me that SQLMethods are traversable out of the box and "normal" DTML methods are not. It seems to me that traversable DTML methods would be useful (to me this means DTML Methods with parameters). Your DTML Methods have (keyword) parameters. From DTML: "method(_.None,_,param1=value1, param2=value2, )" From HTML: "URL to method?param1=value1param2=value2" everything after "?" is URL(plus)encoded. Dieter ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Traversable DTML methods
It seems strange to me that SQLMethods are traversable out of the box and "normal" DTML methods are not. It seems to me that traversable DTML methods would be useful (to me this means DTML Methods with parameters). Is this something that might make it into Zope in the future or am I missing something important which means that they simply arn't necessary? - Ian Sparks. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How do you call the string?
Martin, I'm no Zope expert but if you have a property with an ID of "prop1" of type string with a value "first_value" set on a DTML Document then inside the document you can say : dtml-var prop1 and "first_value" will be substituted into your code at this point, replacing the "dtml-var prop1" declaration. I am not sure why you want to get the title? You only need to know the ID to get the value. Are you trying to find a way of looping through all the properties defined for a document? If yes, I don't know how to do this but ask again to [EMAIL PROTECTED] for how to do this. Sorry if this doesn't answer your question. - Ian. - Original Message - From: "Martin Seehuusen" [EMAIL PROTECTED] To: "Ian Sparks" [EMAIL PROTECTED] Sent: Thursday, June 08, 2000 10:50 AM Subject: Re: [Zope] How do you call the string? Thank you for you help! I think I need to explain a bit more! Sorry for not doing that in the first place! OK, I go into Properties for one of my files! then I choose an ID, say "prop1" Type could be, say "String" then a value, say "first_value". now what I would like is to call the string, and get up the ID and the Value. something like dtml-var type_command result: ID: Prop1 Value: First_Value Hope this explains a bit more! ;) Thank you for your help. Best regards Martin Seehuusen ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] www.mysite.com/Members/someone
Bill, Thanks for the reply. Yes, I would be getting the data from a SQL statement. Let me explain what I am trying to achieve. I want to structure my site like this : http://mysite.com/Members/username so if someone comes to my site with the URL : mysite.com/Members/Ian They would see the Members page for "Ian" (we'll ignore permissions and security for now). As I have said before, one way of doing this is to have a Zope structure : /Members /Ian /Jim /Jane Where Members is a folder, Ian,Jim and Jane are Sub-folders of Members. But I don't want to do this. What if I add a million users? Then I end up with a million member folders which is difficult to manage from Zope. I want to store my users in a database. I have no problem creating a DTML method which calls a SQLMethod passing a parameter "username=Ian" to pull out the data and construct the HTML for delivery. The problem I have is how to construct my site. What I want is something like : /Members /* Where * is a method which catches the rest of the url (/Ian) and does all the necessary processing to return the formatted user page for Ian. I know I'm missing the Zope Zen of this because it must be easy to do in such a well thought-out product. The thought I had was that "Members" could be a SQL method which takes "username" as a parameter, Ian then is passed in as that Username and the necessary data is pulled from the DB. This is fine except that I still need some other method to render the HTML page for delivery to the user and this would extend my url to : www.mysite.com/Members/Ian/rendermethod. The other problem with this is that it clutters the root with the Members SQLMethod and the rendermethod DTML document. I might start adding more URL's like : www.mysite.com/Members/Ian/preferences or www.mysite.com/Members/Ian/pastposts and the "preferences" and "pastposts" documents would end up in the root too. All these things belong in a Members folder, not at the root. I'm missing something important, I'd appreciate any enlightenment you could bring to this. - Ian. - Original Message - From: "Bill Anderson" [EMAIL PROTECTED] To: "Ian Sparks" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 06, 2000 10:32 AM Subject: Re: [Zope] www.mysite.com/Members/someone Ian Sparks wrote: I have the source here, perhaps you can point me to where I should be looking - the PTK is reasonably large. AFAICS the PTK uses a folder called Members and adds folders under that for each registered user : Members Fred FredContent1 FredContent2 FredContent3 Jim JimsContent Nothing database-driven about that. See below... ... I want to produce a home-page on my site using a URL like : http://www.zope.org/Members/Fred I'm a little confused as to how I would go about this in a dynamic way where I would pull the contents of the page out of a database. A non-database way would be to : /Members (folder) /Fred (sub-folder or Document) /Jim (sub-folder or Document) /Jane (sub-folder or Document) But I want to be able to generate the /Members/Fred page dynamically. What exactly would you generate this off of? I would guess from data in a databse (SQL)? If so, you could do a select statement to ge tthe userlist. You would then make a 'template' that built a page from the data in a database, where username==username (ie Fred). But, you could be asking for something completely different. ;) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] www.mysite.com/Members/someone
Hi, I want to produce a home-page on my site using a URL like : http://www.zope.org/Members/Fred I'm a little confused as to how I would go about this in a dynamic way where I would pull the contents of the page out of a database. A non-database way would be to : /Members (folder) /Fred (sub-folder or Document) /Jim (sub-folder or Document) /Jane (sub-folder or Document) But I want to be able to generate the /Members/Fred page dynamically. The SQLMethod part I can do, its the structuring of the objects in the heriarchy which baffles me. Ideally I'd like to have a "Members" folder in /, as this reduces the clutter in /, but then how do I pick up the "Fred" part of the URL once I have traversed into the members folder and apply it as part of a SQLMethod? - Ian Sparks. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] www.mysite.com/Members/someone
I have the source here, perhaps you can point me to where I should be looking - the PTK is reasonably large. AFAICS the PTK uses a folder called Members and adds folders under that for each registered user : Members Fred FredContent1 FredContent2 FredContent3 Jim JimsContent Nothing database-driven about that. Thanks for your help. - Ian. - Original Message - From: "Philipp Dunkel" [EMAIL PROTECTED] To: "Ian Sparks" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, June 05, 2000 5:36 PM Subject: Re: [Zope] www.mysite.com/Members/someone At 17:23 05.06.00 +0100, Ian Sparks wrote: Hi, I want to produce a home-page on my site using a URL like : http://www.zope.org/Members/Fred I'm a little confused as to how I would go about this in a dynamic way where I would pull the contents of the page out of a database. A non-database way would be to : /Members (folder) /Fred (sub-folder or Document) /Jim (sub-folder or Document) /Jane (sub-folder or Document) But I want to be able to generate the /Members/Fred page dynamically. The SQLMethod part I can do, its the structuring of the objects in the heriarchy which baffles me. Ideally I'd like to have a "Members" folder in /, as this reduces the clutter in /, but then how do I pick up the "Fred" part of the URL once I have traversed into the members folder and apply it as part of a SQLMethod? - Ian Sparks. You can find a solution in the PTK-Source * Philipp Dunkel ICQ# 60149094 * * zReal Productions* * meet me at DALNet chan #phidu* ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] How do you call the string?
I'm not sure what you mean by "call the string"? If you have some properties of a DTML Document you can call them within that document by saying dtml-var variablename. So if you had a property "count" you could say dtml-var count If this doesn't answer your question, try to re-phrase it so we can get a better idea of what you are trying to do. - Ian. - Original Message - From: "Martin Seehuusen" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 04, 2000 4:26 PM Subject: [Zope] How do you call the string? Hi! I would like to look up the properties on an html file that I've made. I've made a string on my html file, but I'm not sure how to call it! I've understood that a dtml-in is to be used, but I don't know what the string is called. Could someone help me with that!? /Martin S. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Aquisition questions
Some time back I had an exchange with Mike Pelletier regarding SQL methods and aquisition. We talked about a URL structure : mysite.com/Users/Fred/Flavor/Cherry/test Users is a SQL method which takes a single parameter (value = Fred here). Flavor is another method which takes a single parameters (value = Cherry here). test is a dhtml method which returns values pulled from the SQL methods. I set this test up and it works fine. One of the effects of aquisition is that the URLs : mysite.com/Users/Fred/Flavor/Cherry/test mysite.com/Flavor/Cherry/Users/Fred/test are functionally identical in my simple DHTML test method but they might not be, for instance if both SQLMethods provided a result column "RowID" then dtml-var RowID would contain the ID of whichever SQL method was run last. Suddenly I'm getting a Users RowID when I expected a Flavor RowID. Potentially disasterous. Is there a way to enforce URL's be traversed in a set way? Thus making : mysite.com/Users/Fred/Flavor/Cherry/test valid while mysite.com/Flavor/Cherry/Users/Fred/test becomes invalid. Also, assuming that both SQLMethods provide a "RowID", how do I specify explicitly which one I want, in OO terms : Users.RowID or Flavor.RowID All help appreciated. - Ian Sparks. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Aquisition questions
Shane, your idea about extending the URL and putting in an extra folder in the path will work but its a bit of a fix rather than a solution. Right now this isn't a RealLife(TM) problem for me, just part of my trying to get to grips with Zope and its potential pitfalls. Isn't there a way to cause the SQLMethods to provide "UserRowID" and "FlavorRowID" instead? That would be the most logical solution. Again, this is a good idea but it doesn't solve the fundamental problem which is that URL's are meant to be traversed in a particular way, if the "clever" user traverses them in a different way than intended you *could* end up in a mess. - Ian. - Original Message - From: "Shane Hathaway" [EMAIL PROTECTED] To: "Ian Sparks" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, June 02, 2000 3:40 PM Subject: Re: [Zope] Aquisition questions Ian Sparks wrote: Is there a way to enforce URL's be traversed in a set way? Thus making : mysite.com/Users/Fred/Flavor/Cherry/test valid while mysite.com/Flavor/Cherry/Users/Fred/test becomes invalid. You could set up an object called "Users" that would be found only if the user goes through "Flavor" first. Your example will have to be modified to get it to work. should work: mysite.com/Users/Fred/FlavorFolder/Flavor/Cherry/test should not work: mysite.com/FlavorFolder/Flavor/Cherry/Users/Fred/test FlavorFolder is a folder at the same level as Users. It contains an SQL query called Flavor and an object called Users. The Users object in this folder raises an exception, telling the clever user to back off. Just a possibility. Also, assuming that both SQLMethods provide a "RowID", how do I specify explicitly which one I want, in OO terms : Users.RowID or Flavor.RowID Isn't there a way to cause the SQLMethods to provide "UserRowID" and "FlavorRowID" instead? That would be the most logical solution. Shane ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Linking to Mailing List Managers
Hi, With all the talk about Syndication I started to think about linking with mailing list managers. Ideally I'd like members of my portal site to be given a free email address username@sitename, bouncing all mail to that address to their real email address. In a roles-based membership scheme it would also be nice to be able to send email to role@sitename, so the email goes to all members with that role. Has anyone done anything like this, linking to an existing Mailing List Manager like Majordomo from Zope? I want to manage the whole thing through some Zope management pages. - Ian Sparks. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Interbase / Cacheing - A thought
Hannu, Does PostgresSQL allow you to have dynamic events? By this I mean can you do things like : PostEvent "Update_tblUsers_Record_" + new.RecordID; I believe that in Interbase the events are compiled into the trigger, not interpreted at Runtime so you can't have an Interbase event alert you to a change in a particular record, only that a change has occurred on a table. Coming from a RDBMS background myself I'd prefer to see RDBMS integration be tighter to Zope - properties etc being stored in the database where appropriate. For reasons of speed you don't want to have to go to the DB each time you want a property but having a data-aware object which knows when to update itself would solve this problem nicely. It should also help with load-balancing and failover where you could have a cluster of Zope instances all working on the same monster DB, all being kept in sync. via the event alerter mechanism. Just my thoughts. - Ian. - Original Message - From: "Hannu Krosing" [EMAIL PROTECTED] To: "Ian Sparks" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 01, 2000 11:28 AM Subject: Re: [Zope] Interbase / Cacheing - A thought Ian Sparks wrote: Had a thought that I wanted to share. Interbase has a feature known as "event alerts". In a trigger you can post "events" which are just fixed data strings e.g. "DataAdded" or "Insert_tblUsers". PostgreSQL has them too. It's not (afaik) supported by DB-API, but could be used in a DA that talks to some lower level API. A client database connection can register to listen to these events. I don't know if any Zopeish Interbase access method supports this (ODBC doesn't to my knowledge) but it would be incredibly useful for synching cached database objects. Zope could hold a representation of the table data in cached objects for quick access. Each object could have one or more "event" methods which related to a database event. When the database adaptor received an event message from Interbase it could inform all objects with a matching event method (these methods would refresh their cached data with current values from the database). In this way database and Zope cache could be synced *without* having to poll the database at an interval. In all, a very efficient mechanism. Just an idea I wanted to put out there. Thanks for getting it out. I have been contemplating the same for PostgreSQL but have been too lazy to do it myself ;) -- Hannu ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )