[Zope3-Users] Find the zope3 instance home directory (or the /var directory)

2007-11-06 Thread Eric Bréhault
Hello,

WIth Zope2, when I need to create or read a file in the filesystem, I
usually go in /myzopeinstance/var directory
and to find it is pretty easy:
import os
os.environ['CLIENT_HOME']

But in Zope3, CLIENT_HOME or INSTANCE_HOME are no longer provided in
os.environ

I had a look to different source code, and apparently the solution is to use
the path of the current file to get the instance home, so we have code like
this:
os.path.normpath(
os.path.join(os.path.dirname(__file__),
 os.pardir, os.pardir, os.pardir, os.pardir))

Is there any easier (and cleaner) way to do it ?

Eric BREHAULT
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Securitypolicy issues when moving to eggs

2007-11-06 Thread Jesper Petersen
Hi,I recently moved my webapp from z3.3.1 tarball to all eggs. It's working
great except for my
securitypolicy, which seems to sort of half-work. For example, earlier an
authenticated member
could view http://myhost/mysite/@@footest.html with and without the @@ but
now it's only viewable
with them. It's hard to pinpoint what does work and what doesn't but for
authenticated users, most
actions will redirect (but shouldn't) to the loginform. Security checks for
unauthenticated users seem to work as
before without problems (they can have the foo.Visitor role defined in my
roles.zcml).

In my tarball version I've setup authentication and user management pretty
much like in the latest
Worldcookery book. I.e, security settings in my package's roles.zcml and
permissions.zcml, and
a grant of the foo.Visitor role the zope.anybody principal in
etc/principals.zcml.

In my sandbox the grant of the old etc/principals.zcml was put at the end in
site.zcml. At first I got
a deprecation warning on zope.app.securitypolicy but it was easily solved by
using
zope.securitypolicy instead. I later, of course, updated configuration.zcmland
setup.py to use
zope.securitypolicy instead (with file=meta.zcml). Another deprecation I
got was for zope.configuration:

SNIP.../buildout-eggs/zope.configuration-3.4.0-py2.4.egg/zope/configuration/config.py:197:
DeprecationWarning: ZopeSecurityPolicy is deprecated. It has moved to
zope.securitypolicy.zopepolicy  This reference will be removed somedays
  obj = getattr(mod, oname)


Not sure if this is what's causing my authenticated users to fail on
accessing stuff that should
be accessible. I'm kind of stumped because don't really know what to do :)


Let me know if you need any more info

/Jesper

BTW, here's how i setup my sandbox:
$ python virtualenv env
$ cd env
$ ./bin/easy_install zopeproject
$ ./bin/easy_install zc.buildout
$ ./bin/zopeproject --no-buildout Hello
$ cd Hello
$ (Add the package index and comment out find-links):
#find-links = http://download.zope.org/distribution/
index = http://download.zope.org/zope3.4
$ ../bin/buildout bootstrap
$ ./bin/buildout

I also tried it with letting zopeproject handle the buildout and using the
default find-links in
buildout.cfg but I end up with the same problems
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Find the zope3 instance home directory (or the /var directory)

2007-11-06 Thread Stefan H. Holek
I don't think there is any way whatsoever in Zope 3. There is no  
instance home to begin with, and the os.pardir hacks don't work  
either because you can't really know where your package is installed.


Stefan


On 6. Nov 2007, at 11:02, Eric Bréhault wrote:

I had a look to different source code, and apparently the solution  
is to use
the path of the current file to get the instance home, so we have  
code like

this:
os.path.normpath(
os.path.join(os.path.dirname(__file__),
 os.pardir, os.pardir, os.pardir, os.pardir))

Is there any easier (and cleaner) way to do it ?


--
Anything that, in happening, causes itself to happen again,
happens again.  --Douglas Adams


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] zope.app.broken subscriber

2007-11-06 Thread Michael Dove
Hi,

I'm in the process of evolving a DB and have come across an issue where
the zope.app.broken classFactory isn't being used, hence broken objects
come back as Pc
PersistentBroken rather than zope.app.broken.Broken.

The installBroken handler takes care of the logistics in monkey patching
the ZODB.DB object's classFactory function when an IDatabaseOpened event
is emitted, however a reference to the original ZODB.DB.classFactory is
held by the ObjectReader created by the ZODB.Connection object when
zope.app.appsetup.bootstrap.bootStrapSubscriber is called upon a
IDatabaseOpened event.

The problem is that zope.app.zcmlfiles includes zope.app.appsetup before
zope.app.broken and so when an IDatabaseOpened event is emitted a
reference to original classFactory is held by the ObjectReader before
the DB.classFactory can be patched with the zope.app.broken classFactory.

Of course modifying zope.app.zcmlfiles.configure.zcml to include
zope.app.broken before zope.app.appsetup fixes the problem.

Seems odd for this to been an oversight so thus the question, I doing
something wrong here?

Thanks
-Michael Dove
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users