Re: [Zope3-Users] set_before_add

2005-10-14 Thread mats.nordgren
On Fri, 14 Oct 2005 15:36:09 +0200, gnotari wrote > I'm at loss: > > I'm replicating the example at cap. 14.3 of Philipp's (Worldcookery) > book. It's all about auto-assigning names to object being added to containers. > > After much tinkering, it does seem to me that this directive > >

Re: [Zope3-Users] set_before_add

2005-10-14 Thread mats.nordgren
On Fri, 14 Oct 2005 16:36:45 +0200, gnotari wrote > > On Fri, 14 Oct 2005 15:36:09 +0200, gnotari wrote > > > I'm at loss: > > > > > > I'm replicating the example at cap. 14.3 of Philipp's (Worldcookery) > > > book. It's all about auto-assigning names to object being added to > > containers. > > >

Re: [Zope3-Users] set_before_add

2005-10-14 Thread mats.nordgren
> Sorry, but it does not solve. > I checked your code, and indeed I implemented the same way. > Indeed, my code works if I make it generate arbitrary names. > > It just does not work if I try to name a new object after one of its > attributes because: > - the attribute value is not set at the time

Re: [Zope3-Users] Seeking Reference Guide on TAL/TALES/METAL

2006-03-31 Thread mats.nordgren
I think the answer to that question is both, but X['Y'] seem to have precedents over X.Y. class MyContainer(OOBTree): title=u'' class MyContent(Persistent): title=u'' Adding MyContent in MyContainer you can traverse MyContainer/MyContent/title or you can traverse MyContainer/title equall

Re: [Zope3-Users] understanding security

2006-04-07 Thread mats.nordgren
Achim, Take a look at homefolder in the trunk. You can find it here: http://svn.zope.org/Zope3/trunk/src/zope/app/homefolder/ It does what you want to do. On Fri, 07 Apr 2006 16:50:50 +0200, Achim Domma wrote > Frank Burkhardt wrote: > > >> Do I understand it right, that I do not grant a perm

[Zope3-Users] Formlib and invariants?

2006-05-03 Thread mats.nordgren
I'm trying to do a join form with formlib and are getting errors when checking invariants. I have my form interface IJoinForm class IJoinForm(Interface): """a join form""" username = schema.TextLine( title=_('User Name'), required=True) password = schema.Password(

Re: [Zope3-Users] Formlib and invariants?

2006-05-04 Thread mats.nordgren
or): > u"""From-Date is after To-Date""" > > # this is needed to adapt to a view for formlib > implements(IWidgetInputError) > > On 03.05.2006, at 20:59, mats.nordgren wrote: > > > I'm trying to do a join form with forml

Re: [Zope3-Users] Composing content objects

2006-05-15 Thread mats.nordgren
>line 23, in IWorkspace value_type=Object(title=u"Object", > description=u"adsf"), in zope/schema/_field.py class Object(Field): __doc__ = IObject.__doc__ implements(IObject) def __init__(self, schema, **kw): < you need to pass a schema as a non key-word if not IInte

Re: [Zope3-Users] ForbiddenAttribute

2006-05-17 Thread mats.nordgren
Look at form.txt in the formlib directory. On Wed, 17 May 2006 11:24:43 -0500, Jachin Rupe wrote > hi there > > thanks for the help. I was just reading somewhere that formlib is > the way to go. Is that the general consensus? > > The problem is, it doesn't look like formlib is covered in eit

RE: [Zope3-Users] How to use catalog.searchResults

2006-05-21 Thread mats.nordgren
> (Pdb) catalog.searchResults(AbbreviationIndex = "ABC") > *** TypeError: ('two-length tuple expected', 'ABC') > (Pdb) catalog.searchResults(["AbbreviationIndex" ,"ABC"]) > *** TypeError: searchResults() takes exactly 1 argument (2 given) > (Pdb) res = catalog.searchResults() > (Pdb) res == None

Re: [Zope3-Users] How to use catalog.searchResults

2006-05-21 Thread mats.nordgren
My bad, should be catalog.searchResults(AbbreviationIndex=('ABC', 'ABC') Field indices expect a high and low as Alen stated Sincerely, Mats On Sun, 21 May 2006 18:49:46 +0200, Florian Lindner wrote > Am Sonntag, 21. Mai 2006 17:58 schrieb mats.nordgren: > >

Re: [Zope3-Users] Maintaining data fields on form edit

2006-05-25 Thread mats.nordgren
This seems to work class EditForm(form.EditForm): form_fields = form.Fields(ISchema) def __init__(self, context, request): self.context, self.request = context, request @form.action('Edit') def handle_edit_action(self, action, data): if data['image'] != None: self.context.i

[Zope3-Users] How do I get formlib to play nice with NameChooser

2006-05-26 Thread mats.nordgren
I've been trying to use NameChooser with formlibs AddForm and it always tells me "An empty name was provided. Names cannot be empty." I suspect it has to do with set_before_add as my object comes in to the NameChooser without data. Problem is that you define formlib forms with http://mail.zope.or

Re: [Zope3-Users] How do I get formlib to play nice with NameChooser

2006-05-26 Thread mats.nordgren
Never mind it was a user error on my part. I was stuffing the data variables in the create function into the context not the object being created. Oooops :) On Fri, 26 May 2006 13:02:42 -0500, mats.nordgren wrote > I've been trying to use NameChooser with formlibs AddForm and it > a

Re: [Zope3-Users] Form-based login utility

2006-06-07 Thread mats.nordgren
Miklos, You should be able to customize the form 'loginform.pt' from zope.app.authentication.browser.  In the session credentials plugin you can then specify the new login form name. Cheers, Mats On Tue, 6 Jun 2006 23:11:18 +0200, Jegenye 2001 Bt (Miklós Prisznyák) wrote > Hello,  >  

Re: [Zope3-Users] Form-based login utility

2006-06-07 Thread mats.nordgren
you can > set up your own login form to be associated with your particular > site base object, if you don't want the login page to have to > service logins for the whole of your zope3 instance, but just a > particular subsite. > > Pete > > On 6/7/06, mats.nordgren &

Re: [Zope3-Users] Assigning roles to principals

2006-06-14 Thread mats.nordgren
Frank, Try this: role_map = IPrincipalRoleManager(context) <== For example root of site. role_map.assignRoleToPrincipal(u'mpgsite.Authenticated', principal_id) I use the above code in an event handler when a site has been created. Instead of specifying the user I specify a group and then add ea

[Zope3-Users] Dict Widget

2006-06-14 Thread mats.nordgren
I'm totally clueless as how to get a dict widget to work. class IMyObject(Interface): mydict = Dict( title=u'My Dict', key_type=TextLine(), value_type=Int()) I see in zope.app.form.browser the config file has no view defined for IDict and ?IField?. Is it just a matter of configurin

Re: [Zope3-Users] Assigning roles to principals

2006-06-14 Thread mats.nordgren
Marco, You need to pass the id not the principal object. principalRoleManager.getRolesForPrincipal(self.request.principal.id) Cheers, Mats On Wed, 14 Jun 2006 20:00:40 +0200, Marco Mariani wrote > How do I get the list of roles for the current principal? > > I've tried > > from zope.app.secu

Re: [Zope3-Users] Dict Widget

2006-06-14 Thread mats.nordgren
Frank, That would be great. If you wish you can email it to me. This should be included in the trunk IMHO. Thanks, Mats On Wed, 14 Jun 2006 21:19:54 +0200, Frank Burkhardt wrote > Hi, > > On Wed, Jun 14, 2006 at 12:39:34PM -0500, mats.nordgren wrote: > > I'm totally clue

Re: [Zope3-Users] list woes

2006-06-14 Thread mats.nordgren
I'm not sure this is it or not but FieldProperty doesn't play nice with the persistent list and dict, it will only accept the non persistent list. >>> class ITest(Interface): ... mylist = List(title=u'My List') ... >>> class Test(Persistent): ... implements(ITest) ... mylist = FieldPro

[Zope3-Users] WingIDE and debugging Zope3.3

2006-06-15 Thread mats.nordgren
I've tried to get WingIDE to work for debugging Zope3 but have only had limited success. I've followed the instructions at wingware.com where it tells you to add the wingdbstub. I added 'import wingdbstub' in $ZOPEINSTANCE/bin/runzope and it will break on errors but will not break on breakpoints.

Re: [Zope3-Users] Access request object from content_factory

2006-06-20 Thread mats.nordgren
John, I have never done it with the addform approach but it is very easily done with formlib. class MyContentAddForm(form.AddForm):   form_fields = form.Fields(IMyContent)   def __init__(self, context, request):     self.context = context     self.request = request   def create(self, data):

Re: [Zope3-Users] Access request object from content_factory

2006-06-20 Thread mats.nordgren
Ooops that should be for="">zope.app.container.interfaces.IAdding" name="AddContent.html" class=".forms.MyContentAddForm" permission="zope.ManageContent" /> Mats On Tue, 20 Jun 2006 23:37:35 -0500, mats.nordgren wrote > John, &

Re: [Zope3-Users] Re: Autocreated content objects

2006-09-25 Thread mats.nordgren
The IntId subscribers are fired on zope.app.container.interfaces.IObjectAddedEvent and IObjectRemovedEvent. Cheers, Mats On Mon, 25 Sep 2006 18:55:11 +0200, Volker Bachschneider wrote > Philipp von Weitershausen schrieb: > > John Maddison wrote: > >> Is it possible/wise to "auto-create" content

Re: [Zope3-Users] Re: Can I use IPython in debugzope stuff ?

2007-01-11 Thread mats.nordgren
Never knew about IPython and really like what I see. Thanks for the hint. I got the debugging to work for Zope3 with the following simple change to the tutorial. IPython.Shell.IPShell(user_ns=locals()).mainloop(sys_exit=1) to IPython.Shell.IPShell(user_ns={'root': root, 'app': app}).mainloop(