[Zope3-dev] Zope 3 without ZODB

2007-01-20 Thread Chris Withers

Hey All,

I'm still continuing poking around (when I have the chance) to see how 
I'd get Zope running without ZODB.


Does the following line:

db = zope.app.appsetup.appsetup.multi_database(options.databases)[0][0]

...from:

http://svn.zope.org/Zope3/trunk/src/zope/app/server/main.py?rev=71011view=markup

...mean that Zope 3 is currently hard-coded to need a ZODB?

If so, how should we go about making this optional?

(I am willing to put the work in to make this happen if people give me 
some hints...)


cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Re: Zope 3 without ZODB

2007-01-20 Thread Philipp von Weitershausen

Chris Withers wrote:

Hey All,

I'm still continuing poking around (when I have the chance) to see how 
I'd get Zope running without ZODB.


Does the following line:

db = zope.app.appsetup.appsetup.multi_database(options.databases)[0][0]

...from:

http://svn.zope.org/Zope3/trunk/src/zope/app/server/main.py?rev=71011view=markup 


Note that there are two main.py files, one for zope.server in 
zope.app.server and one for twisted.web2 in zope.app.twisted.



...mean that Zope 3 is currently hard-coded to need a ZODB?


Yes.


If so, how should we go about making this optional?


We would check if options.databases if empty. If that's so, we could set 
'db=None'.


The 'db' object (the database) gets passed a long to the ServerTypes 
which pass it along to the WSGIPublisherApplication which then passes it 
along to the request/publication factory. This way, when a new request 
is created and a publication object with it, the publication has the 
database to start traversal off of. As far as I can see it, the 
publication is the only component in that whole chain that expects the 
'db' object NOT to be None. So, you'd have to write your own publication 
that wouldn't use the 'db' object for a traversal root but your own 
custom object, e.g.:


class MyPublicationMixin(object):
Mix this in with BrowserPublication, HTTPPublication, etc.

def getApplication(self, request):
stack = request.getTraversalStack()
if '++etc++process' in stack:
return applicationControllerRoot

myroot = RootObject()
return ProxyFactory(myroot)

(I am willing to put the work in to make this happen if people give me 
some hints...)


Changing zope.app.server.main and .twisted.main to accept an empty 
database section in zope.conf and thus set 'db=None' would probably be 
all that's needed, plus your custom publication that ignores the 'db' 
argument. Would be cool if you could document this, though :)



--
http://worldcookery.com -- Professional Zope documentation and training
2nd edition of Web Component Development with Zope 3 is now shipping!
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] RFC: test.py --list-modules

2007-01-20 Thread Marius Gedminas
On Sun, Jan 14, 2007 at 10:31:16PM +0200, Marius Gedminas wrote:
 I have now implemented --list-tests in a different branch.  That option
 pays attention to all of -t, -m, -s, -u, -f, --layer, --level options.
 
   http://svn.zope.org/zope.testing/branches/list-tests/?rev=72034view=rev
 
 I intend to merge this one, unless somebody suggests a cleaner way of
 implementing it.

Merged.

Marius Gedminas
-- 
Nobody will ever need more than 640k RAM!
-- Bill Gates, 1981
Windows 95 needs at least 8 MB RAM.
-- Bill Gates, 1996
Nobody will ever need Windows 95.
-- logical conclusion


signature.asc
Description: Digital signature
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Zope 3 without ZODB

2007-01-20 Thread Jim Fulton


On Jan 20, 2007, at 6:09 AM, Chris Withers wrote:


Hey All,

I'm still continuing poking around (when I have the chance) to see  
how I'd get Zope running without ZODB.


Does the following line:

db = zope.app.appsetup.appsetup.multi_database(options.databases)[0] 
[0]


...from:

http://svn.zope.org/Zope3/trunk/src/zope/app/server/main.py? 
rev=71011view=markup


...mean that Zope 3 is currently hard-coded to need a ZODB?


That depends on what you mean by Zope 3.  If you define Zope 3 as   
zope.app.server.main, or zope.app.twisted.main, then yes, it is. I  
wouldn't define it that way, although I can see how others might. :)



If so, how should we go about making this optional?


You would need to write a different main program that did something  
else. You would need to understand how the publisher framework worked  
and plug in an alternate publication that traversed to non-ZODB  
objects. Unfortunately, these frameworks were written before we got  
the doctest religion, so there's no document that I'm aware of that  
explains how to do this. It isn't very complicated. I have a strong  
itch to write such a document, but I don't know when I'll get around  
to scratching it.  I don't know if any of books get into this.


(I am willing to put the work in to make this happen if people give  
me some hints...)


Other people have already made this happen. I don't know if any of  
their code is public or if they have written up what they've done.


Jim

--
Jim Fulton  mailto:[EMAIL PROTECTED]Python 
Powered!
CTO (540) 361-1714  
http://www.python.org
Zope Corporationhttp://www.zope.com http://www.zope.org



___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: Zope 3 without ZODB

2007-01-20 Thread Jim Fulton


On Jan 20, 2007, at 7:37 AM, Philipp von Weitershausen wrote:


If so, how should we go about making this optional?


We would check if options.databases if empty. If that's so, we  
could set 'db=None'.


I would be -1 on hacking the existing main programs. They are already  
a mess.
This is not meant to be a criticism of their authors, who did they  
best they could at the time and with the working assumptions.


I would *much* rather see us open this up by making this part of Zope  
3 more modular and putting more emphasis on explaining what is going  
on and how one would do something different.


Here's what I'd like to see:

1. Separate server definition from application definition.  They are  
way too interwoven now.  I'd like to see us move to Paste Deploy (or  
something based on the framework it defines).


2. Document how to use the zope.publisher framework to define web  
applications.  It isn't very complicated, it just needs some  
documentation.  I made a beginning of of this in my aborted bobo  
project.  A good start for examples would be a hello-world app, the  
existing zope 3 app, and, I assume, Grok.


Jim

--
Jim Fulton  mailto:[EMAIL PROTECTED]Python 
Powered!
CTO (540) 361-1714  
http://www.python.org
Zope Corporationhttp://www.zope.com http://www.zope.org



___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: Zope 3 without ZODB

2007-01-20 Thread Chris Withers

Philipp von Weitershausen wrote:
We would check if options.databases if empty. If that's so, we could set 
'db=None'.


The 'db' object (the database) gets passed a long to the ServerTypes 
which pass it along to the WSGIPublisherApplication which then passes it 
along to the request/publication factory. This way, when a new request 
is created and a publication object with it, the publication has the 
database to start traversal off of. As far as I can see it, the 
publication is the only component in that whole chain that expects the 
'db' object NOT to be None. So, you'd have to write your own publication 
that wouldn't use the 'db' object for a traversal root but your own 
custom object, e.g.:


class MyPublicationMixin(object):
Mix this in with BrowserPublication, HTTPPublication, etc.

def getApplication(self, request):
stack = request.getTraversalStack()
if '++etc++process' in stack:
return applicationControllerRoot

myroot = RootObject()
return ProxyFactory(myroot)


Ouch, what this code seems to imply is that I'd have to create new 
publications of all types :-S


It strikes me that I shouldn't have to mixin and create new publications 
of every type just because I don't want a ZODB ;-)


Is there an IApplication? If so, could whatever calls getApplication 
(which I guess must somehow get passed db) rather adapt db to an 
IApplication?


zope.conf could then return things other than ZODB db's from it's db 
section and everything would be great provided there was an adapter from 
the object returns to IApplication, where IApplication is the interface 
that describes whatever getApplication above should return?


cheers,

Chris

PS: I'm aware the above is hand waving in some senses, I don't have the 
time I'd like to dig in and research this properly right now, but I want 
to try and get a feel of things for when I do...

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Zope 3 without ZODB

2007-01-20 Thread Chris Withers

Jim Fulton wrote:



...mean that Zope 3 is currently hard-coded to need a ZODB?


That depends on what you mean by Zope 3.  If you define Zope 3 as  
zope.app.server.main, or zope.app.twisted.main, then yes, it is. I 
wouldn't define it that way, although I can see how others might. :)


Well, for me, a Zope 3 instance is what you get when you run 
mkzopeinstance. If there's other alternatives to that, I'd be interested 
in exploring them :-)



If so, how should we go about making this optional?


You would need to write a different main program that did something 
else.


Has anyone else attempted this? Does grok have one of these?

You would need to understand how the publisher framework worked 
and plug in an alternate publication that traversed to non-ZODB objects.


I touched on this with my reply to Philip, but surely the publication 
type should just be operating on objects that implement an interface?
It seems odd, at least to me, that I'd need to rewrite publications that 
know about things like http, ftp and webdav just because the object I 
want to publish come from a file system or relational database rather 
than a zodb...


do this. It isn't very complicated. I have a strong itch to write such a 
document, but I don't know when I'll get around to scratching it.  I 
don't know if any of books get into this.


I'll be blunt here, I'm more into app frameworks than server frameworks 
so I'm far from best placed to do this work, but I do what to see more 
freedom in where data served by zope 3 comes from and especially I'd to 
find a way to have a zope 3 not rely on a zodb being present at all.


Don't get me wrong, I love zodb, but it runs into problems of political 
acceptance on the one hand and lack of support for high write volumes...


(I am willing to put the work in to make this happen if people give me 
some hints...)


Other people have already made this happen. I don't know if any of their 
code is public or if they have written up what they've done.


This is a bit cryptic... are you saying there is an alternative zope 3 
that already has alternatives to zope.app.server.main or 
zope.app.twisted.main? If so, where are they to be found?


cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: Zope 3 without ZODB

2007-01-20 Thread Chris Withers

Jim Fulton wrote:


I would *much* rather see us open this up by making this part of Zope 3 
more modular and putting more emphasis on explaining what is going on 
and how one would do something different.


big +1 from me...


Here's what I'd like to see:

1. Separate server definition from application definition.  They are way 
too interwoven now.  I'd like to see us move to Paste Deploy (or 
something based on the framework it defines).


Is this the seperation of what objects are being served from what 
protocols are being served that I mentioned in my other reply?


In my dreams, it'd be great if I could just wire in a different 
IApplication utility to get the root of the object tree and just leave 
the zodb section of zope.conf empty. How hard would that be to achieve?


(the 2nd bit of it is important, I don't want zodbs opened, especially 
if they're never going to get used)


2. Document how to use the zope.publisher framework to define web 
applications.  It isn't very complicated, it just needs some 
documentation.  I made a beginning of of this in my aborted bobo 
project.  A good start for examples would be a hello-world app, the 
existing zope 3 app, and, I assume, Grok.


Yes, I'm curious about Grok too here, I hope someone who knows from that 
project will pipe up. Would the hello-world app be akin to the stuff I 
was nosing around in zope.app.appsetup?


cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com