[Zope-dev] Zope 2.4: Unicode, Berkeley Storage?

2001-06-20 Thread Randall F. Kern

I was just reading the Zope 2.4.0 plan on dev.zope.org, and I have two
questions:

1. Will Unicode be supported (UTF-8 encoding) for results, posted data,
marshaled arguments, etc?

2. Will the BDB storage be standard with 2.4?  Transactional Undo sounds
_very_ nice.


Thanks,
-Randy

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



RE: [Zope-dev] ZEO on SMP

2001-05-23 Thread Randall F. Kern

If I understand your scenario, you are trying to run two instances of
Zope on a single machine, talking to a ZEO server?

That won't work :)

Neither Unix nor Windows knows what to do with two processes trying to
open the same port for listen.  I'm surprised the second Zope instance
even starts.

If you want to try it, start each instance of Zope on different ports,
then use some kind of ipforwarding/load balancer on the box to route
connections to port 80 to either of your Zope servers (say 8081 and
8082).

-Randy

 -Original Message-
 From: Dyon Balding [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 23, 2001 12:08 PM
 To: Tino Wildenhain
 Cc: [EMAIL PROTECTED]
 Subject: Re: [Zope-dev] ZEO on SMP
 
 
 Tino,
 
 Thanks for your reply.
 
 When you say it works fine on a dual processor machine, are you saying
 that a single ZEO client fully utilises both processors? or that you
 are running two ZEO clients successfully?
 
 Unfortunately I'm currently stuck with Windows due to both political
 reasons, and because we are interfacing to a large SQLServer database.
 
 -d
 
 On Wed, May 23, 2001 at 08:44:59PM +0200, Tino Wildenhain wrote:
  Hi Dyon,
  
  ZEO on a dual processor machine runs fine for me.
  I'm using redhat-linux for the server (ZEO and Clients
  on same machine)
  If you dont need strange things I would not recommend
  Win2k as server platform.
  
  Best regards
  Tino Wildenhain
  
  --On Mittwoch, 23. Mai 2001 11:35 -0700 Dyon Balding 
 [EMAIL PROTECTED] 
  wrote:
  
   Hi,
  
   We are setting up a cluster of ZEO clients on dual 
 processor machines.
   From some experiments and from searching through the 
 mailing lists, it
   appears that a single Zope process will not take full 
 advantage of the
   two processors.
  
   The solution would appear to be to run two ZEO clients on 
 each server.
   This, however, is causing problems.
  
   I can successfully run two Zope (non-ZEO) processes on a 
 single machine,
   but two ZEO clients don't seem to coexist nicely on the 
 Windows 2000
   machine.  The second client to start will accept 
 connections, but never
   responds with anything.
  
   Zope: 2.3.2, ZEO: 1.0b3, Windows 2k for clients, Linux 
 and Windows 2k
   for storage server.
  
   Is there a better solution?  If not, has anyone come across this
   problem?
  
   Any pointers appreciated
   -d
  
   ___
   Zope-Dev maillist  -  [EMAIL PROTECTED]
   http://lists.zope.org/mailman/listinfo/zope-dev
   **  No cross posts or HTML encoding!  **
   (Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )
  
  
  
 
 -- 
 Dyon Balding [EMAIL PROTECTED]
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )
 

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



RE: [Zope-dev] CoreSessionTracking

2001-04-23 Thread Randall F. Kern

_.SecurityGetUser()

-Randy

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



RE: [Zope-dev] CoreSessionTracking

2001-04-23 Thread Randall F. Kern

The documentation is in lib/python/AccessControl/DTML.py :)

 From: Chris Withers [mailto:[EMAIL PROTECTED]]
 dtml-var _.SecurityGetUser().getUserName()

as for simplifying _.SecurityGetUser().getUserName(), BasicUser defines
__str__ to return getUserName(), so dtml-var SecurityGetUser should
result in the same output as dtml-var
expr=_.SecurityGetUser().getUserName()

-Randy

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



[Zope-dev] External transaction integration bug?

2001-04-18 Thread Randall F. Kern

I may just be missing something obvious here, but it seems like there is
a hole in ZODB.Transaction.Transaction.commit and Shared.DC.ZRDB.TM.TM,
that can cause external transactions (those that use the TM mixin class,
like psycopg) to be abandoned (never get committed or rolled back).

Let's say somewhere around line 300 in Transaction.py (the call to
j.commit(o, self)) we get an exception.  Furthermore, let's say the TM
derived database object has already been committed (the only effect of
which is to move the DB into the jars mapping, since TM.tpc_begin() and
TM.commit() both do nothing).

The exception dumps us down to about line 353, where we call
_p_jar.abort() on all the uncommitted objects (note: it's important that
the database connection isn't in this list, because TM.abort() will
rollback the transaction.  the way we keep the db out of this list is by
having it appear in objects _before_ the object that failed the commit).

Next we reach line ~366, where we should "unwind TPC for the jars that
began it".  What this means is calling tpc_abort() on each jar from the
objects that were already committed (which includes the database).
However, TM.tpc_abort() does nothing, leaving the external database
transaction open.

Does this make sense?

If this makes sense (i.e. seems bad :), does catching tpc_abort() in TM
and calling TM.abort() seem like a valid fix?

Thanks,
-Randy

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



RE: [Zope-dev] Custom dtml tag ... parameters not evaluated

2001-04-12 Thread Randall F. Kern

Try adding something like this in your render method (haven't tried
this, but from a poking around the code in the DocumentTemplate
directory in the past this seems about right):

import VSEval
expr = VSEval.Eval(variable_you_want_to_evaluate)
value = expr.eval(md)

-Randy

 -Original Message-
 From: Romain Slootmaekers [mailto:[EMAIL PROTECTED]]
 
 I'm trying to create a custom dtml tag, and after the How-to on this
 (http://www.zope.org/Members/z113/1) that in itself posed no 
 problem: easy
 as pie. The problem I'm having with the tag is that parameters are not
 evaluated. for instance (my tag's name is 'aa')

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



RE: [Zope-dev] Objects, Roles and Permissions

2001-04-10 Thread Randall F. Kern

I haven't worked with this code closely in a few months, but as I recall
permissions that are acquired are stored as a list, and those that
aren't are stored as a tuple.

if type(self._View_Permission) == type(()):
# done, this permission isn't acquired above this point

Furthermore, I may be missing the point of this thread, but if you are
trying to get the list of all roles assigned to a permission (from a
python product), you could use this:

from AccessControl.PermissionRole import rolesFromPermissionOn

roles = rolesFromPermissionOn('View', ob)


-Randy


 -Original Message-
 From: Danny William Adair [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 09, 2001 7:49 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [Zope-dev] Objects, Roles and Permissions
 
 
 Thank you very much, Richard! Cool!
 
 Still...
 
  ...
  Feel free to expand the method to other roles
  and the full suite of permissions.
  ...
 
 Other *roles*? Roles are what's coming back, isn't it?
 
  def viewPermissions(self, acquired=0):
  ''' walk up the acquisition path to find a 
 _View_Permission
  attribute...  possibly _only_ the acquired 
 permissions.
  '''
  chain = self.aq_chain
  if acquired:
  chain = chain[1:]
  for self in chain:
  if hasattr(self.aq_base, '_View_Permission'):
  return self._View_Permission
  return ['Manager']
 
 "possibly _only_ the acquired permissions" - oops! Your 
 snippet worked fine
 _if_ the view permission was acquired by that object. As soon 
 as I turned
 off acquisition for the view permission of the object, it 
 would still give
 me the acquired roles (that in fact were'nt acquired).  What 
 does the "if"
 statement look like that would return the object's own roles 
 for the View
 Permission if acquisition was turned off? Naive Danny who 
 doesn't know s...
 tried to put
 
 if hasattr(self.aq_base, '_View_Permission'):
 return self._View_Permission
 
 at the beginning of your code, but no effect. :-(
 
 But now I see how to access specific permissions and read 
 their content (do
 I? I'll experiment with it), thank you very much! I will put a
 string.replace on top and pass the Permission to examine by string
 parameter, and call that whole stuff "getAllowedRoles".
 
 A "getGrantedPermissions" for examining a role should work 
 similarly, right?
 
 def ac_inherited_permissions(self, all=0):
 
 set all to 1 and then... iterate through the list (tuple or 
 list? list of
 tuples?) and check every "_current_Permission" if it contains 
 the role?
 
 Thx once again,
 Danny
 
 btw: Isn't return['Manager'] at the end of your code obsolete 
 (but safe)? Or
 is there anything special going on at the root level
 (isTopLevelPrincipiaApplicationObject)?
 
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )
 

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



RE: [Zope-dev] Transparent Folder bug?

2001-03-23 Thread Randall F. Kern

I had that problem a while back but forgot to report it to Mr.
Transparent Folders (sorry...)

Anyway, this patch to TransparentFoldersPatch.py should fix you right
up:

def _getattr(self, name):
# This is the new ObjectManager.__getattr__().  If an object by
the
# given ID is not found through the normal mechanisms, we
# fall through to here and try to find the object in a
# transparent folder.
tpids = self._transparent_object_ids
if tpids and not self._v_no_transparent and name[:3] != '_p_'
and name != '_is_transparent':
# The attribute may be accessible through
# transparent folders.
try:

The important bit is adding the term "and name != '_is_transparent': to
the if statement.

-Randy
  

 -Original Message-
 From: Andy McKay [mailto:[EMAIL PROTECTED]]
 Sent: Friday, March 23, 2001 4:46 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [Zope-dev] Transparent Folder bug?
 
 
 Saying that I can now only reproduce this wierdness under certain
 circumstances. Id ignore this until I can find a solid 
 example... Sorry
 --
   Andy McKay.
 
 
 - Original Message -
 From: "Andy McKay" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, March 23, 2001 4:27 PM
 Subject: [Zope-dev] Transparent Folder bug?
 
 
  Am I imagining it or do I have a transparent folders bug? 
 It would seem
 that
  transparent folders adds an extra namespace to my objects 
 and it searches
  through sub folders eg:
 
  Folder X:
  Document Foo.
 
  In the root with transparent folders i can happily call 
 dtml-var Foo
 when
  I should not have this in my namespace. Without transparent 
 folders I get
 a
  KeyError (which I should). With I get X/Foo rendered even 
 though X is not
  transparent.
 
  My only caveat here is that every test with transparent 
 folders is Zope
 2.3,
  where as without im using 2.1.6.
 
  Cheers.
 
  --
Andy McKay.
 
 
 
 
  ___
  Zope-Dev maillist  -  [EMAIL PROTECTED]
  http://lists.zope.org/mailman/listinfo/zope-dev
  **  No cross posts or HTML encoding!  **
  (Related lists -
   http://lists.zope.org/mailman/listinfo/zope-announce
   http://lists.zope.org/mailman/listinfo/zope )
 
 
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )
 

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



[Zope-dev] Zope 2.3.0 AccessControl/SecurityInfo.py

2001-03-01 Thread Randall F. Kern

Sorry if these have already been fixed in 2.3.1, I haven't had time to
upgrade yet.

I fixed a small bug in SecurityInfo that made
SecurityInfo.setPermissionDefault() impossible to use:

191c191
 self.roles[permission_name] = rdict.keys()
---
 self.roles[permission_name] = rdict

def setPermissionDefault(self, permission_name, roles):
"""Declare default roles for a permission"""
rdict = {}
for role in roles:
rdict[role] = 1
if self.roles.get(permission_name, rdict) != rdict:
LOG('SecurityInfo', WARNING, 'Conflicting default role'
'declarations for permission "%s"' % permission_name)
self._warnings = 1
self.roles[permission_name] = rdict.keys()

My other problem was that I wanted to setup some default permissions
that are used programatically in my product (i.e. they aren't used to
protect any specific methods, but the methods themselves check for the
permission.)  A small change to ClassSecurityInfo.apply() allows you to
call SecurityInfo.setPermissionDefault() to create new permissions, even
if they aren't attached to any methods:

239a240,242
 for permission_name in self.roles.keys():
 if not ac_permissions.has_key(permission_name):
 ac_permissions[permission_name] = ()

def apply(self, classobj):
"""Apply security information to the given class object."""

dict = classobj.__dict__

# Check the class for an existing __ac_permissions__ and
# incorporate that if present to support older classes or
# classes that haven't fully switched to using SecurityInfo.
if dict.has_key('__ac_permissions__'):
for item in dict['__ac_permissions__']:
permission_name = item[0]
self._setaccess(item[1], permission_name)
if len(item)  2:
self.setDefaultRoles(permission_name, item[2])

# Set __roles__ for attributes declared public or private.
# Collect protected attribute names in ac_permissions.
ac_permissions = {}
for name, access in self.names.items():
if access in (ACCESS_PRIVATE, ACCESS_PUBLIC, ACCESS_NONE):
dict['%s__roles__' % name] = access
else:
if not ac_permissions.has_key(access):
ac_permissions[access] = []
ac_permissions[access].append(name)

# Now transform our nested dict structure into the nested tuple
# structure expected of __ac_permissions__ attributes and set
# it on the class object.
getRoles = self.roles.get
__ac_permissions__ = []
for permission_name in self.roles.keys():
if not ac_permissions.has_key(permission_name):
ac_permissions[permission_name] = ()
permissions = ac_permissions.items()
permissions.sort()
for permission_name, names in permissions:
roles = getRoles(permission_name, ())
if len(roles):
entry = (permission_name, tuple(names), tuple(roles))
else:
entry = (permission_name, tuple(names))
__ac_permissions__.append(entry)
dict['__ac_permissions__'] = tuple(__ac_permissions__)

# Take care of default attribute access policy
access = getattr(self, 'access', _marker)
if access is not _marker:
dict['__allow_access_to_unprotected_subobjects__'] = access

if getattr(self, '_warnings', None):
LOG('SecurityInfo', WARNING, 'Class "%s" had conflicting '
'security declarations' % classobj.__name__)



-Randy

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



RE: [Zope-dev] Calling Catalog from python script

2001-02-14 Thread Randall F. Kern

What's wrong with AbstractCatalogBrain.getObject()?  Doesn't that work?

-Randy

 -Original Message-
 From: Casey Duncan [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, February 14, 2001 3:45 PM
 To: R. David Murray; [EMAIL PROTECTED]
 Subject: Re: [Zope-dev] Calling Catalog from python script
 
 
 "R. David Murray" wrote:
  
  I'll probably figure this out as soon as I post like last 
 time, but I've
  been staring at it and can't see my mistake.  The following 
 code returns
  a list of None's:
  
  objs = []
  for catent in container.Catalog(context.REQUEST):
objs.append(container.Catalog.getobject(catent.data_record_id_))
  return objs
  
  I've checked, and catent is a mybrains instance and 
 catent.data_record_id_
  has an increasing number as its value.  So why doesn't this work?
  
  Also, and this is a better reason for posting this to zope-dev than
  asking for help is grin: why can't I say
  
catent.getobject()
  
  That would seem to be a lot more OOish.
  
  This is under Zope-2.3.0, by the way.
  
  --RDM
  
 That code looks pretty good to me. Did you try updating the Catalog?
 Also, what happens if just append catent. Do you get something other
 than None then? I would assume so, but it might help to see 
 exactly what
 the meta data is to identify the objects it "should" return.
 
 I agree that getobject should be a method of the result item, although
 implementing it might be a bit tricky to do. I looked into 
 that a while
 back. Perhaps I should take another look at that...
 
 -- 
 | Casey Duncan
 | Kaivo, Inc.
 | [EMAIL PROTECTED]
 `--
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )
 

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



RE: [Zope-dev] Zope server dies with Netscape's FTP

2001-02-04 Thread Randall F. Kern

Are you starting zope with ./start, or otherwise including -D when z2.py
is executed?

That will cause Zope to try to write to the terminal when an FTP
connection is made.  Since the terminal is gone, Zope dies.

-Randy

 -Original Message-
 From: Pablo Bleyer Kocik [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, February 04, 2001 7:41 AM
 To: zope-dev
 Subject: Re: [Zope-dev] Zope server dies with Netscape's FTP
 
 
 
 
 Chris Withers wrote:
 
  Pablo Bleyer Kocik wrote:
  
   I am running Zope 2.3.0 under Linux in a remote 
 machine. When I
   try to access Medusa through FTP (port 8021) using 
 Netscape 4.5 under
   Windows, Zope dies silently. Is this a known issue? How 
 can I trace
   what is happening to Zope's FTP server causing it to die?
 
  Stick it in the collector:
 
  classic.zope.org:8080/Collector
 
  (it's down at the moment :-( )
 
  cheers,
 
  Chris
 
 Yep, I was going to do that. However I wanted to track the bug a
 little
 more.
 
 The problem is not with Netscape; through plain vanilla FTP
 utility I
 get the same situation. But now comes the nice part: If I login to the
 machine and restart Zope then, *without* leaving the shell prompt, the
 FTP
 access works fine. I get the access and success login notices in the
 screen. If I logout and I try to login with ftp again, Zope RIPs ;^/
 
 Cheers!
 
 --
 Pablo Bleyer Kocik |
 pbleyer|"Rintrah roars  shakes his fires in the burdend
 air;
   @embedded.cl | Hungry clouds swag on the deep" - William Blake
 
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )
 

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