On Thu, 2009-06-04 at 12:33 +0200, Hedley Roos wrote: > > Good thinking 99 ;) > > but unfortunately the client has asked me to autogenerate the usernames > > based on a sequential 4 digit number (betahaus.emaillogin just > > authenticates directly against the member email addresses) so can't use > > that argument unfortunately :( > > > > For your case I'll use a formlib add form. You don't have to write any > UI! Roche came up with this neat approach. > > For this example the content type class is called AccountingFolder but > you'll see the pattern. > > ZCML: > > <browser:page > name="addAccountingFolder" <<< name must match the factory > for="*" > class=".adding.AccountingFolderAddForm" > permission="zope.View" > /> > > > Class: > > class AccountingFolderAddForm(formbase.PageAddForm): > """ > """ > > form_fields = form.FormFields(IAccountingFolder) > > def create(self, data): > title = data['title'] > id = <your algorithm here> > self.contentName = id > > folder = AccountingFolder(id, **data) > folder.setTitle(title) > return folder > > def nextURL(self): > obj = self.context.get(self.contentName) > return "%s/edit" % obj.absolute_url() > > I haven't used this myself but I've seen it in action and it is pretty > damn cool :) > > BTW you'll need to modify the member schema. So you can use > schemaextender or monkey it, but you'll need this: > > schema['id'].regfield = 0 > schema['id'].display_autogenerated = 1
Thank you very much! This looks very promising. I'll give it a go today and report back. Thanks again, Tim > > Hedley > > > -- > Archive: > http://www.openplans.org/projects/remember/lists/remember/archive/2009/06/1244111662728 > To unsubscribe send an email with subject "unsubscribe" to > [email protected]. Please contact > [email protected] for questions. > -- Archive: http://www.openplans.org/projects/remember/lists/remember/archive/2009/06/1244144453802 To unsubscribe send an email with subject "unsubscribe" to [email protected]. Please contact [email protected] for questions.
