[Zope] DTML parsing outside of Zope

2005-07-28 Thread Peter Bengtsson
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?

-- 
Peter Bengtsson, 
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
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 )


Re: [Zope] DTML parsing outside of Zope

2005-07-28 Thread Jonathan


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


Re: [Zope] DTML parsing outside of Zope

2005-07-28 Thread Peter Bengtsson
 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 [EMAIL PROTECTED] wrote:
 
 - 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
 
 
 


-- 
Peter Bengtsson, 
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
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 )