[Zope] DTML parsing outside of Zope

Peter Bengtsson peterbe at gmail.com
Thu Jul 28 07:22:54 EDT 2005


> import Zope
> app=Zope.app()

No. I've actually found a way to do it without starting zope (thus,
not using the ZODB).
The trick was in import nvSQL from DA.py and use that. It works now, I
can now parse and run ZSQL methods on the filesystem without having
any zope running.
I'm going to tidy my script and post it on my blog soon.

On 7/28/05, Jonathan <dev101 at magma.ca> wrote:
> 
> ----- Original Message -----
> From: "Peter Bengtsson" <peterbe at gmail.com>
> To: <zope at zope.org>
> Sent: Thursday, July 28, 2005 5:59 AM
> Subject: [Zope] DTML parsing outside of Zope
> 
> 
> >I would like to be able to parse a very basic DTML string (a
> > ZSQLMethod on the file system actually) outside Zope, ie. without
> > having the whole zserver running.
> > The DTML inside the string is very basic. It doesn't use REQUEST or
> > aqcuisition. It's using <dtml-if "1==2"> and stuff.
> > I've tried looking on the source code but it's so damn complicated for
> > me. Can anybody give me a headstart on this?
> 
> 
> If you are trying to access the zodb without having zope running, here are a
> couple of ways to make it happen:
> 
> # method #1
> import os, sys, traceback
> sys.path.append("/apps/zope/lib/python")
> import Zope
> app=Zope.app()
> from Testing import makerequest
> app = makerequest.makerequest(app)
> 
> 
> # method #2
> import os, sys
> sys.path.append("/apps/zope/lib/python")
> import Zope
> import time
> app=Zope.app()
> 
> 
> Once you have 'app' you can do things like:
> 
> REQUEST = app.REQUEST
> newobj =
> app.Wet.Content.Data.manage_addProduct['myProd'].manage_addmyItem(...)
> app.unrestrictedTraverse('Control_Panel/Database/ShopwiserData').manage_pack()
> 
> hth
> 
> Jonathan
> 
> 
> 


-- 
Peter Bengtsson, 
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list