Re: [Zope-dev] LoginManager ownership bug!

2000-10-06 Thread Jonas Juselius

Thanks!

I actually tried to make _owner a class attrib, but then I tried to add a LM
to a sub-folder ;-) It didn't work out... Would it be an ugly solution to
check whether the LM _is_ top-level, and if it is, make _owner a class attrib?
Would it work? Or is this solution only curing the symptoms, while the
patient is dying of cancer?

I also realized that LM:s support local roles, and I had it pointed out to me
that the reason for the default behaviour, is the scaling of Zope... I now have
a different scheme in mind...

Take care,
 .jonas.

On Fri, Oct 06, 2000 at 04:01:01PM +, Ty Sarna wrote:
> In article <[EMAIL PROTECTED]>,
> Jonas Juselius  <[EMAIL PROTECTED]> wrote:
> > The problem has to do with the ownership of the acl_users. When the
> > LoginManager (acl_users) is created it sets the _owner attribute to
> > UnownableOwner. This is fine, for if the acl_users folder is owned it results
> ...
> > The problem is that the acl_users folder becomes _owned_ (by whom I don't
> > know) every time Zope is restarted, or when any method is edited or added in
> 
> I think this is due to Shane's fix for allowing LM's as non-top-level
> acl_users. I had it originally so that _owner was a class attribute,
> which works fine. With the change, it was added as an instance
> attribute. Now, UnownableOwner is just an empty list, []. Zope checks
> for UnownableOwner using an identity check, that is in python: "_owner is
> UnownableOwner". When the LM is pickled to ZODB and reloaded, _owner is
> still an empty list, but it's not *the* empty list. That is, in python
> terms: it's still *equal* to UO, but it isn't "is" UO.
> 
> We could go back to just having it as a class attribute, but then that
> breaks when adding a LM anywhere other than the top folder, because Zope
> wants to delete the _owner from it.
> 
> > Another thing which I have tried to do, is to add  support for local roles to 
> > the LoginManager. At first it looked rather simple, but then I realized that
> > it wasn't really _that_ simple, and dropped it because I don't have time... It
> > would however be nice to have local roles support in the LoginManager, as it
> > would make it more complete.
> 
> LM supports local roles fine. Unfortunately, the Zope's treatment of
> them doesn't scale (a listview just doesn't work for 1500 users, and
> other parts of the machinery want to do things like "Get me a list of
> all local roles for all users" just so that it can see if *one* user has a
> specific role or set of roles.) We've submitted patches for some things,
> but not gotten much interest from DC.
> 
> ___
> 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 )

-- 
And what is good, Phaedrus,
And what is not---
Need we ask anyone to tell us these things?

[ PGP public key: http://www.iki.fi/jonas/pubkey.asc ]

___
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] LoginManager ownership bug!

2000-10-06 Thread Phillip J. Eby

At 04:01 PM 10/6/00 +, Ty Sarna wrote:
>
>I think this is due to Shane's fix for allowing LM's as non-top-level
>acl_users. I had it originally so that _owner was a class attribute,
>which works fine. With the change, it was added as an instance
>attribute. Now, UnownableOwner is just an empty list, []. Zope checks
>for UnownableOwner using an identity check, that is in python: "_owner is
>UnownableOwner". When the LM is pickled to ZODB and reloaded, _owner is
>still an empty list, but it's not *the* empty list. That is, in python
>terms: it's still *equal* to UO, but it isn't "is" UO.
>
>We could go back to just having it as a class attribute, but then that
>breaks when adding a LM anywhere other than the top folder, because Zope
>wants to delete the _owner from it.

Actually, Ty, AFAIK this is now fixed in Zope 2.2.x;  IIRC Brian made some
changes to the ownership machinery to deal with _owner being a class
variable.  We should probably put out a new LM release to go with ZPatterns
0.4.3.


___
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] LoginManager ownership bug!

2000-10-06 Thread Ty Sarna

In article <[EMAIL PROTECTED]>,
Jonas Juselius  <[EMAIL PROTECTED]> wrote:
> The problem has to do with the ownership of the acl_users. When the
> LoginManager (acl_users) is created it sets the _owner attribute to
> UnownableOwner. This is fine, for if the acl_users folder is owned it results
...
> The problem is that the acl_users folder becomes _owned_ (by whom I don't
> know) every time Zope is restarted, or when any method is edited or added in

I think this is due to Shane's fix for allowing LM's as non-top-level
acl_users. I had it originally so that _owner was a class attribute,
which works fine. With the change, it was added as an instance
attribute. Now, UnownableOwner is just an empty list, []. Zope checks
for UnownableOwner using an identity check, that is in python: "_owner is
UnownableOwner". When the LM is pickled to ZODB and reloaded, _owner is
still an empty list, but it's not *the* empty list. That is, in python
terms: it's still *equal* to UO, but it isn't "is" UO.

We could go back to just having it as a class attribute, but then that
breaks when adding a LM anywhere other than the top folder, because Zope
wants to delete the _owner from it.

> Another thing which I have tried to do, is to add  support for local roles to 
> the LoginManager. At first it looked rather simple, but then I realized that
> it wasn't really _that_ simple, and dropped it because I don't have time... It
> would however be nice to have local roles support in the LoginManager, as it
> would make it more complete.

LM supports local roles fine. Unfortunately, the Zope's treatment of
them doesn't scale (a listview just doesn't work for 1500 users, and
other parts of the machinery want to do things like "Get me a list of
all local roles for all users" just so that it can see if *one* user has a
specific role or set of roles.) We've submitted patches for some things,
but not gotten much interest from DC.

___
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] LoginManager ownership bug!

2000-10-06 Thread Michael Bernstein

Jonas Juselius wrote:
> 
> Do you have any clue about the ownership bug in the LoginManager? I find it
> quite strange that an unowned object becomes owned whenever Zope is restarted
> (or when a method is added...). I suspect that the problem is within the
> ZPatterns modules, since it handles the persistance of the LoginManager...
> This is how the LoginManager is inited and ownership is set:

No, sorry.

What I did while hacking on LM was create it in a subfolder,
mess with it until it worked right, then (as superuser) copy
it, switch to the root folder, delete the acl_users folder
there, and paste the LM (also named acl_users, of course).

After that, it just worked, so I never encountered your
particular problem.

Michael Bernstein.

___
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] LoginManager ownership bug!

2000-10-06 Thread Jonas Juselius

Cheers!

I actually tried to implement support for local roles in almost exactly the 
same way as you did, but for some reason I didn't get it to work. 
Perhaps I should look into the matter again... I just threw in the 
user_names(), and getUserNames() into the LoginManager, added some dtml to
handle SQL and... it didn't work, so I dropped it... ;-) I'll try to come up
with some nice way to handle local roles in a proper way in the LoginManager,
and hope that I get my patches accepted :-)

Do you have any clue about the ownership bug in the LoginManager? I find it
quite strange that an unowned object becomes owned whenever Zope is restarted
(or when a method is added...). I suspect that the problem is within the
ZPatterns modules, since it handles the persistance of the LoginManager...
This is how the LoginManager is inited and ownership is set:

ob=LoginManager()
ob._owner=UnownableOwner
self._setObject('acl_users', ob)

I tried to make _owner a global attribute of the LoginManager, but that didn't
solve the problem. I have also written Ty Sarna, but I have not received any
response yet.

One more thing... I'm new to PythonMethods, and I would like to know how to
get access to the self attirbute (or the DTML namespace if you like) from
PythonMethods. I would like to use PythonMethods more, beacuse dtml quickly
becomes unreadable and ugly, and Python is always beautiful :-) 

Have a nice day,
 .jonas.

On Thu, Oct 05, 2000 at 08:11:45AM -0700, Michael Bernstein wrote:
> Jonas Juselius wrote:
> >
> > Another thing which I have tried to do, is to add  support for local roles to
> > the LoginManager. At first it looked rather simple, but then I realized that
> > it wasn't really _that_ simple, and dropped it because I don't have time... It
> > would however be nice to have local roles support in the LoginManager, as it
> > would make it more complete.
> > 
> > I am currently using Zope-2.2.1 (and Zope-2.2.2), ZPatterns-0-4-2a1 and
> > LoginManager-0_8_7a1.
> 
> I used Membership 0.7.6 on top of what you've got, and added
> support for local roles as detailed in this posting:
> 
> http://lists.zope.org/pipermail/zope-dev/2000-September/007030.html
> 
> This ought to give you the clues you need to add the
> neccessary getUserNames method to a SQL User Source, and
> make the LoginManager user_names modification as well. If
> you have any ideas on how to generalize the user_names
> method, I'd like to hear them.
> 
> Let me know how it goes,
> 
> Michael Bernstein.

-- 
And what is good, Phaedrus,
And what is not---
Need we ask anyone to tell us these things?

[ PGP public key: http://www.iki.fi/jonas/pubkey.asc ]

___
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] LoginManager ownership bug!

2000-10-05 Thread Michael Bernstein

Jonas Juselius wrote:
>
> Another thing which I have tried to do, is to add  support for local roles to
> the LoginManager. At first it looked rather simple, but then I realized that
> it wasn't really _that_ simple, and dropped it because I don't have time... It
> would however be nice to have local roles support in the LoginManager, as it
> would make it more complete.
> 
> I am currently using Zope-2.2.1 (and Zope-2.2.2), ZPatterns-0-4-2a1 and
> LoginManager-0_8_7a1.

I used Membership 0.7.6 on top of what you've got, and added
support for local roles as detailed in this posting:

http://lists.zope.org/pipermail/zope-dev/2000-September/007030.html

This ought to give you the clues you need to add the
neccessary getUserNames method to a SQL User Source, and
make the LoginManager user_names modification as well. If
you have any ideas on how to generalize the user_names
method, I'd like to hear them.

Let me know how it goes,

Michael Bernstein.

___
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] LoginManager ownership bug!

2000-10-05 Thread Jonas Juselius

Hola,

There seems to be a problem with the ownership model in Zope (or ZPatterns). 

The problem is the following: I have implemented a nice login system based on
the LoginManager and SQL methods. I would like to make this acl_users the
top level user folder, but... then hell brakes lose... 

The problem has to do with the ownership of the acl_users. When the
LoginManager (acl_users) is created it sets the _owner attribute to
UnownableOwner. This is fine, for if the acl_users folder is owned it results
in various errors: Excessive recursion or ValueError: unpack list of wrong
size (when logging in), IndexError: list index out of range (when trying to
view ownership info of acl_users). This has to do with the top-level folder
being unowned, it seems. There is no problem with the LoginManager being owned
in a folder which is owned itself.

The problem is that the acl_users folder becomes _owned_ (by whom I don't
know) every time Zope is restarted, or when any method is edited or added in
the acl_users folder. It seems that the _owned attribute is not persistent, or
that something, somewhere changes it. I have a dirty fix for the moment,
consisting of an external method which sets the ownership of acl_users to
UnownableOwner. This is however a far from satisfying solution...

Another thing which I have tried to do, is to add  support for local roles to 
the LoginManager. At first it looked rather simple, but then I realized that
it wasn't really _that_ simple, and dropped it because I don't have time... It
would however be nice to have local roles support in the LoginManager, as it
would make it more complete.

I am currently using Zope-2.2.1 (and Zope-2.2.2), ZPatterns-0-4-2a1 and 
LoginManager-0_8_7a1.

Best regards, 
  .jonas.


--
***
 Jonas Juselius   e-mail...: [EMAIL PROTECTED]
  voice: +358 9 191 40188 
 P.O. Box 55/ Department of Chemistry GSM..: 040 506 6599 
 FIN-00014 University of Helsinki fax..: +358 9 191 40169 
 FINLAND  http://www.iki.fi/jonas   

 Home address:
  Helsinginkatu 16 B 42   tel..: +358 9 753 3369
  00500 Helsinki
  FINLAND
***
[ GPG public key: http://www.iki.fi/jonas/pubkey.asc ]


___
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 )