Re: [Zope-dev] Zope.app() dance with 2.7

2003-08-14 Thread Erik A . Dahl
Chris,

I took the code from zopectl that is uses to do the debug thing and 
scripts now work.  Here is the code...

import os
if (os.environ.has_key('ZOPEVERSION') and
os.environ['ZOPEVERSION'] == '2.7'):
from Zope.Startup.options import ZopeOptions
from Zope.Startup import handlers as h
from App import config
opts=ZopeOptions()

opts.configfile=os.path.join(os.environ['ZOPE_HOME'],'etc/zope.conf')
opts.realize()
h.handleConfig(opts.configroot,opts.confighandlers)
config.setConfiguration(opts.configroot)
from Zope.Startup import dropPrivileges
dropPrivileges(opts.configroot)

You need to set ZOPEVERSION to 2.7 for it to work.  Is there a better 
way to figure out the current zope version?  It would be nice if the 
Zope module had a __version__ that you could check (or is there one 
somewhere else that I missed).

I'm running this against the code from cvs but I bet it would work with 
2.7.0b1

-EAD

On Thursday, August 7, 2003, at 12:18  PM, Chris Withers wrote:

Chris McDonough wrote:
You can use zopectl debug to do this.
What about when you're not debugging?

What about scripts that pump stuff into Zope and the like?

cheers,

Chris

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Zope.app() dance with 2.7

2003-08-14 Thread Chris Withers
Chris McDonough wrote:
What about when you're not debugging?

What about scripts that pump stuff into Zope and the like?
That would be zopectl run.
Hmmm... for trivialities sake, say what I had before was a script called 
x.py:

import Zope
app = Zope.app()
app.Catalog.catalog_object(app.document1)
What would x.py need to look like now, and how would I use zopectl run 
to run it?

cheers,

Chris

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Zope.app() dance with 2.7

2003-08-14 Thread Chris Withers
Chris McDonough wrote:
You can use zopectl debug to do this.
What about when you're not debugging?

What about scripts that pump stuff into Zope and the like?

cheers,

Chris

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Zope.app() dance with 2.7

2003-08-10 Thread Chris McDonough
You can use zopectl debug to do this.  There were some problems with
this post-2.7 that are fixed in CVS having to do with user privileges,
but it should work.

- C
 
On Wed, 2003-08-06 at 12:47, Erik A.Dahl wrote:
 How does one do the old:
 
 import Zope
 app=Zope.app()
 
 Dance with 2.7?  I get the following error from dbtab:
 
 AttributeError: DefaultConfiguration instance has no attribute 'dbtab'
 
 Thanks,
 -EAD
 
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://mail.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope )
-- 
Chris McDonough [EMAIL PROTECTED]
Zope Corporation


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Zope.app() dance with 2.7

2003-08-09 Thread Chris McDonough
 You need to set ZOPEVERSION to 2.7 for it to work.  Is there a
better
 way to figure out the current zope version?  It would be nice if the
 Zope module had a __version__ that you could check (or is there
one
 somewhere else that I missed).

No, unfortunately.  A CVS checkout doesn't have a version number, and
this needs to work against CVS checkouts.  You might just check for
the presence or absence of an attribute in a try: except: (aka a
capabilities check) rather than dispatching on a version number.

  What about when you're not debugging?
 
  What about scripts that pump stuff into Zope and the like?

That would be zopectl run.

- C


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )