[Zope3-Users] Question/Problem with UserPreferences

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Jun 10 08:06:52 EDT 2005


On Thursday 09 June 2005 12:44, Florian Lindner wrote:
> Hello,
> I try to use the User Preference API.
>
> I've defined a Interface:
>
> class IUserSettings(Interface):
>     email = TextLine(
>                 title = u"E-mail Address")
>
> and registered it in my configure.zcml:
>
>     <preferenceGroup
>         id="UserSettings"
>         title="Basic User Settings"
>         schema=".interfaces.IUserSettings"
>     />
>
> First question: What happens if two configure.zcml files register a
> preference group with the same name?

You should get a conflict error, since preference groups are simply utilities.

> When I go to http://localhost:8080/++preferences++ I see a page which -
> amoung others - displays my preferencce group.
> http://localhost:8080/++preferences++/UserSettings displays only my group.

That's correct.

> I try to use the value of email in a ZPT:
>
>       E-Mail: <span tal:replace="++preferences++/UserSettings/email" />
>
> or
>
>       E-Mail: <span tal:replace="++preferences++UserSettings/email" />
>
> both give this traceback:
>
> PTRuntimeError: ['Compilation failed', 'zope.tal.taldefs.TALError: Invalid
> variable name "email" in expression \'++preferences++UserSettings/email\',
> at line 6, column 15']
>
> What is wrong there?

This is not a preferences error, but a pagetemplate one. I have no clue what 
could have gone wrong here. Can you try a different name? Maybe something 
like `email1`? I suspect a clash of variable names.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list