Adding Folders, Scripts, and Documents Using the Command Line
Hi, How can I add Zope Objects to a website's ZODB from the Python Interactive Shell? Thanks, Joseph PCL Internet WebMail (http://www.pclnet.net)
Joseph Griffin writes:
How can I add Zope Objects to a website's ZODB from the Python Interactive Shell? Thanks, Joseph You cannot while Zope is running, unless you use ZEO. See the HowTo "Advanced Site Setup".
Dieter
Dieter, Thanks for the response. That How-To (it seems to me) was more of a administrative process (and a good one). What I would really like to do is add folders, scripts, and page templates to a ZODB database (Whether the Zope website is running is immaterial to me) as a design activity instead of going through the web interface (you know, click-wait,click-wait). If it's possible you could create a framework builder (a separate python program) that quickly deploys a set of database driven web pages based on a set of data views (far more versatile than the SQL Forms Product).In short, you would be able to *quickly* design a website based on it's data model. Joseph -----Original Message----- From: Dieter Maurer [mailto:dieter@handshake.de] Sent: Thursday, September 12, 2002 4:39 PM To: Joseph Griffin Cc: Zope Mailing List Subject: Re: [Zope] Adding Folders, Scripts, and Documents Using the Command Line Joseph Griffin writes:
How can I add Zope Objects to a website's ZODB from the Python Interactive Shell? Thanks, Joseph You cannot while Zope is running, unless you use ZEO. See the HowTo "Advanced Site Setup".
Dieter
Joseph Griffin writes:
That How-To (it seems to me) was more of a administrative process (and a good one). You are right: it is *more* administrative but nevertheless answers your problem:
In the debugging section, you find: ./zctl.py debug # the root application object is bound to 'app' # ... This means "app" is the root object of your Zope Web site. You can (usually) use attribute access to access other objects in your Zope site. You can use the standard API functions to create/modify objects in your Zope site. Do not forget to commit the transaction. I expect, you are able to import resources from Python modules (such a functions) and do more complex tasks. Look at <http://www.dieter.handshake.de/pyprojects/zope> You will find a module "debugging support". Look at its source. You will find out how you can create a REQUEST object. This is sometimes necessary, as attribute access not always gives you the same result than traversal. With a REQUEST object, you can use the "traverse" method to do real traversal. Look at the "zctl.py debug" code to learn how to avoid the interactiveness and be fully automatable. Dieter
participants (2)
-
Dieter Maurer -
Joseph Griffin