Re: [Zope-dev] makerequest.py

2001-04-27 Thread Chris McDonough



 Hi,

 This is quite a useful little utility, but it creates a REQUEST object
without
 any AUTHENTICATED_USER beign present.

Uh huh.


 Should this be remedied? If so, how?

Maybe it should be a parameter of the makerequest function.

 I do have memories that REQUEST.AUTHENTICATED_USER has been deprecated. In
 which, case, how should you get hold of the current user's object and can
this
 be made to work in a testing environment?

from AccessControl import getSecurityManager
user = getSecurityManager().getUser()

And yes, this can be made to work in a testing environment.  You'll always
get the Anonymous User from within a test, however.

For an example of a way to *set* the user with the same facility, see
CoreSessionTracking's SessionDataManager.EventWrapper.__call__ method.

 Nirvana here would be not having to import Zope so that we can run tests
while
 Zope is still up and running in a non-ZEO situation.
 Does ZUnit help with this? If so, how?

Dunno.  It's not really possible if you depend on database operations.  This
is why it's important to factor your products into bits testable outside of
the Zope framework.



___
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] makerequest.py

2001-04-27 Thread Dieter Maurer

Chris Withers writes:
  I do have memories that REQUEST.AUTHENTICATED_USER has been deprecated. In
  which, case, how should you get hold of the current user's object and can this
  be made to work in a testing environment?
Your company is hosting these great searchable list archives?
They help memory very much.

Your question has been answered some days ago...

  getSecurityUser documented in AccessControl.DTML



Dieter

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