----- Original Message ----- From: "Peter Bengtsson" <[EMAIL PROTECTED]>
To: <zope@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

_______________________________________________
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 )

Reply via email to