AW: [Zope3-dev] Re: Bug in Choice/Vocabulary/widget
Roger ineichen
dev at projekt01.ch
Tue May 18 05:25:12 EDT 2004
Garrett Smith wrote:
> Roger, could you provide steps to recreate the bug you're
> describing below?
>
> -- Garrett
I try.
First you have to go to the file:
src\zope\app\schemacontent\browser\__init__.py
and change the line 80 and 81 form:
getPerm = getattr(self, name+'_get_perm_widget').getData()
setPerm = getattr(self, name+'_set_perm_widget').getData()
to:
getPerm = getattr(self, name+'_get_perm_widget').getInputValue()
setPerm = getattr(self, name+'_set_perm_widget').getInputValue()
The method getData() is wrong, but I'm not shure if
getInputValue() is the right method.
What I did for to run into the Bug,
- Delete the data.sf
- Start Zope3
- Loggend in as Manager
- Go to Utilities
http://localhost:8080/++etc++site/default/Utilities/@@utilities.html
- Click "Add utility"
- Add a util "Content Component Definition"
with the id "ccd"
- In the following form I filled out the fields
Register as: ccd
The permission needed to use the component: zope.View
Registration status: Active
The other fileds I let unchanged.
- Klick Add
- Then you get on the form for to add the schema
- Add buddydemo.interfaces.IBuddy
as a usefull schema. it's in the second half fron down.
(should be sorted by name) :-(
- Click change
So, the content component definition is added.
- Go to the tab "Define Permission" on the
content component definition called "ccd"
- Set a Accessor and Mutator permission on the
field First name, say zope.View
- Now you can do what you whant, I was adding a folder in the root
called folder.
- Then you go back to the Utilities and see the "Define Permission"
content component definition called "ccd", the permission of
the First name are still there.
- Now stop and start the Zope Server.
- Go back to the content component definition called "ccd"
- Go to the "Define Permission" and you see the permission
of First name are gone. I get just (no value) on the
First name Accessor and Mutator permission.
But the permission are set to zope.View.
I could not find out why the permissions are not show
correctly and just available till you restart Zope.
I guess the Choice widget with a "Permission" vocabulary
can't render values and loose their not persistent data.
(but its useing a persistentDict() for to store them.
Perhaps I did a fault in changing getData() to getInputValue()?
But getData() is wrong. (What's the right method?)
The permission itself is set correct, it's just a problem of
rendering the value.
My Zope3 Server is running on Win XP.
Regards
Roger Ineichen
_____________________________
> Roger Ineichen wrote:
> > There is a bug somewhere arround the Choice/Permission
> Vocabulary or
> > the Widget of the Permission Vocabulary.
> >
> > In the file:
> > zope\app\schemacontent\browser\__init__.py
> >
> > at line 80 + 81 there should getData() be change to the
> > method .getInputValue().
> >
> > I'm not shure if it's getInputValue(), but I'm shure
> > getData() is wrong.
> >
> > HEAD:
> > -----
> > line 80: getPerm = getattr(self, name+'_get_perm_widget').getData()
> > line 81: setPerm = getattr(self, name+'_set_perm_widget').getData()
> >
> > should be:
> > ----------
> > line 80: getPerm = getattr(self,
> > name+'_get_perm_widget').getInputValue()
> > line 81: setPerm = getattr(self,
> name+'_set_perm_widget').getInputValue()
> >
> > That's just one part the real Bug I see is:
> > ------------------------------------------
> >
> > If you change the permissions in the ZMI, in the update() method at
> > line 82: perms[name] = (getPerm, setPerm) the permissions are saved
> > back to the persistent dict of the utilty.
> >
> > I you restart the server the permissions are the new saved
> one. There
> > are perssistent how the should be, but the widget doesn't
> show the new
> > permissions. As long as you change the permissions the new
> permissions
> > are shown in the dropdwon box, except you restart Zope.
> >
> > I could not find out why the permission does show correct till you
> > restart Zope?
>
>
>
> _______________________________________________
> Zope3-dev mailing list
> Zope3-dev at zope.org
> Unsub:
> http://mail.zope.org/mailman/options/zope3-> dev/dev%40projekt01.ch
>
>
More information about the Zope3-dev
mailing list