Planet Zope

        Zope related news
 

Jul-02

Lighting talks thursday

Collaborations in healthcare open source

Link: http://www.chos-wg.eu

It is about collaboration between healthcare professionals. A patient record shared between several health actors in charge of a common patient. The family doctor has a coordinating role.

There's already a lot of health care open source software, but they don't talk together. So there is a need for a more modular approach in order to share those components. Python seems a good match for the project, but they need technical help for this. See the open source working groups of the international situation for telemedicine

Reimplementing the google app engine datastore in berkeley DB - java edition

The GAE isn't really portable. That's just for practical issues, not by design. One of the barriers is the datastore. So he chose to reimplement the datastore (as alternatives weren't practical yet). Targeting small to medium apps. In the end he went for BDB which shared some features with the original google data store. He uses java for it, for instance as Python's protocol buffers are dog slow. And the java implementation of BDB is pretty good and solves some issues with the normal BDB.

Python and excel (Chris Withers)

Python and excel: you could use CSV or the "HTML hack". There's something better: xlrd. This can directly read and write excel files.

Link: http://www.Python-excel.org/

tl.eggdeps (Thomas Lotze)

Link: http://pypi.Python.org/pypi/tl.eggdeps

It collects declared dependencies between eggs as a tree. And it can visualize them using dot/graphviz. You can filter out uninteresting packages (like setuptools) and zoom in on the dependencies of one specific package. You can also group for instance all zope.tal.* packages into one zope.tal node to make the image cleaner. And you can even filter by regular expression.

MOAI (Kit Blake)

MOAI is an open access server platform for institutional repositories. The server manipulates OAI feeds that are in some xml format. One of the users is http://www.cwi.nl which actually is the birth place of Python. Infrae harvested the 8963 documents in CWI's repository. So in the demo Kit was able to find 16 documents by a certain Guido van Rossum from 1995.

So 14 years after Guido left CWI, the first fully fledged Python application is installed at CWI. Python has come home!

The cloud in Five (Kevin Noonan)

He demonstrates amazon's cloud stuff. Cloudware is outsourced virtualization. So a virtual server or storage hosted on a remote platform. The two well known once are Amazon Web Services and Google's app engine. It is good for scaling on demand. And you can get some outsourcing of your infrastructure. The oldest of Amazon's web services is S3, the storage solution. There are Python libraries to connect to it and manage it.

How to hack like an evil overlord (Jonathan Lang)

How to hack like an evil overlord in five easy steps:

  • Shooting is not too good for my enemies. There is no software bug for which shooting is not the good solution.
  • Take a 5 year old as an advisor. They will always spot the flaws in your plans. So always have someone else look at your code.
  • Do not consume any more energy than will fit in your head. So no metaclasses.
  • If I have an unstoppable superweapen, I will use it as early and often as possible. So pdb instead of print statements.
  • "Push the button" should be enough. Automate everything. Don't do long manual steps or the hero will slay you.

Internet censorship (Holger Krekel)

Governments are turning the internet and the mobile networks into the greatest mass surveillance system ever. Iran likes that as it can use our surveillance software and our data-retaining mobile infrastructure to retain all the protesters SMS messages and analyze them afterwards... So our western measures enacted for our protection is going to send thousands of Iranians into the torture chambers.

And the government in some countries is allowed to put trojan horses on your devices. And the government in Germany can in the future sensor any webpage they want. Just by executive decision instead of democratic process. And France tries to put a three-strikes law into effect.

And all that even though the internet is so great. But it is turning into a huge surveillance database for the government. There are technical counter-strategies. Unlocatable content. Untrackable connections. Untrackable access. And there are political counter-strategies like blogging, involvement, twitter, etc.

So support political actions and create cooler technology! For a free internet.

CMS in django (Tommi)

He showed an event-like system used for re-rendering placeholder-tags in an html page with the real content.

SciPy (Stefan Schwarzer)

At the end of July there'll be a European conference for Python in science in Leipzig, Germany. http://www.euroscipy.org

PyCharm (Dmitry Jemerov)

They're working on a new Python IDE: pycharm. Currently a plugin for intelliJ IDEA, but soon standalone. See http://www.jetbrains.com . Price not yet announced, should be available later this year.

He demoed it with nice warnings, quite intelligent autocompletion. Integrated test support. Snippets. Display of docstrings for methods with just a keyboard shortcut.

Psyco 2.0 (Christian Tismer)

He showed a speed test of a normal and a pure Python property implementation to see how much psyco2 can speed that up. On average, there was a 100x improvement. There'll be a psyco2 release on Saturday.

Self-service terminals (Bernard Nikolaus)

There are self-service terminals at his university (Wirtschaftsuniversitaet Wien), implemented with Python, for paying study fees, taking photos, etc. So a card reader, printer, touch screen, etc. All vandal-proof.

The hardest thing of the project was to communicate with all the hardware. There's a watchdog that monitors a subversion repo for updates. And it starts the main program. Zope is used with xmlrpc for the data. The data is stored in an oracle database. The use mostly WXPython widgets for the user interface. Quite big buttons as the interface is a touch screen.

Jacob Hallen

Please use political activism to prevent the recording industry from being allowed to lift us from our beds in the middle of the night for horrid crimes like downloading stuff or even developing open source software. It is a very real danger. We prevailed against software patents after a long struggle. There are politicians that are willing to listen, but we must be the ones to do the talking.

Python system information

PSI is a Python C extension to get information from the kernel via system calls and kernel hooks and so. It currently supports most unixy platforms already, but BSD is lacking and windows too. They do want to add that.

Twisted interface to Erlang (Thomas Herve)

TwOTP: twisted interface to Erlang. http://launchpad.net/twotp . Erlang is a functional language with a focus on scalability. There is an "ERM" protocol to communicate between nodes, which is documented. CouchDB is one of the nice applications made with Erlang. But as a Python programmer we want to access that too.

TwOTP has parsing/packing to/from Python types, an EPMD deamon implementation and implementations for server and client protocols. And monitoring of Erlang processes. Send and receive messages from/to Erlang processes. The good thing: every Python goodie is available to develop with, like UI, web libraries and database interfaces. Several of those things are hard(er) with Erlang.

Python for numerical analysis (Eric)

Most numerical analysis is still done with Fortran. Not nice. So he tried to do it with Python. All the goodies like eigenvalues, green functions, plots of the green functions. The number of lines in the program was much lower than with a comparable Fortran program. He hopes that the Python community will work towards promoting the scientific application of Python. It is so much nicer.

FilterPype network (Rob Collins)

Filterpype: "complex systems in 10 lines of code". A classic case of a filter and pipe system is an oil refinery. With filterpype you can also work with pipes and filters: from source to sink.

There are base classes for all sorts of filters. Stuff you can do? Just pass it on, bzip compression, etc. You tie the filters together in a pipeline with a small config file that specifies the route between the various filters.

Link: http://www.filterpype.org/

TPS reports in django (Felix)

Django's admin interface is highly customizable. At his company he needed to make some modifications, especially adding reports for their issues database. In the end, he generated reports with word by using a template in word's xml format where he could get the software to fill in data. The template was simply uploaded to the site. The documentation on how he did it is all on the wiki of djangoproject.org.

Distributed version control system (Radomir Dopieralski)

Use it, it really changes the way you program. It is real easy to make a clean copy of something, work on it and possibly push the changes back. He thinks there should be more tools like that. For instance for bug reports: there is a tool that embeds bug reports in such a DVCS.

hatta is something that he made that embeds a wiki in the DVCS, including the whole page history. It comes with a small web server that you run straight from your DVCS checkout, so you can easily browse your version of the wiki and even change it via the web interface. And also directly in the source file, of course.

music stand, laptop stand

Technorati tags: europython2009, europython


Province of Ferrara's virtual desktop: a flexible Plone application from a PloneGov member

A Plone "Intelligent Intranet" suite of applications, integrating document and dossier management with ISO 9001:2000 - certified organization processes, used in a mid-sized Italian Public Organization, is going to be reused by other similar organizations of the Italian PloneGov subcommunity

Things I helped create (Martijn Faassen)

Comment beforehand: this is just a dump of some quotes hurriedly typed down while Martijn rattled on. Pick some nice ones out of the list and be happy.

This talk is about creativity in programming. Especially creating open source software. Some of his comments will contradict each other, which is fine. Both are valid, then, and just need to be weighed against each other. Sleep on it, pick one and change it later on if you're wrong.

To create you need to pick a goal. You might not reach it, but you at least created something.

If you are inexperienced with the tools of creation, find a mentor. (He was helped by his father for his first project).

Inexperienced programmers often look for a trick or code snippet if they encounter a problem without understanding it. They lack the knowledge to really apply the basic idea in other situations. Knowledge helps to generalize and generalization helps creativity.

In creation, embrace your limitations.

Make the goal fit what you created. After the fact if needed.

Access to knowledge is greatly improved. Even early-80's MSX assembly codes are easy to google now.

If all goals look infeasible, you might not create anything at all. Writing a computer game in the 1980's seemed feasible. Writing a full 3D game now? Seems hard.

Creations unseen by others can still be valuable if you learn something from it.

Lack of knowledge means you cannot be discouraged by knowledge.

Recreating something is a great way to learn about it.

Networks stimulate creation. Networks bring creations in front of people.

Build on other peoples' work.

Social software encourages creation by its users.

A creation is a project and a process as much as it is a product.

"Publish early" is a good idea. Not publishing in any case means no success.

Creation is not done in isolation. And it is often a group effort.

Martijn re-discovered the joy of quick creation in 1998 with python like he had with basic (in contrast to C++).

Feedback stimulates creativity. (For instance on the python prompt).

Good tools stimulate creativity.

Creation can be just a matter of speaking up. What works for God (God said "let there be light" and there was light) sometimes also works for people. Speak up, announce something, start something.

A community around software forms more easily if the software aims at developers instead of end-users as developers are more easily converted to contributors.

Software is a human endeavour.

If your approach doesn't work, go with the flow of your strengths.

To create a business together with someone else is one of the most educational things you can ever do with your life.

A creation is successful if it continues to evolve after you're no longer involved.

It is easier to make a creation evolve without you if you are not alone in its creation.

Creation if often started by communication.

Creation by a team is a lot easier if you are in the same room physically.

Getting an idea is often overvalued. Implementation is most-times what counts.

If you want a community to create something, avoid doing all the work yourself.

Name recognition is useful in creation. Just making regular noise on a mailinglist might be enough.

Europython was basically started by Martijn. He mailed Guido that there was to be a EU python conference and whether he wanted to attend ("yes"). Then he mailed around in the EU that Guido was coming to the EU python conference and asked for volunteers to help organize it. So others did the work and we have now Europython conferences.

Create something because it is cool. Not because it will succeed but because you will learn something from it.

Integration is a form of creation. Integration of software can integrate communities. (Example: the Five project that brought zope2 and zope3 back together).

Talk about what you create. Use some oft-repeated phrases in those talks. "Evolution, not revolution" for instance. After a while people were picking up these phrases.

Separate concerns. Each component gets a clearer purpose and clearer boundaries. And the basic components become candidates for reuse.

Document your creation.

To create, be clever and use what is already there.

To create, be lazy and unoriginal.

Martijn preparing his talk

Technorati tags: europython2009, europython


Metaprogramming and decorators (Bruce Eckel)

Basically, metaprogramming is code that modifies other code. Several languages have something like that. C++'s template metaprogramming (which is too difficult for most people). Java has aspect oriented programming and annotations. Ruby can add methods to metaclass objects. Python first had metaclasses and moved on to the much simpler decorators afterwards.

You use metaprogramming when you start to repeat yourself over and over again but you cannot filter out a common method or base class.

Built-in decorators in python are @property, @classmethod, @contextmanager. Twisted, turbogears, django and zope all have their own decorators for common tasks. Someone came up with an @accepts(int, string) argument checker for checking the type of method arguments. And a @memoize decorator can store a method's result in a cache so that the method only has to calculate everything once and that the cached value is returned afterwards, all without having to deal with it in the method itself as the decorator handles it in a generic manner.

An example:

def addstring(function):
    function.mystring = 'added string'
    return function

@addstring
def f():
    return 1

This results in:

>>> f()
1
>>> f.mystring
'added string'

So the addstring decorator gets passed the item it applies to and returns it again. But modifying it in-between. The way it works is extremely simple, but the effect is big and very useful. It gets a bit more evolved when you want to pass an argument to the decorator (@addstring('hello')), but that's what examples are for. See for instance the functools standard library.

You can also use decorators on classes. They work on a whole class instead of on a function. Typical use is to register the class somewhere or to augment it. For example (see activestate recipe) adding the rest of the ordering methods give one of __lt__, __gt__, etc.

Metaclasses are still part of the python language. A big problem is that a metaclass is more or less hidden; decorators are visible right in front of your class, on the line above. In plain sight. Metaclasses are much harder to understand and should only be used in special cases.

In case you think you need metaclasses: have you looked at __new__() in addition to __init__()? The output of __new__() is what gets fed into __init__(), so if you need to do some fiddling with the inheritance tree or other specialized weird thing, you can just use __new__() instead of using metaclasses.

Again, if you only want to add some attributes/methods or register the class or so: just use a simple decorator.

For an (according to bruce excellent) presentation on "class decorators: radically simple", see http://pycon.blip.tv/file/1949345 .

Summary: decorators are easy and very useful. Don't forget to use functools.wraps. Metaclasses are hardly ever needed and when you need it you'll know that you need it.

Photographer at europython

Technorati tags: europython2009, europython



Jul-01

Semantic applications with CubicWeb (Nicolas Chauvat)

CubicWeb: the semantic web is a construction game.

The value of a network like the current internet grows exponentially with the amount of information that is available and linked. The semantic web extends that linking to data instead of just documents.

The semantic web is a world-wide database with URLs as the keys into the "database". Specific semantic web formats include RDF and OWL. And ontologies describe what you're describing. There's even a specific query language: SPARQL.

Our current frameworks don't really support all this, so we need adapted frameworks. For instance what logilab did with cubicweb. Cubic has a couple of core concepts. An entity-relationship model of the data. Views to present results of queries (RQL, soon SPARQL). The visible web app uses html and json views; there are also semantic views that output rdf and owl.

Cubicweb's back-end combines/aggregates various sources such as sql, RQL, LDAP, comma separated files and is queryable with RQL. So if you don't like the second layer (the web engine), you can always reuse the back-end layer as that only communicates with plain queries. The aggregation allows you to store for instance metadata in an sql database ("last modification time" and so), cubicweb will aggregate it. In his demo at the end he showed turbogears as a front-end as proof that you can use the back-end separately.

For the front-end, there is support for partially generated user interfaces. And there is a library of reusable components (called "cubes").

They're keen on agile methodologies at Logilab. So cubicweb supports that. For instance by generating a basic CRUD (create, delete, etc) user interface based on a data model. That's all you need to get started. You can then improve views progressively. And there's support for data migration as the data of course also evolves. They're using cubicweb internally in logilab for 5 years now and always managed to migrate the older content.

Aformentioned "cubes" are python classes that define their attributes in a schema style (like zope's schema). There are more frameworks that do that now, but 7 years ago it was much less common. Those entities are tied together by relations: also a class, but now with a subject and an object attribute (so source/target for the relation). Semantic web style linking! Cubicweb aggregates all those cubes' content so that you can query it.

Some examples of build-in semantic views: owl, foaf (friend of a friend, social networking), doap (description of a project) and a couple of common microformats as RDFa, iCal, vCard.

Since last year, version 3.0 is out as a LGPL-licensed download.

Nicolas Chauvat

Technorati tags: europython2009, europython



Jun-30

Deliverance: lipstick on a pig (Matt Hamilton)

Talk about dynamically re-skinning a legacy .NET portal with python. The look and feel wasn't compelling. The usability wasn't that good in certain spots. The content management was poor (as they bought the portal product of the commercial vendor and not, for lots of money, the content management product). And vendor lock-in: even small changes were very expensive.

The customer wanted a much more flexible and maintainable system. And as the current system was monolithic, they wanted to be able to choose the best programs for the various parts. Moodle, plone and some of the existing system. But they couldn't actually touch the existing system for contractual reasons.

A cunning plan: put a new skin in front of the current website by using a transformation proxy. The core element: Deliverance as the proxy. Deliverance removes the need of skinning an application inside the application itself. Deliverance is basically "xslt for dummies" that transforms an incoming html page according to some rules.

Another component: WSGI ("web service gateway interface") for chaining small modules together in a pipeline. There are a lot of existing components out there that you can reuse. And it is easy to make your own components to plug into the pipeline. The pipeline they're using now, to give an example:

  • Grab content from existing site.
  • Clean up html. LXML is great. It is not only an xml library, it also cleans up broken html (like beautifulsoup). 70kb of old content with 120 validation errors is now 40kb with 27 errors (mostly just xhtml/html mismatches).
  • Rewrite links. The common .asp commercial-softare hugely ridiculously long urls are now /news/1234. From 205 characters to just 41 in their case. lxml has a method that returns all links in a document; you can also pass it a method that rewrites all those links.
  • Inject plone content programmatically.
  • Apply theme via deliverance.

(Comment for myself: experiment more with WSGI, there's a whole lot of things I want to experiment with). The performance is good. They do all this on-the-fly. It sure helps that the old system was dog-slow, so every improvement is noticeable.

They've got several pipelines (one for the old site, one for plone and one for moodle with more to come). And several pipeline plugins are shared between several pipelines: reuse!

Of course there were complications:

  • One page with two content sources: how do you build the navigation?
  • Search obviously is a problem with content spread all over the various source-sites. Sorl/xapian/google mini etc. is what they're going to look at.
  • .NET viewstate postback: asp.net uses a huge (couple of kilobytes) hidden state variable with a html form element wrapping the entire site. Horrible. Horrid. With some javascript that modifies all normal links from a standard GET into a POST that includes the hidden variable. Solved as most of the state variable data wasn't needed in most cases, so it could be left out most of the time.

The complications were solvable and the site is about to go live.

Museum in Birmingham

Technorati tags: europython2009, europython



Jun-25

1.0 bugs for the Europython grok sprint

I looked through the Grok buglist with Jan-Wijbrand today. Goal:

  • Get a short list of bugs as focus for the Europython Grok sprint.
  • Find the bugs that really move 1.0 forwards.
  • Find bugs that are probably doable in two days.

I've tagged all five bugs we selected with "europython2009" so that they're easy to find:

  • Splitting grok.CodeView (with just a render() method, so something that programmatically returns output) out of grok.View (which only retains its @template and loses the render() method) ought to simplify the code a lot and open up the way for the last couple of fixes that are needed in this area for 1.0.
  • grok.require() effectively falls back to the zope.Public permission. zope.Public isn't something you can take away. If we set the default to zope.View, we can easily close everything to anonymous visitors.
  • Having one templates/ directory for a couple of modules is handy, but buries you under unnecessary warnings at the moment.
  • XMLRPC in combination with WSGI is broken. Can we (help) fix/debug it?
  • For WSGI when using development mode, something's fishy with logging in. Loads of comments on the bug, so with that we ought to nail it during the sprint.

For all your grok sprint info, see my previous Grok sprint at Europython 2009 blog entry (which I updated with the sprint location).



Jun-23

Open Source Water Quality Management System with Zope

The Water Quality Management System (WQMS) for South African authorities on the open source application server Zope. The WQMS is in use by 160 South African local governments and can be used by Water Service Authorities (local government), provincial and national government to guide the tracking, reviewing and improving of water quality. The project, which bears the potential of being shared with neighboring nations, is a new example of open source software being an enabler for innovation and social progress.

Going to Europython 2009

I'm going to this year's Europython conference again. It'll be my fifth (after 1xCharleroi, 2xGotenburg, 1xGeneva), hurray! It is always a fun conference where you learn a lot and meet lots of friendly people.

  • Blogging. The best way for me to get the most value out of a conference is to make summaries of the talks. It forces myself to pay attention as I have to extract both the overall structure and to extract handy details and tips. Tim Bray says words are important and he's right. The information density of a good summary is incredible. Who will listen to the audio files of all the talks? Who will at least browse all available blog summaries? Probably more. Better yet: read the summaries and cherry-pick audio or video files of the highlights. Seeing a video of a memorable talk makes it more memorable.
  • Food. Wow, the lunches we'll have sound like a jolly good idea. So after a lot of discussion, for EuroPython 2009 we've decided to go for what is essentially British peasant food: simple, satisfying, sustaining and quick to serve. Good idea.
  • Program. To give an impression of the kind of talks at Europython, here's my pick of the talks that I'll probably attend:
    • Tuesday: mostly testing talks in the morning, perhaps with a small look at django. I'm looking forward to the afternoon: theming with Deliverance, XML document publishing, reportlab PDF stuff in combination with django. And again some testing, now of javascript.
    • Wednesday: First a look at TurboGears. I do my work with grok, so a look over the fence is handy to get extra ideas. Something I'm looking forward to: the 11:00-12:30 slot in lecture room 1: a semantic web and a web data handling talk. Not sure yet about the afternoon talks. The "python coin" talk at 15:30 in the man hall is highly recommended. I heard it once and that's just great fun.
    • Thursday: man, this is looking to be a good conference. Three interesting talks on thursday. Decorators and metaclass programming by Bruce Eckel; an always-interesting talk by Martijn Faassen; "software apprenticeship" by Christian Theune.
  • Sprinting. I'll attend the Grok sprint on Friday and Saturday after the conference. Let's take a couple of big steps towards a final 1.0 release!
Europython 2006 lunch


Jun-19

Plone launches user feedback system

Feed: Plone News
Have a great idea for how to improve Plone? We've now got a simple new tool to suggest, discuss and vote on ideas!

Buildout with Repoze, Zope, and Plone

I know in my last post I indicated that I'd post more about the various technologies I'm using for the Antichrist Watch site, but I've now had a few requests related to some of the Repoze work I'm doing with some of the local Saugus, MA sites, so I'll be making a slight detour. I will get back to the Dojo stuff. I promise.

I discovered Repoze when first dabbling around with what would eventually become the aforementioned Antichrist Watch, and in fact I directly made use of repoze.chameleon to handle its templating needs. I liked what I saw, and decided to try first experimenting a bit with it and then actually porting over some real-world sites to it. We were in the process of doing some hardware upgrades on the some servers anyway, so the sites they hosted seemed liked good candidates. To make things interesting, most of them came in basically two distinct flavors: straight Zope, and customized Plone.

The first group was largely composed of mostly non-technical customers who take advantage of the bottom of the so-called "Z shaped curve" to do basic site edits through the Web. Some of these customers enjoy having fairly current versions of Zope. The second group featured various degrees of customization, from the fairly vanilla to the strikingly different. Most of these were handled via custom Plone products designed more or less in the manner described in Martin Aspeli's Professional Plone Development. With this logical grouping, buildout seemed a logical choice for site construction as I could make just three buildouts and then trivially generate as many sites as desired. The only problems were that the Repoze guys themselves seem not to use it much and (understandably considering the drudgery involved) don't have prepackaged versions of the latest-and-greatest of either Zope or Plone currently available.

Ultimately I wanted all the sites running through mod_wsgi using as few physical servers as practical. I wanted to only have one supervisord instance per physical server monitoring all the ZEO servers it contained. I also wanted to minimize the number of ports in use in order to reduce the bureaucracy of port tracking we'd have to do afterwards.

Getting current versions of Zope and Plone running under Repoze turned out not to be so simple. I read a few articles on the topic in addition to the Repoze Quick Start, but due to differences in versions and/or environment none of them did what I needed.

Making It Happen

Enough introduction! Here's what I did for the variant with Plone:

  1. paster create -t zope2_buildout targetname

    It doesn't much matter what answers are given, as buildout.cfg gets overwritten anyway.

  2. cd targetname

  3. Replaced buildout.cfg with the following:

    [buildout]
    extends =
        http://good-py.appspot.com/release/repoze.zope2/1.0
        http://dist.plone.org/release/3.3rc3/versions.cfg
    
    versions = versions
    
    find-links =
        http://dist.repoze.org/zope2/latest
        http://dist.repoze.org/zope2/dev
        http://dist.plone.org/release/3.3rc3
        http://download.zope.org/ppix/
        http://download.zope.org/distribution/
        http://effbot.org/downloads
    
    develop =
        src/mysite.policy
    
    parts =
        zope2
        instance
        slugs
        addpaths
    
    [zope2]
    recipe = zc.recipe.egg
    dependent-scripts = true
    interpreter = zopepy
    eggs =
        repoze.zope2
        Plone
        PIL
        Products.DocFinderTab
        Products.ExternalEditor
        plone.openid
        mysite.policy
    
    [slugs]
    recipe = collective.recipe.zcml
    zope2-location=${buildout:directory}
    zcml =
        mysite.policy
    
    [instance]
    recipe = iw.recipe.cmd
    on_install = true
    cmds =
       bin/mkzope2instance --use-zeo --zeo-port=${buildout:directory}/var/zeo.zdsock --zope-port=8888
       sed -i "" "s/server localhost:/server /" ${buildout:directory}/etc/zope.conf
       echo "Please run 'bin/runzeo -C etc/zeo.conf' and 'bin/paster serve etc/zope2.ini', then 'bin/addzope2user  '"
    
    [addpaths]
    recipe = z3c.recipe.runscript
    install-script = addpaths.py:main
    update-script = addpaths.py:main
    
  4. Added the file addpaths.py to the buildout's top level directory with the following contents:

    import os
    from dircache import listdir
    
    BinDir = 'bin'
    UnadornedFiles = ('bin/zope2.wsgi',)
    RegularFiles = ['%s/%s'%(BinDir,filename) for filename in listdir(BinDir)]
    EggDirs = ('eggs',)
    ProductsPath = os.path.abspath('products')
    
    def main(options, buildout):
        for filename in UnadornedFiles:
            lines = open(filename,'r').readlines()
            file = open(filename,'w')
            alreadyProcessed=False
            for line in lines:
                if line.startswith('import sys'):
                    alreadyProcessed=True
                elif line.startswith('import os') and not alreadyProcessed:
                    file.write("import sys\nsys.path[0:0] = [\n")
                    for eggDir in EggDirs:
                        for filename in listdir(eggDir):
                            file.write("  '%s',\n"%os.path.abspath('%s/%s'%(eggDir,filename)))
                    file.write("  ]\n\n")
                file.write(line)
        for filename in RegularFiles:
            lines = open(filename, 'r').readlines()
            file = open(filename, 'w')
            for line in lines:
                file.write(line)
                if line.startswith('sys.path'):
                    file.write("  '%s',\n"%ProductsPath)
            file.close()
    
        print "Egg paths added to %s" % ', '.join(UnadornedFiles)
        print "Product path added to %s" % ', '.join(RegularFiles)
    
  5. python2.4 bootstrap.py

  6. bin/buildout

    Just ignore any 'return' outside function types of errors you see.

Once these steps have been completed, ZEO can be started with the command bin/runzeo -C etc/zeo.conf (which can be easily controlled via supervisord) and Zope can be started manually for testing with bin/paster serve etc/zope2.ini or in a more production-ready form via mod_wsgi using zope2.wsgi.

Details To Note

I borrowed but heavily modified the addpath.py concept already living in the Plone collective to add all missing paths to all the scripts in bin. The WSGI script as created lacks pretty much everything, and all the others lack the products directory used for old-style products. As written it's not very clever and could be greatly improved, but it serves my current needs.

The order of parts matters somewhat, as both slugs and addpaths rely on pieces created earlier.

I'm using direct sockets in lieu of ports since these sites are living on single physical servers anyway and it means I have less to manage afterwards. Unfortunately the mkzope2instance doesn't do exactly what one might want in this case, so the sed line is necessary afterwards to clean up.

The slugs section adds ZCML slugs for those products that need them, including the hypothetical product mysite.policy being actively developed in src.

I just recently discovered Martin Aspeli's Good-Py. I was originally individually pinning the versions of the pieces that mattered, and only made this simplification this morning... so far it seems to be fine, though.

Just before starting this post I spotted Alex Clark's post also discussing this topic. We're doing a lot alike, but a few things differently. Depending upon what you're doing, you may find that what he's doing more directly addresses your needs.

Earlier on I mentioned how I needed to handle two main groups of sites: Plone ones and straight Zope ones. The above instructions only cover how I handled the Plone ones. This post has gotten long enough already, and although my treatment of the straight Zope ones is similar it's different enough to make things confusing for those who don't need it. If you need it, let me know and I'll probably give it a similar treatment to what I did here.


PloneGov challenges: growth and structure

PloneGov wants to grow. This project aims to reach more and more public organizations, and set up successful collaborations between them. It seeks to connect people who already have a strong base of Plone applications and are active in the sector. This article investigates the challenges between structuring a project and remaining flexible enough to maintain its attractiveness.


They Call it Stormy Monday, but Tuesday's Just as Bad

I just uploaded a tutorial on using Storm with BFG to the BFG tutorial bin. The application is traversal-based, and uses the storm.zope-based transaction integration, in combination with repoze.tm2, to make for a very pleasing little CRUD app.


XML   Syndicate
» ZopeNews rss1.0
Feeds   recent Feeds
07-02 16:16 Reinout van Rees'...
07-02 11:23 Zea Partners News
06-19 22:52 Plone News
06-19 20:01 Revotera Vojao
06-18 20:04 Palladion Softwar...
06-18 03:36 Andy McKay's blog
Feeds   recent PyPI
07-02 17:11 Products.SmartPrintNG 1.2.12
07-02 16:59 gocept.zeoraid 1.0b2
07-02 15:56 Products.humanator 0.6
07-02 14:50 zope.testing 3.7.6
07-02 11:27 redturtle.imagedevent 0.4.0
07-02 10:34 z3c.password 0.7.1
07-01 23:31 collective.contacts 1.4.1
07-01 20:00 repoze.whoplugins.zodb 0.8
07-01 18:05 plonetheme.p2 0.3.1bdev
07-01 17:27 plonetheme.p2 0.3bdev
Bookmarks   del.icio.us
» del.icio.us/tag/grok
» del.icio.us/tag/plone
» del.icio.us/tag/repoze
» del.icio.us/tag/zope
» del.icio.us/tag/zope3
- - - - - - - - - -
del.icio.us is a collection of personal, categorized bookmarks
About   About PlanetZope
» PlanetZope aggregates
the weblogs and product
announcements of zope
related websites.
- - - - - - - - - -
10870 newsitems since june 2004
- - - - - - - - - -
It is made using Zope 2.7,
CMF 1.4.2 and Mark Pilgrim's UniversalFeedParser 4.2
- - - - - - - - - -
Contact: d2m
- - - - - - - - - -
Nearby planets
» Advogato
» Apache
» Debian
» Lisp
» Plone
» Python
» RDF
» Twisted
» XMLhack