[Zope-Checkins] SVN: Zope/branches/2.9/ Improved logging of ConflictErrors. Now a log is made at level BLATHER
Log message for revision 40454: Improved logging of ConflictErrors. Now a log is made at level BLATHER with traceback for any conflict retried. In addition, a log is made at level ERROR for a conflict that can't be retried anymore and is returned to the browser as an error. Nothing is logged anymore at level INFO. Changed: U Zope/branches/2.9/doc/CHANGES.txt U Zope/branches/2.9/lib/python/Zope2/App/startup.py -=- Modified: Zope/branches/2.9/doc/CHANGES.txt === --- Zope/branches/2.9/doc/CHANGES.txt 2005-12-01 18:29:26 UTC (rev 40453) +++ Zope/branches/2.9/doc/CHANGES.txt 2005-12-01 18:39:12 UTC (rev 40454) @@ -24,8 +24,14 @@ Trunk only (unreleased) -Features added +Features added + - Improved logging of ConflictErrors. Now a log is made at level +BLATHER with traceback for any conflict retried. In addition, a +log is made at level ERROR for a conflict that can't be retried +anymore and is returned to the browser as an error. Nothing is +logged anymore at level INFO. + - Fixed unclear security declarations. Warn when an attempt is made to have a security declaration on a nonexistent method. Modified: Zope/branches/2.9/lib/python/Zope2/App/startup.py === --- Zope/branches/2.9/lib/python/Zope2/App/startup.py 2005-12-01 18:29:26 UTC (rev 40453) +++ Zope/branches/2.9/lib/python/Zope2/App/startup.py 2005-12-01 18:39:12 UTC (rev 40454) @@ -20,7 +20,7 @@ from App.config import getConfiguration from types import StringType, ListType from zExceptions import Unauthorized -from zLOG import LOG, WARNING, INFO, BLATHER, log_time +from zLOG import LOG, ERROR, WARNING, INFO, BLATHER, log_time from ZODB.POSException import ConflictError import transaction import AccessControl.User @@ -142,20 +142,25 @@ if t is SystemExit: raise if issubclass(t, ConflictError): -# First, we need to close the current connection. We'll -# do this by releasing the hold on it. There should be -# some sane protocol for this, but for now we'll use -# brute force: global conflict_errors conflict_errors = conflict_errors + 1 method_name = REQUEST.get('PATH_INFO', '') -err = ('ZODB conflict error at %s ' - '(%s conflicts since startup at %s)') -LOG(err % (method_name, conflict_errors, startup_time), -INFO, '') -LOG('Conflict traceback', BLATHER, '', error=sys.exc_info()) +LOG('ZODB', BLATHER, %s at %s: %s + (%s conflicts since startup at %s) +% (v.__class__.__name__, method_name, v, + conflict_errors, startup_time), +error=(t, v, traceback)) raise ZPublisher.Retry(t, v, traceback) -if t is ZPublisher.Retry: v.reraise() +if t is ZPublisher.Retry: +# An exception that can't be retried anymore +# Retrieve the original exception +try: v.reraise() +except: t, v, traceback = sys.exc_info() +# Log it as ERROR +method_name = REQUEST.get('PATH_INFO', '') +LOG('Publisher', ERROR, Unhandled %s at %s: %s +% (v.__class__.__name__, method_name, v)) +# Then fall through to display the error to the user try: log = aq_acquire(published, '__error_log__', containment=1) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/trunk/ Merged r40454 from 2.9 branch:
Log message for revision 40455: Merged r40454 from 2.9 branch: Improved logging of ConflictErrors. Now a log is made at level BLATHER with traceback for any conflict retried. In addition, a log is made at level ERROR for a conflict that can't be retried anymore and is returned to the browser as an error. Nothing is logged anymore at level INFO. Changed: U Zope/trunk/doc/CHANGES.txt U Zope/trunk/lib/python/Zope2/App/startup.py -=- Modified: Zope/trunk/doc/CHANGES.txt === --- Zope/trunk/doc/CHANGES.txt 2005-12-01 18:39:12 UTC (rev 40454) +++ Zope/trunk/doc/CHANGES.txt 2005-12-01 18:46:44 UTC (rev 40455) @@ -26,6 +26,12 @@ Features added + - Improved logging of ConflictErrors. Now a log is made at level +BLATHER with traceback for any conflict retried. In addition, a +log is made at level ERROR for a conflict that can't be retried +anymore and is returned to the browser as an error. Nothing is +logged anymore at level INFO. + - Use new-style security declarations everywhere possible. This means remove the use of __ac_permissions__, foo__roles__ and default__class_init__. A few corner cases can't be converted Modified: Zope/trunk/lib/python/Zope2/App/startup.py === --- Zope/trunk/lib/python/Zope2/App/startup.py 2005-12-01 18:39:12 UTC (rev 40454) +++ Zope/trunk/lib/python/Zope2/App/startup.py 2005-12-01 18:46:44 UTC (rev 40455) @@ -20,7 +20,7 @@ from App.config import getConfiguration from types import StringType, ListType from zExceptions import Unauthorized -from zLOG import LOG, WARNING, INFO, BLATHER, log_time +from zLOG import LOG, ERROR, WARNING, INFO, BLATHER, log_time from ZODB.POSException import ConflictError import transaction import AccessControl.User @@ -142,20 +142,25 @@ if t is SystemExit: raise if issubclass(t, ConflictError): -# First, we need to close the current connection. We'll -# do this by releasing the hold on it. There should be -# some sane protocol for this, but for now we'll use -# brute force: global conflict_errors conflict_errors = conflict_errors + 1 method_name = REQUEST.get('PATH_INFO', '') -err = ('ZODB conflict error at %s ' - '(%s conflicts since startup at %s)') -LOG(err % (method_name, conflict_errors, startup_time), -INFO, '') -LOG('Conflict traceback', BLATHER, '', error=sys.exc_info()) +LOG('ZODB', BLATHER, %s at %s: %s + (%s conflicts since startup at %s) +% (v.__class__.__name__, method_name, v, + conflict_errors, startup_time), +error=(t, v, traceback)) raise ZPublisher.Retry(t, v, traceback) -if t is ZPublisher.Retry: v.reraise() +if t is ZPublisher.Retry: +# An exception that can't be retried anymore +# Retrieve the original exception +try: v.reraise() +except: t, v, traceback = sys.exc_info() +# Log it as ERROR +method_name = REQUEST.get('PATH_INFO', '') +LOG('Publisher', ERROR, Unhandled %s at %s: %s +% (v.__class__.__name__, method_name, v)) +# Then fall through to display the error to the user try: log = aq_acquire(published, '__error_log__', containment=1) ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-Checkins] SVN: Zope/branches/tseaver-collector_1774/ Rip out the C version of 'checkPermisison' altogether
Log message for revision 40458: Rip out the C version of 'checkPermisison' altogether It was only about 11 microseconds faster than the Python version on my machine, and doesn't get called automagically the way 'validate' does. Changed: U Zope/branches/tseaver-collector_1774/doc/CHANGES.txt U Zope/branches/tseaver-collector_1774/lib/python/AccessControl/ImplC.py U Zope/branches/tseaver-collector_1774/lib/python/AccessControl/cAccessControl.c U Zope/branches/tseaver-collector_1774/lib/python/AccessControl/tests/testZopeSecurityPolicy.py -=- Modified: Zope/branches/tseaver-collector_1774/doc/CHANGES.txt === --- Zope/branches/tseaver-collector_1774/doc/CHANGES.txt2005-12-01 19:47:51 UTC (rev 40457) +++ Zope/branches/tseaver-collector_1774/doc/CHANGES.txt2005-12-01 22:21:57 UTC (rev 40458) @@ -26,6 +26,10 @@ Bugs Fixed + - AccessControl.ZopeSecurityPolicy: harmonize 'checkPermission' +with 'validate', checking ownership and proxy roles if an +executable object is on the stack. + - AccessControl.SecurityInfo: Fixed problem with setPermissionDefault when the permission wasn't used anywhere else in the class to protect methods. Modified: Zope/branches/tseaver-collector_1774/lib/python/AccessControl/ImplC.py === --- Zope/branches/tseaver-collector_1774/lib/python/AccessControl/ImplC.py 2005-12-01 19:47:51 UTC (rev 40457) +++ Zope/branches/tseaver-collector_1774/lib/python/AccessControl/ImplC.py 2005-12-01 22:21:57 UTC (rev 40458) @@ -18,7 +18,8 @@ from cAccessControl import rolesForPermissionOn, \ PermissionRole, imPermissionRole, _what_not_even_god_should_do, \ RestrictedDTMLMixin, aq_validate, guarded_getattr, \ - ZopeSecurityPolicy, setDefaultBehaviors + setDefaultBehaviors +from cAccessControl import ZopeSecurityPolicy as cZopeSecurityPolicy from cAccessControl import SecurityManager as cSecurityManager except ImportError: import sys @@ -26,12 +27,17 @@ del sys.modules[__name__] -from ImplPython import RestrictedDTML, SecurityManager +from ImplPython import RestrictedDTML, SecurityManager, ZopeSecurityPolicy class RestrictedDTML(RestrictedDTMLMixin, RestrictedDTML): A mix-in for derivatives of DT_String.String that adds Zope security. +class ZopeSecurityPolicy(cZopeSecurityPolicy, ZopeSecurityPolicy): +A security manager provides methods for checking access and managing +executable context and policies + + class SecurityManager(cSecurityManager, SecurityManager): A security manager provides methods for checking access and managing executable context and policies Modified: Zope/branches/tseaver-collector_1774/lib/python/AccessControl/cAccessControl.c === --- Zope/branches/tseaver-collector_1774/lib/python/AccessControl/cAccessControl.c 2005-12-01 19:47:51 UTC (rev 40457) +++ Zope/branches/tseaver-collector_1774/lib/python/AccessControl/cAccessControl.c 2005-12-01 22:21:57 UTC (rev 40458) @@ -337,8 +337,6 @@ */ static PyObject *ZopeSecurityPolicy_validate(PyObject *self, PyObject *args); -static PyObject *ZopeSecurityPolicy_checkPermission(PyObject *self, - PyObject *args); static void ZopeSecurityPolicy_dealloc(ZopeSecurityPolicy *self); @@ -418,11 +416,6 @@ METH_VARARGS, }, - {checkPermission, - (PyCFunction)ZopeSecurityPolicy_checkPermission, - METH_VARARGS, - - }, { NULL, NULL } }; @@ -1287,215 +1280,6 @@ /* -** ZopeSecurityPolicy_checkPermission -** -*/ - -static PyObject *ZopeSecurityPolicy_checkPermission(PyObject *self, -PyObject *args) { - -/* return value */ -PyObject *result = NULL; - -/* arguments, not increfe'd */ -PyObject *permission = NULL; -PyObject *object = NULL; -PyObject *context = NULL; - -/* locals, XDECREF at exit */ -PyObject *roles = NULL; -PyObject *user = NULL; -PyObject *stack = NULL; -PyObject *eo = NULL; -PyObject *owner = NULL; -PyObject *proxy_roles = NULL; -PyObject *method = NULL; -PyObject *wrappedowner = NULL; -PyObject *objectbase = NULL; -PyObject *incontext = NULL; - -int contains = 0; -int iRole; -int length; - -/*| def checkPermission(self, permission, object, context) -*/ - -if (unpacktuple3(args, checkPermission, 3, - permission, object, context) 0) -return NULL; - -/*| roles = rolesForPermissionOn(permission, object) -*/ - -roles = c_rolesForPermissionOn(permission, object, NULL, NULL); -if (roles == NULL) - return NULL;
[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Collector #1774: Harmonize the implemtnation of 'checkPermission' with 'validate'
Log message for revision 40459: Collector #1774: Harmonize the implemtnation of 'checkPermission' with 'validate' We now check ownership and proxy roles if an executable object is on the stack. Note that we have removed the C implementation of 'checkPermission'. Changed: U Zope/branches/Zope-2_8-branch/doc/CHANGES.txt U Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ImplC.py U Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ImplPython.py U Zope/branches/Zope-2_8-branch/lib/python/AccessControl/cAccessControl.c U Zope/branches/Zope-2_8-branch/lib/python/AccessControl/interfaces.py U Zope/branches/Zope-2_8-branch/lib/python/AccessControl/tests/testZopeSecurityPolicy.py -=- Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt === --- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2005-12-01 22:21:57 UTC (rev 40458) +++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2005-12-01 22:44:07 UTC (rev 40459) @@ -26,6 +26,11 @@ Bugs Fixed + - Collector #1774: Harmonize the implemtnation of +AccessControl.ZopeSecurityPolicy.checkPermission +with 'validate', checking ownership and proxy roles if an +executable object is on the stack. + - AccessControl.SecurityInfo: Fixed problem with setPermissionDefault when the permission wasn't used anywhere else in the class to protect methods. Modified: Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ImplC.py === --- Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ImplC.py 2005-12-01 22:21:57 UTC (rev 40458) +++ Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ImplC.py 2005-12-01 22:44:07 UTC (rev 40459) @@ -18,7 +18,8 @@ from cAccessControl import rolesForPermissionOn, \ PermissionRole, imPermissionRole, _what_not_even_god_should_do, \ RestrictedDTMLMixin, aq_validate, guarded_getattr, \ - ZopeSecurityPolicy, setDefaultBehaviors + setDefaultBehaviors +from cAccessControl import ZopeSecurityPolicy as cZopeSecurityPolicy from cAccessControl import SecurityManager as cSecurityManager except ImportError: import sys @@ -26,12 +27,17 @@ del sys.modules[__name__] -from ImplPython import RestrictedDTML, SecurityManager +from ImplPython import RestrictedDTML, SecurityManager, ZopeSecurityPolicy class RestrictedDTML(RestrictedDTMLMixin, RestrictedDTML): A mix-in for derivatives of DT_String.String that adds Zope security. +class ZopeSecurityPolicy(cZopeSecurityPolicy, ZopeSecurityPolicy): +A security manager provides methods for checking access and managing +executable context and policies + + class SecurityManager(cSecurityManager, SecurityManager): A security manager provides methods for checking access and managing executable context and policies Modified: Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ImplPython.py === --- Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ImplPython.py 2005-12-01 22:21:57 UTC (rev 40458) +++ Zope/branches/Zope-2_8-branch/lib/python/AccessControl/ImplPython.py 2005-12-01 22:44:07 UTC (rev 40459) @@ -34,6 +34,7 @@ from AccessControl import SecurityManagement from AccessControl import Unauthorized +from AccessControl.interfaces import ISecurityPolicy from AccessControl.interfaces import ISecurityManager from AccessControl.SimpleObjectPolicies import Containers, _noroles from AccessControl.ZopeGuards import guarded_getitem @@ -199,6 +200,8 @@ class ZopeSecurityPolicy: +implements(ISecurityPolicy) + def __init__(self, ownerous=1, authenticated=1, verbose=0): Create a Zope security policy. @@ -459,13 +462,42 @@ raise Unauthorized(name, value) def checkPermission(self, permission, object, context): -# XXX proxy roles and executable owner are not checked roles = rolesForPermissionOn(permission, object) if isinstance(roles, basestring): roles = [roles] + +# check executable owner and proxy roles +stack = context.stack +if stack: +eo = stack[-1] +# If the executable had an owner, can it execute? +if self._ownerous: +owner = eo.getOwner() +if (owner is not None) and not owner.allowed(object, roles): +# We don't want someone to acquire if they can't +# get an unacquired! +return 0 +proxy_roles = getattr(eo, '_proxy_roles', None) +if proxy_roles: +# Verify that the owner actually can state the proxy role +# in the context of the accessed item; users in subfolders +# should
[Zope-Checkins] SVN: Zope/branches/2.9/lib/python/AccessControl/ Forward port fix for collector #1774 from 2.8 branch.
Log message for revision 40460: Forward port fix for collector #1774 from 2.8 branch. Changed: U Zope/branches/2.9/lib/python/AccessControl/ImplC.py U Zope/branches/2.9/lib/python/AccessControl/ImplPython.py U Zope/branches/2.9/lib/python/AccessControl/cAccessControl.c U Zope/branches/2.9/lib/python/AccessControl/interfaces.py U Zope/branches/2.9/lib/python/AccessControl/tests/testZopeSecurityPolicy.py -=- Modified: Zope/branches/2.9/lib/python/AccessControl/ImplC.py === --- Zope/branches/2.9/lib/python/AccessControl/ImplC.py 2005-12-01 22:44:07 UTC (rev 40459) +++ Zope/branches/2.9/lib/python/AccessControl/ImplC.py 2005-12-01 22:45:00 UTC (rev 40460) @@ -18,7 +18,8 @@ from cAccessControl import rolesForPermissionOn, \ PermissionRole, imPermissionRole, _what_not_even_god_should_do, \ RestrictedDTMLMixin, aq_validate, guarded_getattr, \ - ZopeSecurityPolicy, setDefaultBehaviors + setDefaultBehaviors +from cAccessControl import ZopeSecurityPolicy as cZopeSecurityPolicy from cAccessControl import SecurityManager as cSecurityManager except ImportError: import sys @@ -26,12 +27,17 @@ del sys.modules[__name__] -from ImplPython import RestrictedDTML, SecurityManager +from ImplPython import RestrictedDTML, SecurityManager, ZopeSecurityPolicy class RestrictedDTML(RestrictedDTMLMixin, RestrictedDTML): A mix-in for derivatives of DT_String.String that adds Zope security. +class ZopeSecurityPolicy(cZopeSecurityPolicy, ZopeSecurityPolicy): +A security manager provides methods for checking access and managing +executable context and policies + + class SecurityManager(cSecurityManager, SecurityManager): A security manager provides methods for checking access and managing executable context and policies Modified: Zope/branches/2.9/lib/python/AccessControl/ImplPython.py === --- Zope/branches/2.9/lib/python/AccessControl/ImplPython.py2005-12-01 22:44:07 UTC (rev 40459) +++ Zope/branches/2.9/lib/python/AccessControl/ImplPython.py2005-12-01 22:45:00 UTC (rev 40460) @@ -34,6 +34,7 @@ from AccessControl import SecurityManagement from AccessControl import Unauthorized +from AccessControl.interfaces import ISecurityPolicy from AccessControl.interfaces import ISecurityManager from AccessControl.SimpleObjectPolicies import Containers, _noroles from AccessControl.ZopeGuards import guarded_getitem @@ -199,6 +200,8 @@ class ZopeSecurityPolicy: +implements(ISecurityPolicy) + def __init__(self, ownerous=1, authenticated=1, verbose=0): Create a Zope security policy. @@ -459,13 +462,42 @@ raise Unauthorized(name, value) def checkPermission(self, permission, object, context): -# XXX proxy roles and executable owner are not checked roles = rolesForPermissionOn(permission, object) if isinstance(roles, basestring): roles = [roles] + +# check executable owner and proxy roles +stack = context.stack +if stack: +eo = stack[-1] +# If the executable had an owner, can it execute? +if self._ownerous: +owner = eo.getOwner() +if (owner is not None) and not owner.allowed(object, roles): +# We don't want someone to acquire if they can't +# get an unacquired! +return 0 +proxy_roles = getattr(eo, '_proxy_roles', None) +if proxy_roles: +# Verify that the owner actually can state the proxy role +# in the context of the accessed item; users in subfolders +# should not be able to use proxy roles to access items +# above their subfolder! +owner = eo.getWrappedOwner() +if owner is not None: +if object is not aq_base(object): +if not owner._check_context(object): +# object is higher up than the owner, +# deny access +return 0 + +for r in proxy_roles: +if r in roles: +return 1 +return 0 + return context.user.allowed(object, roles) - # AccessControl.SecurityManager # - Modified: Zope/branches/2.9/lib/python/AccessControl/cAccessControl.c === --- Zope/branches/2.9/lib/python/AccessControl/cAccessControl.c 2005-12-01 22:44:07 UTC (rev 40459) +++ Zope/branches/2.9/lib/python/AccessControl/cAccessControl.c 2005-12-01 22:45:00 UTC (rev 40460) @@ -337,8 +337,6 @@ */ static PyObject *ZopeSecurityPolicy_validate(PyObject *self, PyObject *args);
[Zope-Checkins] SVN: Zope/trunk/lib/python/AccessControl/ Forward port fix for collector #1774 from 2.8 branch.
Log message for revision 40461: Forward port fix for collector #1774 from 2.8 branch. Changed: U Zope/trunk/lib/python/AccessControl/ImplC.py U Zope/trunk/lib/python/AccessControl/ImplPython.py U Zope/trunk/lib/python/AccessControl/cAccessControl.c U Zope/trunk/lib/python/AccessControl/interfaces.py U Zope/trunk/lib/python/AccessControl/tests/testZopeSecurityPolicy.py -=- Modified: Zope/trunk/lib/python/AccessControl/ImplC.py === --- Zope/trunk/lib/python/AccessControl/ImplC.py2005-12-01 22:45:00 UTC (rev 40460) +++ Zope/trunk/lib/python/AccessControl/ImplC.py2005-12-01 22:45:54 UTC (rev 40461) @@ -18,7 +18,8 @@ from cAccessControl import rolesForPermissionOn, \ PermissionRole, imPermissionRole, _what_not_even_god_should_do, \ RestrictedDTMLMixin, aq_validate, guarded_getattr, \ - ZopeSecurityPolicy, setDefaultBehaviors + setDefaultBehaviors +from cAccessControl import ZopeSecurityPolicy as cZopeSecurityPolicy from cAccessControl import SecurityManager as cSecurityManager except ImportError: import sys @@ -26,12 +27,17 @@ del sys.modules[__name__] -from ImplPython import RestrictedDTML, SecurityManager +from ImplPython import RestrictedDTML, SecurityManager, ZopeSecurityPolicy class RestrictedDTML(RestrictedDTMLMixin, RestrictedDTML): A mix-in for derivatives of DT_String.String that adds Zope security. +class ZopeSecurityPolicy(cZopeSecurityPolicy, ZopeSecurityPolicy): +A security manager provides methods for checking access and managing +executable context and policies + + class SecurityManager(cSecurityManager, SecurityManager): A security manager provides methods for checking access and managing executable context and policies Modified: Zope/trunk/lib/python/AccessControl/ImplPython.py === --- Zope/trunk/lib/python/AccessControl/ImplPython.py 2005-12-01 22:45:00 UTC (rev 40460) +++ Zope/trunk/lib/python/AccessControl/ImplPython.py 2005-12-01 22:45:54 UTC (rev 40461) @@ -34,6 +34,7 @@ from AccessControl import SecurityManagement from AccessControl import Unauthorized +from AccessControl.interfaces import ISecurityPolicy from AccessControl.interfaces import ISecurityManager from AccessControl.SimpleObjectPolicies import Containers, _noroles from AccessControl.ZopeGuards import guarded_getitem @@ -199,6 +200,8 @@ class ZopeSecurityPolicy: +implements(ISecurityPolicy) + def __init__(self, ownerous=1, authenticated=1, verbose=0): Create a Zope security policy. @@ -459,13 +462,42 @@ raise Unauthorized(name, value) def checkPermission(self, permission, object, context): -# XXX proxy roles and executable owner are not checked roles = rolesForPermissionOn(permission, object) if isinstance(roles, basestring): roles = [roles] + +# check executable owner and proxy roles +stack = context.stack +if stack: +eo = stack[-1] +# If the executable had an owner, can it execute? +if self._ownerous: +owner = eo.getOwner() +if (owner is not None) and not owner.allowed(object, roles): +# We don't want someone to acquire if they can't +# get an unacquired! +return 0 +proxy_roles = getattr(eo, '_proxy_roles', None) +if proxy_roles: +# Verify that the owner actually can state the proxy role +# in the context of the accessed item; users in subfolders +# should not be able to use proxy roles to access items +# above their subfolder! +owner = eo.getWrappedOwner() +if owner is not None: +if object is not aq_base(object): +if not owner._check_context(object): +# object is higher up than the owner, +# deny access +return 0 + +for r in proxy_roles: +if r in roles: +return 1 +return 0 + return context.user.allowed(object, roles) - # AccessControl.SecurityManager # - Modified: Zope/trunk/lib/python/AccessControl/cAccessControl.c === --- Zope/trunk/lib/python/AccessControl/cAccessControl.c2005-12-01 22:45:00 UTC (rev 40460) +++ Zope/trunk/lib/python/AccessControl/cAccessControl.c2005-12-01 22:45:54 UTC (rev 40461) @@ -337,8 +337,6 @@ */ static PyObject *ZopeSecurityPolicy_validate(PyObject *self, PyObject *args); -static PyObject *ZopeSecurityPolicy_checkPermission(PyObject *self, -
[Zope-Checkins] SVN: Zope/branches/tseaver-collector_1774/ Merged to 2.8 branch, 2.9 branch, and the trunk.
Log message for revision 40462: Merged to 2.8 branch, 2.9 branch, and the trunk. Changed: D Zope/branches/tseaver-collector_1774/ -=- ___ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins
[Zope-dev] Re: [CMF-checkins] SVN: CMF/trunk/ CMFSetup is dead. Long live GenericSetup!
I'm probably missing something, hence my asking. If GenericSetup is generic, why is it in the CMF repository? Sure, bundle it with CMF, like BTreeFolder2 used to be, but why not also release it seperately and have it in its own repo? cheers, Chris Yvo Schubbe wrote: Log message for revision 40429: CMFSetup is dead. Long live GenericSetup! - removed obsolete CMFSetup product - added bbb code and __module_aliases__ to support setup tools created with CMFSetup Changed: U CMF/trunk/CHANGES.txt D CMF/trunk/CMFSetup/ U CMF/trunk/GenericSetup/__init__.py A CMF/trunk/GenericSetup/bbb/ A CMF/trunk/GenericSetup/bbb/__init__.py A CMF/trunk/GenericSetup/bbb/registry.py A CMF/trunk/GenericSetup/bbb/tool.py -=- Modified: CMF/trunk/CHANGES.txt === --- CMF/trunk/CHANGES.txt 2005-11-30 12:47:07 UTC (rev 40428) +++ CMF/trunk/CHANGES.txt 2005-11-30 22:12:58 UTC (rev 40429) @@ -43,7 +43,7 @@ - ActionsTool: Improved add form for 'CMF Action' objects. Presettings can now be loaded from Action settings in setup profiles. -- CMFSetup and GenericSetup: Added catalog tool setup handlers. +- CMFCore and GenericSetup: Added catalog tool setup handlers. This includes node adapters for PluginIndexes, ZCTextIndex and ZCatalog. Support for additional indexes can be added by providing INodeExporter and INodeImporter adapters. All indexes are cleared by this handler, so @@ -87,7 +87,7 @@ - Replaced user messages by MassageIDs to improve the i18n support. -- CMFDefault CMFSetup profile: Added CMF BTree Folder to the list of +- CMFDefault GenericSetup profile: Added CMF BTree Folder to the list of automatically instantiated types in the types tool. (http://www.zope.org/Collectors/CMF/371) @@ -117,9 +117,6 @@ Bug Fixes -- CMFSetup: fixed empty attribute parsing when an encoding is - defined. - - ActionProviderBase: getActionObject did stumble over newstyle Actions. - CMFCore.exportimport.content: Ensure that BODYFILE in our faux @@ -163,6 +160,9 @@ Others +- CMFSetup and GenericSetup: Removed obsolete CMFSetup product. + Added __module_aliases__ to support setup tools created with CMFSetup. + - DCWorkflow: Removed hardcoded default workflows. - Workflow: Removed deprecated WorkflowInformation and getActionsFor. Modified: CMF/trunk/GenericSetup/__init__.py === --- CMF/trunk/GenericSetup/__init__.py 2005-11-30 12:47:07 UTC (rev 40428) +++ CMF/trunk/GenericSetup/__init__.py 2005-11-30 22:12:58 UTC (rev 40429) @@ -24,3 +24,15 @@ interfaces=None, icon='www/tool.png', ) + +# BBB: for setup tools created with CMF 1.5 if CMFSetup isn't installed +try: +import Products.CMFSetup +except ImportError: +import bbb +import bbb.registry +import bbb.tool + +__module_aliases__ = (('Products.CMFSetup', bbb), + ('Products.CMFSetup.registry', bbb.registry), + ('Products.CMFSetup.tool', bbb.tool)) Copied: CMF/trunk/GenericSetup/bbb/__init__.py (from rev 40417, CMF/trunk/CMFSetup/__init__.py) === --- CMF/trunk/CMFSetup/__init__.py 2005-11-29 20:40:33 UTC (rev 40417) +++ CMF/trunk/GenericSetup/bbb/__init__.py 2005-11-30 22:12:58 UTC (rev 40429) @@ -0,0 +1,16 @@ +## +# +# Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED AS IS AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +## + CMFSetup product initialization. + +$Id$ + Copied: CMF/trunk/GenericSetup/bbb/registry.py (from rev 40417, CMF/trunk/CMFSetup/registry.py) Copied: CMF/trunk/GenericSetup/bbb/tool.py (from rev 40417, CMF/trunk/CMFSetup/tool.py) ___ CMF-checkins mailing list CMF-checkins@zope.org http://mail.zope.org/mailman/listinfo/cmf-checkins -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
Re: [Zope-dev] DateTime iso8601 bad handling of dates
Evan Simpson wrote: It was asserted, last time this came up, that this is compliant with the ISO8601 spec, but my own research shows this to be false. If someone can point me to a truly authoritative source that supports the current behavior, I would appreciate it, but that would not change the fact that the manifested behavior is *broken*. This is a simple two-line fix, folks. I've already done it on my production systems. Philipp is your man for this, since he's biting the bullet on the DateTime front... Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org 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] Folderish or SimpleItem object types for structural content
Martijn Jacobs wrote: catalog. The estimation about the amount of objects, with only the leave nodes as 'SimpleItem' objects will be 30.000. 30,000 is nothing. The production catalog on one of my projects has 220,000 objects in it, and I still wouldn't class that as huge. cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org 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] Re: DateTime mess
Andreas Jung wrote: For people it might be more comfortable to have a on-the-fly migration somehow under the hood...however this leads to ugly migration code in the sources (Zope is full of such scary code). Personally I prefer a dedicated migration step. + lotz Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org 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.conf extensibility
Fred Drake wrote: I don't know that there's any real documentation for this. Feel free to add some. In this case, I think zopeschema.xml should be documentation enough, especially as any product author wanting to use this feature is going to have to write a component.xml at least ;-) cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Zope-Dev maillist - Zope-Dev@zope.org 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] Zope tests: 8 OK
Summary of messages to the zope-tests list. Period Wed Nov 30 12:01:02 2005 UTC to Thu Dec 1 12:01:02 2005 UTC. There were 8 messages: 8 from Zope Unit Tests. Tests passed OK --- Subject: OK : Zope-2_6-branch Python-2.1.3 : Linux From: Zope Unit Tests Date: Wed Nov 30 22:15:17 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-November/003682.html Subject: OK : Zope-2_6-branch Python-2.3.5 : Linux From: Zope Unit Tests Date: Wed Nov 30 22:16:47 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-November/003683.html Subject: OK : Zope-2_7-branch Python-2.3.5 : Linux From: Zope Unit Tests Date: Wed Nov 30 22:18:17 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-November/003684.html Subject: OK : Zope-2_7-branch Python-2.4.2 : Linux From: Zope Unit Tests Date: Wed Nov 30 22:19:47 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-November/003685.html Subject: OK : Zope-2_8-branch Python-2.3.5 : Linux From: Zope Unit Tests Date: Wed Nov 30 22:21:17 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-November/003686.html Subject: OK : Zope-2_8-branch Python-2.4.2 : Linux From: Zope Unit Tests Date: Wed Nov 30 22:22:47 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-November/003687.html Subject: OK : Zope-2_9-branch Python-2.4.2 : Linux From: Zope Unit Tests Date: Wed Nov 30 22:24:17 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-November/003688.html Subject: OK : Zope-trunk Python-2.4.2 : Linux From: Zope Unit Tests Date: Wed Nov 30 22:25:47 EST 2005 URL: http://mail.zope.org/pipermail/zope-tests/2005-November/003689.html ___ Zope-Dev maillist - Zope-Dev@zope.org 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.conf extensibility
On 12/1/05, Chris Withers [EMAIL PROTECTED] wrote: In this case, I think zopeschema.xml should be documentation enough, especially as any product author wanting to use this feature is going to have to write a component.xml at least ;-) Actually, a product author isn't required to write a component.xml, though they probably should for anything interesting. -Fred -- Fred L. Drake, Jr.fdrake at gmail.com There is no wealth but life. --John Ruskin ___ Zope-Dev maillist - Zope-Dev@zope.org 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] Re: [Zope3-dev] RFC: Reunite Zope 2 and Zope 3 in the source code repository
On Nov 30, 2005, at 2:18 PM, Chris Withers wrote: Gary Poster wrote: Zope 2 depends on Zope 3, via Five. Zope 3 does not depend on Zope 2. A very good point, but one which makes me feel that Zope 2 shouldn't be merged in with Zope 3 ;-) Actually, yes, all of my points were made to that end--so AFAICT you are agreeing with me, not disagreeing. :-) Gary ___ Zope-Dev maillist - Zope-Dev@zope.org 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] Short tutorial on I18n with Five
I'm happy to announce that I've finally managed to document the internationalization (i18n) features that Five has brought to the Zope 2 world since version 1.1: http://worldcookery.com/files/fivei18n This short tutorial compares current Zope-2-based solutions to the i18n problem with the Zope 3 i18n framework. It also gives a few pointers on how to use the latter in Zope 2 applications through the means of Five. It is not a full-blown tutorial and it expects the reader to be quite familiar with i18n-aware software development in Zope already. Target audience is mostly people switching over their Zope 2 products to Zope 3 technology which i18n is a part of. The tutorial also serves as a documentation of a new Zope 2 core feature because Five 1.3 is included in Zope 2.9 which is thus the first Zope 2 version to come with built-in i18n support! ___ Zope-Dev maillist - Zope-Dev@zope.org 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] Logging of ConflictError
I've improved the logging of ConflictError in Zope 2.9 and trunk. http://svn.zope.org/?rev=40454view=rev Now you'll get two things: - logs at level BLATHER for each conflict, but it may be retried - log at level ERROR when the conflict can't be retried anymore and is returned to the browser as an error. I removed the log at level INFO because it is very misleading for system administrators in my experience. Do people want this also for 2.8? Note that it changes the log format, so may break third party tools that parse logs. Florent -- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of RD +33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED] ___ Zope-Dev maillist - Zope-Dev@zope.org 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] Re: Logging of ConflictError
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Florent Guillaume wrote: I've improved the logging of ConflictError in Zope 2.9 and trunk. http://svn.zope.org/?rev=40454view=rev Now you'll get two things: - logs at level BLATHER for each conflict, but it may be retried - log at level ERROR when the conflict can't be retried anymore and is returned to the browser as an error. I removed the log at level INFO because it is very misleading for system administrators in my experience. Do people want this also for 2.8? Note that it changes the log format, so may break third party tools that parse logs. +1. Tres. - -- === Tres Seaver +1 202-558-7113 [EMAIL PROTECTED] Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDj0kX+gerLs4ltQ4RAjRvAJsHXdNzYc9AAXxoWQQYk5FPNzC9RwCdHgRa 7vgGgKQCJEmSXIrl3Jwzq1k= =ota4 -END PGP SIGNATURE- ___ Zope-Dev maillist - Zope-Dev@zope.org 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] Re: Logging of ConflictError
On Thu, Dec 01, 2005 at 02:03:51PM -0500, Tres Seaver wrote: Do people want this also for 2.8? Note that it changes the log format, so may break third party tools that parse logs. +1. +1 from me too, the added information is worth potential tool breakage IMO. Just put an obvious note in CHANGES.txt as usual. -- Paul Winkler http://www.slinkp.com ___ Zope-Dev maillist - Zope-Dev@zope.org 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] Logging of ConflictError
+1 On Dec 1, 2005, at 1:49 PM, Florent Guillaume wrote: I've improved the logging of ConflictError in Zope 2.9 and trunk. http://svn.zope.org/?rev=40454view=rev Now you'll get two things: - logs at level BLATHER for each conflict, but it may be retried - log at level ERROR when the conflict can't be retried anymore and is returned to the browser as an error. I removed the log at level INFO because it is very misleading for system administrators in my experience. Do people want this also for 2.8? Note that it changes the log format, so may break third party tools that parse logs. Florent -- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of RD +33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED] ___ Zope-Dev maillist - Zope-Dev@zope.org 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 - Zope-Dev@zope.org 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] KeyError: 'URL' in HTTPRequest using zope2.7-py2.3.3
hello all, i'm running into a wierd zope/plone error. it is the same error as the RESPONSE eaten post at: http://mail.zope.org/pipermail/zope-dev/2003-November/020952.html i asked the poster for help since there were no followups, but unfortunately he would not help me and told me he was not my personal helpdesk. these posters had a similar issue/solution: http://mail.zope.org/pipermail/zope-dev/2004-February/021793.html but i cannot find a similar culprit. any help would be much appreciated. below is my traceback. thanks a million, brian w. Traceback (most recent call last): File E:\NBCJEAP\Zope\lib\python\zExceptions\ExceptionFormatter.py, line 157, in formatLine result.extend(self.formatSupplement(supp, tb)) File E:\NBCJEAP\Zope\lib\python\zExceptions\ExceptionFormatter.py, line 105, in formatSupplement extra = self.formatExtraInfo(supplement) File E:\NBCJEAP\Zope\lib\python\zExceptions\ExceptionFormatter.py, line 231, in formatExtraInfo extra = getInfo(1) File E:\NBCJEAP\Zope\lib\python\Products\PageTemplates\TALES.py, line 277, i n getInfo s = pprint.pformat(data) File E:\NBCJEAP\Python\lib\pprint.py, line 58, in pformat return PrettyPrinter().pformat(object) File E:\NBCJEAP\Python\lib\pprint.py, line 109, in pformat self._format(object, sio, 0, 0, {}, 0) File E:\NBCJEAP\Python\lib\pprint.py, line 127, in _format rep = self._repr(object, context, level - 1) File E:\NBCJEAP\Python\lib\pprint.py, line 191, in _repr self._depth, level) File E:\NBCJEAP\Python\lib\pprint.py, line 203, in format return _safe_repr(object, context, maxlevels, level) File E:\NBCJEAP\Python\lib\pprint.py, line 246, in _safe_repr vrepr, vreadable, vrecur = saferepr(v, context, maxlevels, level) File E:\NBCJEAP\Python\lib\pprint.py, line 286, in _safe_repr rep = `object` File E:\NBCJEAP\Zope\lib\python\ZPublisher\HTTPRequest.py, line 1295, in __r epr__ return %s, URL=%s % (self.__class__.__name__, self['URL']) File E:\NBCJEAP\Zope\lib\python\ZPublisher\HTTPRequest.py, line 1214, in __g etitem__ raise KeyError, key KeyError: 'URL' -- ___ Play 100s of games for FREE! http://games.mail.com/ ___ Zope-Dev maillist - Zope-Dev@zope.org 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] Re: Python2.4 Security Audit ETA???
Hi, Am Mittwoch, den 30.11.2005, 15:52 +0100 schrieb Philipp von Weitershausen: Andreas Jung wrote: Let's say it this way: it's safer than with Zope 2.8.3 but it is still not supported :-) From where I'm standing, with Zope 2.8.4 it's as safe as with Zope 2.9 (which actually *requires* Python 2.4...) So it is really just a label we put on the 2.8 and 2.9 branches, in terms of the relevant code base they're the same... Statements like that are *dangerous*. The label is all that it is about. It is against the possibility that although the likely relevant code base is the same, there might be some minor minor minor switch that makes everything burn. There are _several_ major linux distributions out there that already ignore this label and shipped Zope with Python 2.4. It's not helpful to argue them out of that if we don't care for the label ourselves. Christian -- gocept gmbh co. kg - schalaunische str. 6 - 06366 koethen - germany www.gocept.com - [EMAIL PROTECTED] - phone +49 3496 30 99 112 - fax +49 3496 30 99 118 - zope and plone consulting and development signature.asc Description: This is a digitally signed message part ___ Zope-Dev maillist - Zope-Dev@zope.org 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-PAS] Re: Multiple principals with the same ID
Is anyone against removing that assertion? - -1. Asserts only affect debug mode, anyway, which means that they help find problems. FWIW, this is not true. Asserts happen outside of debug mode unless you've compiled somehow to .pyo's. ___ Zope-PAS mailing list Zope-PAS@zope.org http://mail.zope.org/mailman/listinfo/zope-pas
[Zope] dtml2zpt
Dear zopist I am trying to pick up zpt. Is there an equivalent command in zpt for dtml-call RESPONSE.redirect('home_page'). Thank you. __ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ ___ 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] dtml2zpt
--On 1. Dezember 2005 00:02:07 -0800 Infor Gates [EMAIL PROTECTED] wrote: Dear zopist I am trying to pick up zpt. Is there an equivalent command in zpt for dtml-call RESPONSE.redirect('home_page'). tal:call define=dummy python: request.RESPONSE.redirect(...) / pgpeS5xZTeyAJ.pgp Description: PGP signature ___ 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] dtml2zpt
Andreas Jung schrieb: --On 1. Dezember 2005 00:02:07 -0800 Infor Gates [EMAIL PROTECTED] wrote: Dear zopist I am trying to pick up zpt. Is there an equivalent command in zpt for dtml-call RESPONSE.redirect('home_page'). tal:call define=dummy python: request.RESPONSE.redirect(...) / Ferkel! ;)) ___ 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] Displaying pdf
Peter Bengtsson wrote: pdffile = getattr(context, 'some.pdf') return pdffile I think you'd have to set a content-disposition header if you did that... cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ 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] Creating a DTM Document in a variable folder.
Jonathan Cyr wrote: You might want to use index_html rather than index.html in this example. The dot means other things in Python, and index.html is a carryover from filesystem webservers. My impression is that the acquisition mechanism doesn't like ids with a dot, in some circumstances. Acquisition works fine irrespective of the object id. And dotted or dashed names work fine in ZPT path: tal:content=here/my-folder/index.html/title If you use python, most objectmanagers support dictionary-like notation: tal:content=python:here['my-folder']['index.html'].title ...and if you object doesn't support dictionary-like notation, you can use getattr: getattr(getattr(here,'my-folder'),'index.html').title And getattr performs Acquisition just fine... cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ 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] Creating a DTM Document in a variable folder.
J Cameron Cooper wrote: self.plone['try-me'] or getattr (which doesn't use acquisition.) Eh? What on earth gave you that idea? Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ 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] Displaying pdf
On 12/1/05, Chris Withers [EMAIL PROTECTED] wrote: Peter Bengtsson wrote: pdffile = getattr(context, 'some.pdf') return pdffile I think you'd have to set a content-disposition header if you did that... Surely the File object that this 'some.pdf' is has all of this taken care of in its index_html() cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk -- 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 )
[Zope] Re: PHPGateway Issues
Hello Wei. Okay, please keep me posted when you determine what the problem is. If anyone else on the Zope group has experienced a similar problem, please let me know. Thanks. On Thu, 1 Dec 2005, Wei He wrote: Quoting Asad Habib [EMAIL PROTECTED]: Hello. The message came from Mac OS X. Also, how do I resolve this issue? I am currently also running phpMyAdmin so I know for a fact the PHP-CGI is present. Also, PHP is currently running on its own (i.e. not behind Apache). It looks like I'll have to get a Mac OS X box to find out how PHP is running on it. Will take some time. Best, -- Wei He IT Manager IED (Institute for Environment Development) Tel: +86-10-51319216 Web: http://www.ied.org.cn ___ 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] Re: PHPGateway Issues
Okay, so now I am getting the following error when trying to serve phpmyadmin via PHPGateway: File not found! The URL you have loaded has not been found on this server. The docroot is set to '/Library/WebServer/Documents/phpmyadmin' and phpmyadmin has an index.php file. Any help would be greatly appreciated. - Asad On Thu, 1 Dec 2005, Asad Habib wrote: Hello Wei. Okay, please keep me posted when you determine what the problem is. If anyone else on the Zope group has experienced a similar problem, please let me know. Thanks. On Thu, 1 Dec 2005, Wei He wrote: Quoting Asad Habib [EMAIL PROTECTED]: Hello. The message came from Mac OS X. Also, how do I resolve this issue? I am currently also running phpMyAdmin so I know for a fact the PHP-CGI is present. Also, PHP is currently running on its own (i.e. not behind Apache). It looks like I'll have to get a Mac OS X box to find out how PHP is running on it. Will take some time. Best, -- Wei He IT Manager IED (Institute for Environment Development) Tel: +86-10-51319216 Web: http://www.ied.org.cn ___ 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 ) ___ 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] Creating a DTM Document in a variable folder.
On Thu, Dec 01, 2005 at 07:40:38AM +, Chris Withers wrote: Jonathan Cyr wrote: You might want to use index_html rather than index.html in this example. The dot means other things in Python, and index.html is a carryover from filesystem webservers. My impression is that the acquisition mechanism doesn't like ids with a dot, in some circumstances. Acquisition works fine irrespective of the object id. And dotted or dashed names work fine in ZPT path: tal:content=here/my-folder/index.html/title If you use python, most objectmanagers support dictionary-like notation: tal:content=python:here['my-folder']['index.html'].title ...and if you object doesn't support dictionary-like notation, you can use getattr: getattr(getattr(here,'my-folder'),'index.html').title And getattr performs Acquisition just fine... ... but __getitem__ doesn't :-) So here['my-folder']['index.html'] is semantically different from getattr(getattr(here, 'my-folder'), 'index.html'). The former works strictly by local containment and does not use acquisition. The latter may use acquisition. I know Chris knows this, but maybe other people following along don't. p.s. here should be deprecated, use context instead. -- Paul Winkler http://www.slinkp.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 )
[Zope] Re: PHPGateway Issues
I think I may have to compile PHP with the 'cgi-recirect' option enabled. I created a PHParser object, placed a 'Hello World' PHP script in it, and then tried to view it. I got the same error as before: '/usr/bin/php' may not be a PHP-CGI program. The result from the program is empty(0 byte). Do you know if this will interfere with the Apache PHP module in any way? Also, it is okay to have two PHP's installed on a single machine? And what are the security implications of running PHP this way? Thanks. On Thu, 1 Dec 2005, Wei He wrote: Hi, '[EMAIL PROTECTED]' is a mailing list of some PHParser/PHPGateway users. Does anyone on the list have some experiences on running PHParser on Mac OS X? Quoting Asad Habib [EMAIL PROTECTED]: Hello Wei. Okay, please keep me posted when you determine what the problem is. If anyone else on the Zope group has experienced a similar problem, please let me know. Thanks. On Thu, 1 Dec 2005, Wei He wrote: Quoting Asad Habib [EMAIL PROTECTED]: Hello. The message came from Mac OS X. Also, how do I resolve this issue? I am currently also running phpMyAdmin so I know for a fact the PHP-CGI is present. Also, PHP is currently running on its own (i.e. not behind Apache). It looks like I'll have to get a Mac OS X box to find out how PHP is running on it. Will take some time. Best, -- Wei He IT Manager IED (Institute for Environment Development) Tel: +86-10-51319216 Web: http://www.ied.org.cn -- Wei He IT Manager IED (Institute for Environment Development) Tel: +86-10-51319216 Web: http://www.ied.org.cn ___ 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 )
[Zope] Python Classes and Zope.
There's a way to use a Python class inside zope? For instance, if I create the class: class MyClass: A simple example class i = 12345 def f(self): return 'hello world' Can I invoke the following code inside a Python Script? x = MyClass() x.f() I'm using zope 2.7.x series. Thanks in advance. Fernando Lujan ___ 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] Python Classes and Zope.
On 12/1/05, Fernando Lujan [EMAIL PROTECTED] wrote: There's a way to use a Python class inside zope? For instance, if I create the class: class MyClass: A simple example class i = 12345 def f(self): return 'hello world' Can I invoke the following code inside a Python Script? x = MyClass() x.f() Any Python code can be used from a Python Script, as long as it has been marked safe for importing into a restricted code. So, yes, you can define your Python class in a Product, but you must mark it safe for use in scripts. You can then import your code into the script and use it there. In lib/python/Products/PythonScripts/module_access_examples.py you'll find a series of examples that explain how to mark code safe for use in restricted code. Martijn Pieters ___ 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] Python Classes and Zope.
--On 1. Dezember 2005 13:46:55 -0200 Fernando Lujan [EMAIL PROTECTED] wrote: There's a way to use a Python class inside zope? For instance, if I create the class: class MyClass: A simple example class i = 12345 def f(self): return 'hello world' Can I invoke the following code inside a Python Script? x = MyClass() x.f() PythonScripts are for *scripting* not for implementing complex logic and for programming tasks that require classes. PythonScripts don't provide full Python functionality that why were are talking of *Restriced Python*. Consider writing your functionality as Python product. -aj pgpoQ5PUjvcGD.pgp Description: PGP signature ___ 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] Python Classes and Zope.
PythonScripts are for *scripting* not for implementing complex logic and for programming tasks that require classes. PythonScripts don't provide full Python functionality that why were are talking of *Restriced Python*. Consider writing your functionality as Python product. And sometimes a supporting class or function makes such code all the simpler. Knowing how to enable Python code to be imported into scripts is an essential tool. -- Martijn Pieters ___ 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] Python Classes and Zope.
Sure you can. It's usually called a python product and there are tutorials and examples you can download from zope.org The core principle is to inherit from one of the zope classes that you can find in zope/lib/python/OFS such as Folder, SimpleItem or UniqueItem. When you do that you can save instances persistently in the ZODB. Good luck. On 12/1/05, Fernando Lujan [EMAIL PROTECTED] wrote: There's a way to use a Python class inside zope? For instance, if I create the class: class MyClass: A simple example class i = 12345 def f(self): return 'hello world' Can I invoke the following code inside a Python Script? x = MyClass() x.f() I'm using zope 2.7.x series. Thanks in advance. Fernando Lujan ___ 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 ) -- 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] Python Classes and Zope.
--On 1. Dezember 2005 17:00:09 +0100 Martijn Pieters [EMAIL PROTECTED] wrote: PythonScripts are for *scripting* not for implementing complex logic and for programming tasks that require classes. PythonScripts don't provide full Python functionality that why were are talking of *Restriced Python*. Consider writing your functionality as Python product. And sometimes a supporting class or function makes such code all the simpler. Knowing how to enable Python code to be imported into scripts is an essential tool. Sure you can but you shouldn't..you start with one class and at the end you have an application with tons of such codeyou can program that way but you shouldn't :-) -aj pgpzjVZZc45hF.pgp Description: PGP signature ___ 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] Displaying pdf
Peter Bengtsson wrote: I think you'd have to set a content-disposition header if you did that... Surely the File object that this 'some.pdf' is has all of this taken care of in its index_html() No, OFS.Image.File sets no content-disposition header. cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ 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] Python Classes and Zope.
Andreas Jung wrote: Sure you can but you shouldn't..you start with one class and at the end you have an application with tons of such codeyou can program that way but you shouldn't :-) I will print and read the Developer Book... ;) Thanks for all replies. Fernando Lujan ___ 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 )
[Zope] index_object() and bobobase_modification_time with different ZCatalogs
Hello, does anybody knows a different possibility to beware the bobobase_modification_time of the given object from the following code? def my_index_object(object, catalogs=['myPointerCatalog', 'mySearchCatalog']): for cat in catalogs: object.default_catalog = cat object.index_object() # set back to default object.default_catalog = 'Catalog' regards jens ___ 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] index_object() and bobobase_modification_time with different ZCatalogs
On Thu, Dec 01, 2005 at 04:44:41PM +, [EMAIL PROTECTED] wrote: Hello, does anybody knows a different possibility to beware the bobobase_modification_time of the given object from the following code? def my_index_object(object, catalogs=['myPointerCatalog', 'mySearchCatalog']): for cat in catalogs: object.default_catalog = cat object.index_object() # set back to default object.default_catalog = 'Catalog' I don't know what beware means in this context. If you are asking whether it is possible to avoid changing bobobase_modification_time, the answer is no. ZODB updates bobobase_modification_time on any change to a persistent object, and there is nothing you can do to avoid this. -- Paul Winkler http://www.slinkp.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 )
[Zope] How to Update files that are already uploaded
Hi all,I'm trying to update a file thats already been uploaded. I can't figure out what command to use, update_data/manage_upload/manage_edit. I've settled (so far) on manage_upload but it doesn't work. I get the error: Error Type: AttributeError Error Value:manage_uploadmy code:_# Takes the filename from a form searches my ZSQL method for the existence of the file, and then should update the file. REQUEST=context.REQUESTfilename = REQUEST.form.get('file')filename=filename.split('\\')[-1]result=container.Show_filename_selected(filename=filename)if result: fname= container.Show_filename_selected (filename=filename).tuples()[0][3] context.manage_upload([filename,REQUEST]) return File Exists... UPDATE: + filenameelse: return File Does NOT Exist: + filename_ What am I doing wrong? Am I using the wrong command?Thanks in advance,mjakowlew ___ 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] How to Update files that are already uploaded
File objects have a method called 'update_data' which may be of use. Look in the ZopeBook for details. Jonathan - Original Message - From: Mike Jakowlew To: zope@zope.org Sent: Thursday, December 01, 2005 12:12 PM Subject: [Zope] How to Update files that are already uploaded Hi all,I'm trying to update a file thats already been uploaded. I can't figure out what command to use, "update_data"/"manage_upload"/"manage_edit". I've settled (so far) on manage_upload but it doesn't work. I get the error: Error Type: AttributeError Error Value:manage_uploadmy code:_# Takes the filename from a form searches my ZSQL method for the existence of the file, and then should update the file. REQUEST=context.REQUESTfilename = REQUEST.form.get('file')filename=filename.split('\\')[-1]result=container.Show_filename_selected(filename=filename)if result: fname= container.Show_filename_selected (filename=filename).tuples()[0][3] context.manage_upload([filename,REQUEST]) return "File Exists... UPDATE: " + filenameelse: return "File Does NOT Exist: " + filename_ What am I doing wrong? Am I using the wrong command?Thanks in advance,mjakowlew ___Zope maillist - Zope@zope.orghttp://mail.zope.org/mailman/listinfo/zope** No cross posts or HTML encoding! **(Related lists - http://mail.zope.org/mailman/listinfo/zope-announcehttp://mail.zope.org/mailman/listinfo/zope-dev ) ___ 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 )
[Zope] Re: index_object() and bobobase_modification_time with different ZCatalogs
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Paul Winkler wrote: On Thu, Dec 01, 2005 at 04:44:41PM +, [EMAIL PROTECTED] wrote: Hello, does anybody knows a different possibility to beware the bobobase_modification_time of the given object from the following code? def my_index_object(object, catalogs=['myPointerCatalog', 'mySearchCatalog']): for cat in catalogs: object.default_catalog = cat object.index_object() # set back to default object.default_catalog = 'Catalog' I don't know what beware means in this context. If you are asking whether it is possible to avoid changing bobobase_modification_time, the answer is no. ZODB updates bobobase_modification_time on any change to a persistent object, and there is nothing you can do to avoid this. Hmmm, I wonder if one could hack it by avoiding '__setattr__', e.g.: for cat in catalogs: object.__dict__['default_catalog'] = cat object.index_object() cat._p_deactivate() # throw away changes But why don't we avoid the whole thing and just call the catalog directly: for cat in catalogs: cat.catalog_object(object, object.url() Tres. - -- === Tres Seaver +1 202-558-7113 [EMAIL PROTECTED] Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDjzMg+gerLs4ltQ4RApzkAJ9mbsd2+gwxBH5fYl8MehHurqbzWACgss26 H1Lj6yqpVrUME1Ey06/BZCI= =8QsT -END PGP SIGNATURE- ___ 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 )
[Zope] Short tutorial on I18n with Five
I'm happy to announce that I've finally managed to document the internationalization (i18n) features that Five has brought to the Zope 2 world since version 1.1: http://worldcookery.com/files/fivei18n This short tutorial compares current Zope-2-based solutions to the i18n problem with the Zope 3 i18n framework. It also gives a few pointers on how to use the latter in Zope 2 applications through the means of Five. It is not a full-blown tutorial and it expects the reader to be quite familiar with i18n-aware software development in Zope already. Target audience is mostly people switching over their Zope 2 products to Zope 3 technology which i18n is a part of. The tutorial also serves as a documentation of a new Zope 2 core feature because Five 1.3 is included in Zope 2.9 which is thus the first Zope 2 version to come with built-in i18n support! ___ 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] How to Update files that are already uploaded
Am Donnerstag, den 01.12.2005, 12:12 -0500 schrieb Mike Jakowlew: Hi all, I'm trying to update a file thats already been uploaded. I can't figure out what command to use, update_data/manage_upload/manage_edit. I've settled (so far) on manage_upload but it doesn't work. I get the error: Error Type: AttributeError Error Value: manage_upload my code: _ # Takes the filename from a form searches my ZSQL method for the existence of the file, and then should update the file. REQUEST=context.REQUEST filename = REQUEST.form.get('file') filename=filename.split('\\')[-1] result=container.Show_filename_selected(filename=filename) if result: fname= container.Show_filename_selected (filename=filename).tuples()[0][3] context.manage_upload([filename,REQUEST]) return File Exists... UPDATE: + filename else: return File Does NOT Exist: + filename _ What am I doing wrong? Am I using the wrong command? Well, first of all where comes the ZSQL Method into the game? ZODB is already a database and knows best which objects exist and which do not. Also you need to acquire the actual object if its there: if has_attr(container.Filerepository,fileid): fileobj=getattr(container.Filerepository,fileid) fileobj.manage_upload( ...) return File %s exists. Updated it. % fileid else: container.Filerepository.manage_addFile(...) sketchy but you should get the picture. ___ 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] Python Classes and Zope.
Andreas Jung wrote: --On 1. Dezember 2005 13:46:55 -0200 Fernando Lujan [EMAIL PROTECTED] wrote: There's a way to use a Python class inside zope? For instance, if I create the class: class MyClass: A simple example class i = 12345 def f(self): return 'hello world' Can I invoke the following code inside a Python Script? x = MyClass() x.f() PythonScripts are for *scripting* not for implementing complex logic and for programming tasks that require classes. PythonScripts don't provide full Python functionality that why were are talking of *Restriced Python*. Consider writing your functionality as Python product. all moral lessons aside, there are several use cases where access to *objects*, passed to zope2 from external packages and modules, is desirable. Most, if not all examples, out there assume that the external packages/modules/classes can freely be converted to Zope-classes. Now, assuming that I have not missed something fundamental, the problem the way I see it, is that when my Product recieves an object from the non-zope code, the object does not know anything about Zope, it is just a happy Python-object. But in order to even display it in a zpt I must transmogrify it into a special zope-object, and *that* is not so easy as I have discovered. In my case I am not so interested in importing the moduels or classes into a Script(Python) - I have allready passed the objects in question thtough my product, but still I get some Zope Does Not Allow That error. So far I have not had any success with anything else than writing special methods in my Classes that converts the objects to dictionaries before passing them to the zpt or Script(Python) in question. But that feels like a very awkward way of doing things, and it makeas it *very* difficult for Zope to be a nice player with non-zope objects. My 2 €-cents worth. /dario -- -- --- Dario Lopez-Kästen, IT Systems Services Chalmers University of Tech. Lyrics applied to programming application design: emancipate yourself from mental slavery - redemption song, b. marley ___ 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] Python Classes and Zope.
Dario Lopez-Kästen wrote: Andreas Jung wrote: --On 1. Dezember 2005 13:46:55 -0200 Fernando Lujan [EMAIL PROTECTED] wrote: There's a way to use a Python class inside zope? For instance, if I create the class: class MyClass: A simple example class i = 12345 def f(self): return 'hello world' Can I invoke the following code inside a Python Script? x = MyClass() x.f() PythonScripts are for *scripting* not for implementing complex logic and for programming tasks that require classes. PythonScripts don't provide full Python functionality that why were are talking of *Restriced Python*. Consider writing your functionality as Python product. all moral lessons aside, there are several use cases where access to *objects*, passed to zope2 from external packages and modules, is desirable. Most, if not all examples, out there assume that the external packages/modules/classes can freely be converted to Zope-classes. Now, assuming that I have not missed something fundamental, the problem the way I see it, is that when my Product recieves an object from the non-zope code, the object does not know anything about Zope, it is just a happy Python-object. But in order to even display it in a zpt I must transmogrify it into a special zope-object, and *that* is not so easy as I have discovered. In my case I am not so interested in importing the moduels or classes into a Script(Python) - I have allready passed the objects in question thtough my product, but still I get some Zope Does Not Allow That error. So far I have not had any success with anything else than writing special methods in my Classes that converts the objects to dictionaries before passing them to the zpt or Script(Python) in question. But that feels like a very awkward way of doing things, and it makeas it *very* difficult for Zope to be a nice player with non-zope objects. My 2 €-cents worth. /dario You need to call InitializeClass on your object, and that's it. cf http://www.upfrontsystems.co.za/courses/zope/ch04.html under Zopifying our Python classes /JM ___ 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 )
[Zope] Beginners Confusion
Folks, I am trying to understand instances, any help or suggestions would be appreciated as I am obviously missing something. I would like to have each user having, either, their own Zope Server binaries (including CMF Plone) in their home directories. Alternatively, as multiple Zope Servers on one machine will be quite a resource eater, (probably 20 main users) is it possible to have just one Zope Server and multiple instances of the database/CMF/Plone for the users? All user instances and content including the database entries would need to be accounted for in andinstalled in their own home directories to allow us to control and manageeachuser or groupsbandwidth and quota's etc etc. Is this possible? If so, is there a how-to or something I have not found yet or some advice would be appreciated. I have several books on Zope now and none of them seem to describe instances or multiple user configurations in any detail. I am looking for each department/user/group to be able to manage,for the most part, their own web-services, but with us still managing the usual operating and application environments. Thanks a lot, regards, Russ ___ 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] Python Classes and Zope.
So far I have not had any success with anything else than writing special methods in my Classes that converts the objects to dictionaries before passing them to the zpt or Script(Python) in question. But that feels like a very awkward way of doing things, and it makeas it *very* difficult for Zope to be a nice player with non- zope objects. FWIW, what you've created in Zope 3 terms is a view. You might feel more comfortable using Five and Zope 3 views if you're not comfortable with your current strategy because it provides a pattern for doing just this. - C ___ 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] Python Classes and Zope.
According to Dario Lopez-Kästen: But in order to even display it in a zpt I must transmogrify it into a special zope-object, and *that* is not so easy as I have discovered. In my case I am not so interested in importing the moduels or classes into a Script(Python) - I have allready passed the objects in question thtough my product, but still I get some Zope Does Not Allow That error. You could add __allow_access_to_unprotected_subobjects__ = 1 to your class. Then all attributes and methods of its instances should be accessible from Zope. However, this can be a security problem, so be careful... \wlang{} -- [EMAIL PROTECTED]Fax: +43/1/31336/9207 Zentrum fuer Informatikdienste, Wirtschaftsuniversitaet Wien, Austria ___ 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 )
[Zope] exUserFolder will not redirect to login page
Hi all. I have this problem with our zope based CMS system. No matter what i try I can not make the docLogin page appear when it should. If I go directly to it, it works fine, but otherwise the http auth poppup appears. I have started looking into exUserFolder, and putting in zLOG.LOG statements to try to figure out what is going on. The best description of what is _supposed_ to be going I have found is this: http://www.zope.org/Members/vladap/mysqlUserFolder/release-1.0.5/README Section - Zope authentication process When i log just above if user != None: in validate at approx. line 1040 in exUserFolder.py I get: auth: None roles: None parent index.html user: Anonymous User I get this wether index html allows anonymous or not. Is this propper behavior? Where does roles come from? Should not that reflect the roles needed for access? If access is allowed all the other requests for images and so on have: auth: None roles: ('Manager', 'Anonymous') parent bound method Image.id of Image instance at 42aeb650 user: Anonymous User I think our CMS has modified the permission system somewhat to allow access to some specific folders above acl_users, but I have not found those changes yet. (and the lead developer is very busy on something else, and don't remember) I don't know if this is relevant or not, either.. Anyway, it seems a crucial point must be towards the end of cookie_validate after if not self.sessionTracking at approx. line 930. If I override here and set roles = ('Manager'), i get to raise 'LoginRequired', and it seems like I should end up at acl_users/docLogin via docLoginRedirect.dtml, except that I go into a redirect loop because of the same override. Normally if nobody.allowed(parent, roles): is true, and ob is returned, which is 'Anonymous User', even if the file I am accessing is protected. Should not this be None in the last case? And if it returns anonymous, then who decides to ask the next acl_user upp the chain (who only knows http auth)? How about some way to trace down where roles come from? Am I on the right track here? I had a peek in ZPublisher/BaseRequest.py, but that only made me more confused.. All confused, and ready to give up now. Any and all explanations, tips, or good ideas appreciated. Regards Gaute Amundsen -- - Gaute Amundsen Technology today is the campfire [EMAIL PROTECTED] around which we tell our stories. There's this attraction to light and to this kind of power, which is both warm and destructive. Laurie Anderson http://www.div.org ___ 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 )
[Zope] MySql problems
I have not yet completed differential diagnosis, but I was hoping someone had encountered a similar problem and could pass along a fix/workaround. The following program fails to do the writes -- import MySQLdb initdb='test' dbuser = 'root' dbpass = 'XX' host = 'localhost' connection = MySQLdb.connect( db=initdb, user=dbuser, passwd=dbpass, host=host ) cursor = connection.cursor() qd = delete from test.data cursor.execute(qd) qi = insert into test.data values('ardvark', 'homework') print qi cursor.execute( qi) q2 = select * from test.data cursor.execute( q2) res = cursor.fetchall() print res when run with Mysql-Python-1.2.1c under Python 2.4.2, but works just find with Mysql-Python-1.1.1 under Python 2.3.5. The tables are Innodb tables (that is, transactional). Running Zope with Python 2.4.2 and Mysql-Pyton 1.2.1c works just fine. Is there something special I need to do that I have forgotten? -- ___ 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] exUserFolder will not redirect to login page
+---[ Gaute Amundsen ]-- | Hi all. | | I have this problem with our zope based CMS system. | No matter what i try I can not make the docLogin page appear when it should. | If I go directly to it, it works fine, but otherwise the http auth poppup | appears. I don't know what version of exUserFolder you're using, but, try looking in doc/UnenlightenedZopistasGuide.txt 5.0 TIPS FOR THE UNWARY Specifically section 5.1.1; 5.1.1 The problem When you try to access the folder, instead of getting the form, you get a popup box, even though you chose Cookie Authentication. Even when you enter a username and password it doesn't work. -- Andrew Milton [EMAIL PROTECTED] ___ 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] Beginners Confusion
At 07:46 AM 12/2/2005 +1100, Russell Winter wrote: I would like to have each user having, either, their own Zope Server binaries (including CMF Plone) in their home directories. Alternatively, as multiple Zope Servers on one machine will be quite a resource eater, (probably 20 main users) is it possible to have just one Zope Server and multiple instances of the database/CMF/Plone for the users? All user instances and content including the database entries would need to be accounted for in and installed in their own home directories to allow us to control and manage each user or groups bandwidth and quota's etc etc. Hi Russ, You didn't mention platform, but conceptually this windows tutorial may help with your solution regardless of your platform. I set up something similar to his suggestion, running multiple instance of Plone on the same Zope service, so that each instance of Plone can have their own Products directory. This was initially done because CMFBoard wouldn't run with PloneArticle, but we are finding it nice to have different instances for various web site groupings. Anyway, here is the tutorial: http://plone.org/documentation/tutorial/multiple-plone-instances-windows/ Hope it helps, if you have more questions, please let me know. Eric ___ 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 )
[Zope] Re: MySql problems
Dennis Allison wrote: I have not yet completed differential diagnosis, but I was hoping someone had encountered a similar problem and could pass along a fix/workaround. The following program fails to do the writes -- import MySQLdb initdb='test' dbuser = 'root' dbpass = 'XX' host = 'localhost' connection = MySQLdb.connect( db=initdb, user=dbuser, passwd=dbpass, host=host ) cursor = connection.cursor() qd = delete from test.data cursor.execute(qd) qi = insert into test.data values('ardvark', 'homework') print qi cursor.execute( qi) q2 = select * from test.data cursor.execute( q2) res = cursor.fetchall() print res when run with Mysql-Python-1.2.1c under Python 2.4.2, but works just find with Mysql-Python-1.1.1 under Python 2.3.5. The tables are Innodb tables (that is, transactional). 1.2.x has no autocommit, so you have to commit your changes with connection.commit() see e.g. https://sourceforge.net/forum/forum.php?thread_id=1329039forum_id=70461 Running Zope with Python 2.4.2 and Mysql-Pyton 1.2.1c works just fine. ZMySQL commits for you, so this should work. BTW and just for the record: Python 2.4 is not recommended for Zope 2.8.x, but I'm sure you know that ;-) Is there something special I need to do that I have forgotten? HTH, Wolfram ___ 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] exUserFolder will not redirect to login page
On Friday 02 December 2005 04:31, Andrew Milton wrote: +---[ Gaute Amundsen ]-- | Hi all. | | I have this problem with our zope based CMS system. | No matter what i try I can not make the docLogin page appear when it | should. If I go directly to it, it works fine, but otherwise the http | auth poppup appears. I don't know what version of exUserFolder you're using, but, try looking in exUserFolder-0-10-10 doc/UnenlightenedZopistasGuide.txt 5.0 TIPS FOR THE UNWARY Specifically section 5.1.1; 5.1.1 The problem When you try to access the folder, instead of getting the form, you get a popup box, even though you chose Cookie Authentication. Even when you enter a username and password it doesn't work. I have been over that guide a few times after clues, but unfortunately this description only approximately fits my situations. 5.1.2 What happened You tried to access an area you don't have access to. Zope found the closest user folder to the object you were trying to access. The user folder decided you were not authorized and tried to display the login form. You don't have access to view the login form, so Zope finds the nearest user folder to the login form, which is the user folder above the protected directory. It pops up the authentication dialog. If you put in a valid username and password for this top level, then lower level then displays the login form. As I mention in the part you quote, I have no problem accessing acl_users/docLogin, or indeed logging in using cookies, when I go directly to this url. The problem is that when I go to a protected url I do not get redirected to docLogin, but controll is passed to the acl_users above, as described, and that acl_users only knows http auth. When I forced cookie_validate to return the redirect at the end, I did get the right docLogin as well, as far as I can see, except I got in that redirect loop because of same forcing. That should eliminate the above explanation pretty conclusively, I would think. (in adition to the fact that acl_users is way outside the protected area) As far as I can see that must mean that either something is going wrong in exUserFolder, or much more likely, that we are feeding it something bogus, or have previously modified it in some non-obvious way. My problem is that I have little idea what it is supposed to look like at different stages. Regards Gaute Amundsen -- -- - Gaute Amundsen Technology today is the campfire [EMAIL PROTECTED] around which we tell our stories. There's this attraction to light and to this kind of power, which is both warm and destructive. Laurie Anderson http://www.div.org ___ 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] MySql problems
Am Donnerstag, den 01.12.2005, 15:45 -0800 schrieb Dennis Allison: I have not yet completed differential diagnosis, but I was hoping someone had encountered a similar problem and could pass along a fix/workaround. The following program fails to do the writes -- import MySQLdb initdb='test' dbuser = 'root' dbpass = 'XX' host = 'localhost' connection = MySQLdb.connect( db=initdb, user=dbuser, passwd=dbpass, host=host ) cursor = connection.cursor() qd = delete from test.data cursor.execute(qd) qi = insert into test.data values('ardvark', 'homework') print qi cursor.execute( qi) q2 = select * from test.data cursor.execute( q2) res = cursor.fetchall() print res I see no connection.commit() there. Zope always commits (if all successfull) when a request is done. when run with Mysql-Python-1.2.1c under Python 2.4.2, but works just find with Mysql-Python-1.1.1 under Python 2.3.5. This mysql-python-1.1.1 might have something like autocommit switched on. The readme or changes.txt of both versions should tell you that. The tables are Innodb tables (that is, transactional). (more or less ;) Running Zope with Python 2.4.2 and Mysql-Pyton 1.2.1c works just fine. Regards Tino ___ 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 )