This question probably doesn't belong on this list, but I'll ask anyway. I have a script(python) object in zope which is being passed a variable containing the following: first last <flast@domain.com> How can I extract all of the text up to but not including the < and assign to a new variable? Thanks, Israel
first last <flast@domain.com>
How can I extract all of the text up to but not including the < and assign to a new variable?
You should use parseaddr from the excellent email library see: http://docs.python.org/lib/module-email.Utils.html The advantage of using the utility rather than slicing the string yourself is that there's always a case with email that you haven't thought about. If you're using an older Python you may need to download the email library from http://www.python.org/sigs/email-sig/ A -- Logical Progression Ltd, 20 Forth Street, Edinburgh EH1 3LH, UK Tel: +44 (0)131 550 3733 Web: http://www.logicalprogression.net/
what is my best choice these for SMB authentication and group mapping using Zope 2.7 on a win2k server machine? I have Zope 2.3.2 using a home-brew user and groups from NT Domain solution, but I don't think it will migrate cleanly to the latest Zope auth scheme. Thanks
Questions Erik. 1) why do you smb authentication? (smb implies file system access ) A "win2k" server machine... 2) Is it attached to an NT4 domain or AD (ldap authentication)? (because you call it an "NT domain" later in the email.) check the archives for authentication using ldap. hth bobb ----- Original Message ----- From: "Erik Myllymaki" <erik.myllymaki@aviawest.com> To: <zope@zope.org> Sent: Wednesday, May 05, 2004 4:09 PM Subject: [Zope] NT User Authentication
what is my best choice these for SMB authentication and group mapping using Zope 2.7 on a win2k server machine?
I have Zope 2.3.2 using a home-brew user and groups from NT Domain solution, but I don't think it will migrate cleanly to the latest Zope auth scheme.
Thanks
_______________________________________________ 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 )
the zope instance is running on a win2k server, but I need to authenticate against an NT Domain. I did get things going last night, to a point where my NT Groups are acting as Local Roles, and I can authenticate to my PDC, but it is really, really slow. Bobb wrote:
Questions Erik.
1) why do you smb authentication? (smb implies file system access ) A "win2k" server machine...
2) Is it attached to an NT4 domain or AD (ldap authentication)? (because you call it an "NT domain" later in the email.)
check the archives for authentication using ldap. hth
bobb
----- Original Message ----- From: "Erik Myllymaki" <erik.myllymaki@aviawest.com> To: <zope@zope.org> Sent: Wednesday, May 05, 2004 4:09 PM Subject: [Zope] NT User Authentication
what is my best choice these for SMB authentication and group mapping using Zope 2.7 on a win2k server machine?
I have Zope 2.3.2 using a home-brew user and groups from NT Domain solution, but I don't think it will migrate cleanly to the latest Zope auth scheme.
Thanks
_______________________________________________ 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 )
Erik Myllymaki wrote:
the zope instance is running on a win2k server, but I need to authenticate against an NT Domain.
I did get things going last night, to a point where my NT Groups are acting as Local Roles, and I can authenticate to my PDC, but it is really, really slow.
Time to do some analysis really. Sounds like you needs some caching at crucial points... What userfolder are you using? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
----- Original Message ----- From: "Chris Withers" <chris@simplistix.co.uk> To: <erik.myllymaki@aviawest.com> Cc: "Bobb" <rawbobb@hotmail.com>; <zope@zope.org> Sent: Friday, May 07, 2004 4:27 AM Subject: Re: [Zope] NT User Authentication
Erik Myllymaki wrote:
the zope instance is running on a win2k server, but I need to authenticate against an NT Domain.
I did get things going last night, to a point where my NT Groups are acting as Local Roles, and I can authenticate to my PDC, but it is really, really slow.
how far away (hops) is the PDC? is there a BDC closer?
Time to do some analysis really. Sounds like you needs some caching at
crucial
points... What userfolder are you using?
Chris
-- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
the PDC and zopeserver are on the same switch. <what I know of the internal workings of the Zope security scheme can fit in a small dixie cup > I had to do a little hacking to get the NT Groups to act as local security roles in Zope, and while doing that, I noticd that the getRoles() method in AccessControl/Users.py is used for every object on a page. Combined with a fairly slow lookup to begin with, and complex pages are VERY slow. There must be a good reason for this, but I would have thought the users' role info would have been cached at a higher level somehow... </what I know of the internal workings of the Zope security scheme can fit in a small dixie cup > Bobb wrote:
----- Original Message ----- From: "Chris Withers" <chris@simplistix.co.uk> To: <erik.myllymaki@aviawest.com> Cc: "Bobb" <rawbobb@hotmail.com>; <zope@zope.org> Sent: Friday, May 07, 2004 4:27 AM Subject: Re: [Zope] NT User Authentication
Erik Myllymaki wrote:
the zope instance is running on a win2k server, but I need to authenticate against an NT Domain.
I did get things going last night, to a point where my NT Groups are acting as Local Roles, and I can authenticate to my PDC, but it is really, really slow.
how far away (hops) is the PDC? is there a BDC closer?
Time to do some analysis really. Sounds like you needs some caching at
crucial
points... What userfolder are you using?
Chris
-- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
sorry for the top post... just as a thought, are you using a local group or a domain group? (zope-gurus, please help)... maybe one is faster than the other? ----- Original Message ----- From: Erik Myllymaki To: Bobb Cc: Chris Withers ; zope@zope.org Sent: Friday, May 07, 2004 11:46 AM Subject: Re: [Zope] NT User Authentication the PDC and zopeserver are on the same switch. <what I know of the internal workings of the Zope security scheme can fit in a small dixie cup > I had to do a little hacking to get the NT Groups to act as local security roles in Zope, and while doing that, I noticd that the getRoles() method in AccessControl/Users.py is used for every object on a page. Combined with a fairly slow lookup to begin with, and complex pages are VERY slow. There must be a good reason for this, but I would have thought the users' role info would have been cached at a higher level somehow... </what I know of the internal workings of the Zope security scheme can fit in a small dixie cup > Bobb wrote: ----- Original Message ----- From: "Chris Withers" <chris@simplistix.co.uk> To: <erik.myllymaki@aviawest.com> Cc: "Bobb" <rawbobb@hotmail.com>; <zope@zope.org> Sent: Friday, May 07, 2004 4:27 AM Subject: Re: [Zope] NT User Authentication Erik Myllymaki wrote: the zope instance is running on a win2k server, but I need to authenticate against an NT Domain. I did get things going last night, to a point where my NT Groups are acting as Local Roles, and I can authenticate to my PDC, but it is really, really slow. how far away (hops) is the PDC? is there a BDC closer? Time to do some analysis really. Sounds like you needs some caching at crucial points... What userfolder are you using? 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 )
Erik Myllymaki wrote:
the PDC and zopeserver are on the same switch.
What userfolder are you using? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Erik Myllymaki wrote:
Chris Withers wrote:
Erik Myllymaki wrote:
the PDC and zopeserver are on the same switch.
What userfolder are you using?
Chris
exUserFolder.
I have *extended* smbAuthSource.py form exUserFolder. I have a function getNTUserRoles(username) that takes a username and returns the list of groups that user belongs to in the NT DOMAIN. I add this to the roles list, and now, by simply adding a local role (with the same name as the NT group) to an object, all NT users in that group can immediately access this object. def listOneUser(self, username): roles=[] if self.currentPropSource: roles=self.currentPropSource.getUserProperty(username=username, key='_roles', default=[]) roles = roles + getNTUserRoles(username) if not roles: roles=[] # make sure it's a list... username = string.lower(username) zLOG.LOG('smbAuthSource', zLOG.DEBUG, "listOneUser returning {username: '%s', password: '', roles: %s}" % (username, roles) ) return [{'username':username, 'password':'', 'roles':roles},] I don't understand why this function seems to be called once for every object on the page? Seems very ineffifcient. It is quite slow. Maybe I should install Zope on a BDC...
----- Original Message ----- From: "Erik Myllymaki" <erik.myllymaki@aviawest.com> To: <erik.myllymaki@aviawest.com> Cc: "Chris Withers" <chris@simplistix.co.uk>; "Bobb" <rawbobb@hotmail.com>; <zope@zope.org> Sent: Monday, May 10, 2004 1:51 PM Subject: Re: [Zope] NT User Authentication
Erik Myllymaki wrote:
Chris Withers wrote:
Erik Myllymaki wrote:
the PDC and zopeserver are on the same switch.
What userfolder are you using?
Chris
exUserFolder.
I have *extended* smbAuthSource.py form exUserFolder. I have a function getNTUserRoles(username) that takes a username and returns the list of groups that user belongs to in the NT DOMAIN. I add this to the roles list, and now, by simply adding a local role (with the same name as the NT group) to an object, all NT users in that group can immediately access this object.
How many users are you enumerating groups for? I would think that using getNTUserRoles(username) for each user would be a lengthy process. If you're doing it over and over again. I'm not sure if this would help, but I would start with the "everyone (or domain users)" group, and then add (in NT) specific roles for zope, but they would be static, and then use them (and them only). unless that's not what make sense in your case. This is beyond me at this point, though, sorry.
def listOneUser(self, username): roles=[] if self.currentPropSource:
roles=self.currentPropSource.getUserProperty(username=username, key='_roles', default=[]) roles = roles + getNTUserRoles(username) if not roles: roles=[] # make sure it's a list...
username = string.lower(username)
zLOG.LOG('smbAuthSource', zLOG.DEBUG, "listOneUser returning {username: '%s', password: '', roles: %s}" % (username, roles) ) return [{'username':username, 'password':'', 'roles':roles},]
I don't understand why this function seems to be called once for every object on the page? Seems very ineffifcient. It is quite slow. Maybe I should install Zope on a BDC...
participants (5)
-
Andrew Veitch -
Bobb -
Chris Withers -
Erik Myllymaki -
Israel Carr