[Zope-dev] Problem with LoginManager, UserSource and object re-mapping

Itai Tavor itai@optusnet.com.au
Mon, 30 Oct 2000 13:11:29 +1100


Hi,

I have the following setup:

- LoginManager with 3 UserSources, one of them named CustomerUserSource.

- A Customers specialist, using a Customer ZClass for storage. 
Customer has a 'login' propertysheet with property 'password', and a 
getCustomerByName method returning a customer object.

- CustomerUserSource 'load by accessing attribute' is set to 'id'.

- A SkinScript in CustomerUserSource:

     WITH Customers.getCustomerByName(Customers, self.id) COMPUTE
     password=password, original_object=RESULT


The following PythonMethod:

     obj=self.CustomerUserSource.getItem('jane')
     return obj.password

returns the correct password for customer 'jane', but this one:

     obj=self.getItem('jane')
     return obj.password

returns this:

NameError

password

Troubleshooting Suggestions

           This resource may be trying to reference a nonexistent object or
           variable password.
           The URL may be incorrect.
           The parameters passed to this resource may be incorrect.

     If the error persists please contact the site maintainer. Thank 
you for your patience.



Traceback (innermost last):
   File /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, 
line 222, in publish_module
   File /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, 
line 187, in publish
   File /opt/Zope-2.2.2-linux2-x86/lib/python/Zope/__init__.py, line 
221, in zpublisher_exception_hook
     (Object: ProviderContainer)
   File /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, 
line 171, in publish
   File /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/mapply.py, 
line 160, in mapply
     (Object: test3)
   File /opt/Zope-2.2.2-linux2-x86/lib/python/ZPublisher/Publish.py, 
line 112, in call_object
     (Object: test3)
   File /opt/Zope/lib/python/Products/PythonMethod/PythonMethod.py, 
line 168, in __call__
     (Object: test3)
     (Info: ((<LoginManager instance at 875a590>, ....), {}, None))
   File <string>, line 8, in test3
     (Object: ProviderContainer)
   File /opt/Zope/lib/python/Products/ZPatterns/DataSkins.py, line 
181, in __get_attr__
     (Object: BetterLocalRolesMixin)
   File /opt/Zope/lib/python/Products/ZPatterns/AttributeProviders.py, 
line 346, in _AttributeFor
     (Object: GAPMixin)
   File /opt/Zope/lib/python/Products/ZPatterns/AttributeProviders.py, 
line 335, in _AttributeFor
     (Object: GAPMixin)
   File /opt/Zope/lib/python/Products/ZPatterns/Expressions.py, line 
122, in eval
   File 
/opt/Zope-2.2.2-linux2-x86/lib/python/DocumentTemplate/DT_Util.py, 
line 337, in eval
     (Object: password)
     (Info: password)
   File <string>, line 0, in ?
NameError: (see above)


I don't understand why a direct getItem() call to CustomerUserSource 
would trigger the WITH...COMPUTE line, while just doing getItem() on 
the LoginManager doesn't? As I understand it, getItem() calls each 
UserSource, so why would there be a difference in behavior?

TIA,

Itai
-- 
Itai Tavor                    "Je sautille, donc je suis."
C3Works    itai@c3works.com              - Kermit the Frog

"If you haven't got your health, you haven't got anything"