[mod_python] Beta testers for "vampire::publisher"?

Graham Dumpleton grahamd at dscpl.com.au
Mon Feb 28 17:42:39 EST 2005


Bo Lorentsen wrote ..
> Graham Dumpleton wrote:
> 
> >In asking, I mean to the extent of hosting and getting working an
> >existing mod_python.publisher application on top of Vampire instead,
> >not just kicking the wheels a bit.
> >  
> >
> Hmm, I have a rather large system (still in beta), written for the 
> publisher, and some of the features of vampire sounds nice and worth the
> effort.
> 
> But two things :
> 
> - What kind of bugs do You expect (me) to find ?

I would hope there are no bugs as far as what I intend the code to do,
I'll take what you probably mean is what incompatibilities you might
expect which would require a change to your code. I would expect
these are going to be in the following areas:

- Use of "apache.import_module()" or direct imports of application
  specific modules using "import", would be preferably changed to
  use the Vampire module import system. If not done, you aren't
  benefiting much from changing in the first place.

  If the changes are made, module imports are not blindly done over
  the top of existing modules, thus you may need to add a special
  method into a module to indicate what data is preserved across to
  a newly loaded module from the one being replaced.

- Vampire is stricter about what data types can be published. One
  can still publish all the basic Python data types, but an object
  instance cannot be published by way of execution of its __str__()
  or __repr__() method. Instead, you would need to define __call__()
  for the class instead.

  This has been done because Vampire allows new style classes to
  be traversable and I haven't been able to find a reliable way of
  knowing that that a new style class has actually defined its own
  versions of __str__() or __repr__(). This is an issue because in
  Vampire I don't allow publishing to fallback to using default
  __str__() methods which simply print out what the type of the
  object is because I don't believe that evidence that Python is used
  should be published by default.

  If someone can point out to me how to detect for a new style
  class when it provides its own __str__() or __repr__(), this could
  be changed, but I have had no luck working it out so far unless
  I am missing the obvious.

- Vampire provides an extended mechanism for interpreting form
  arguments. For example, if you had two form parameters called
  "name-1" and "name-2", they would be converted into a single
  list where the parameter was called "name". Similarly, if you have
  form parameters "name.surname" and "name.firstname", they
  will be converted into a dictionary passed as "name" holding keys
  "surname" and "firstname".

  Thus, if you use '-' or '.' in form parameter names already, they
  may get interpreted in strange ways.

> - Why have this code not been added to the mod_python cvs ?

It seems that this is the question everyone is asking. The main reason is
that what I have done is not simply a copy of the existing code with tweaks
to make it work, but a reanalysis of what publisher does and a more or
less fresh interpretation of how to go about implementing that functionality.
As such, it can't simply be pushed back into the existing source code.

Even though many of the problems that were found in the original
publisher code while doing this, as well as problems I have pointed out
previously could be addressed, there are certain things that could not
be improved without breaking backward compatibility. You would thus
still be stuck with those limitations and quirks.

Graham


More information about the Mod_python mailing list