[Zope3-Users] Re: formlib, action decorators and inheritance

2006-07-17 Thread Jürgen Kartnaller

Hi Lorenzo.

Lorenzo Gil Sanchez wrote:

Hi,

I have an add form which a subclass of form.AddForm. It just adds a 
'cancel' action.


This is my code:

class AddView(form.AddForm):

Try this here :
  actions = form.AddForm.actions


form_fields = form.Fields(IDocument).omit('__name__')

def create(self, data):
return Document(**data)

def nextURL(self):
url = zapi.absoluteURL(self.context.context, self.request)
return url

@form.action(u'Cancel', validator=always_good)
def handle_cancel(self, action, data):
self.request.response.redirect(self.nextURL())

When I define the 'cancel' action using the @form.action decorator it 
seems that the 'add' action is lost. That action is defined in my super 
class.


As a workaround I do the following:

def handle_cancel(self, action, data):
self.request.response.redirect(self.nextURL())

actions = form.AddForm.actions + form.Actions(
form.Action(u'Cancel',
success='handle_cancel', validator=always_good),
)

but I'm not sure if I'm missing something since my workaround is uglier 
than the decorator solution.


Best regards,

Lorenzo Gil


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: formlib, action decorators and inheritance

2006-07-17 Thread Lorenzo Gil Sanchez

Hi Jürgen,

I did what you say and it's a little bit better.

Thanks

Lorenzo

Jürgen Kartnaller wrote:

Hi Lorenzo.

Lorenzo Gil Sanchez wrote:

Hi,

I have an add form which a subclass of form.AddForm. It just adds a 
'cancel' action.


This is my code:

class AddView(form.AddForm):

Try this here :
  actions = form.AddForm.actions


form_fields = form.Fields(IDocument).omit('__name__')

def create(self, data):
return Document(**data)

def nextURL(self):
url = zapi.absoluteURL(self.context.context, self.request)
return url

@form.action(u'Cancel', validator=always_good)
def handle_cancel(self, action, data):
self.request.response.redirect(self.nextURL())

When I define the 'cancel' action using the @form.action decorator it 
seems that the 'add' action is lost. That action is defined in my 
super class.


As a workaround I do the following:

def handle_cancel(self, action, data):
self.request.response.redirect(self.nextURL())

actions = form.AddForm.actions + form.Actions(
form.Action(u'Cancel',
success='handle_cancel', validator=always_good),
)

but I'm not sure if I'm missing something since my workaround is 
uglier than the decorator solution.


Best regards,

Lorenzo Gil


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users



___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] small bug in z3c.multiform package

2006-07-17 Thread Bernd Dorn


On 17.07.2006, at 09:46, Lorenzo Gil Sanchez wrote:


Hi,

I found a bug in FilterMapping class of the z3c.multiform package.  
Basically the problem is due to the way the __len__ method is  
computed.


Attached is a tiny patch for this bug. Feel free to use any  
copyright ownership you want for it.


thx, it's checked in





Regards

Lorenzo
Index: multiform/gridform.py
===
--- multiform/gridform.py   (revisión: 69125)
+++ multiform/gridform.py   (copia de trabajo)
@@ -129,7 +129,7 @@

 def __len__(self):
 '''See interface `IReadContainer`'''
-return len(self.keys())
+return len(tuple(self.keys()))

 def __contains__(self, key):
 '''See interface `IReadContainer`'''
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Zope3 workflow ?

2006-07-17 Thread Adam Groszer
Hello Thierry,

http://svn.zope.org/Zope3/trunk/src/zope/wfmc/
and
http://svn.z3lab.org/trac/z3lab/browser/z3ecm/trunk/src/ecm/workflow


Monday, July 17, 2006, 5:25:07 PM, you wrote:



  Hi,

I'm looking for components to support workflows in Zope3.
I've read into Zope3 Developer's Handbook a whole chapter about Zope3 workflow 
components and utilities, but these classes don't seem to be part of my current 
Zope3 release (3.3.0b1) anymore...

Any link ?


  Thierry Florac
-- 

  Chef de projet intranet/internet
  Office National des For�ts - D�partement Informatique
  2, Avenue de Saint-Mand�
  75570 PARIS Cedex 12
  M�l : [EMAIL PROTECTED]
  T�l. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85 






-- 
Best regards,
 Groszer Adam
--
Quote of the day:
A student who changes the course of history is probably taking an exam.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Zope3 workflow ?

2006-07-17 Thread Marco Mariani
Thierry Florac ha scritto:
 I'm looking for components to support workflows in Zope3.
 I've read into Zope3 Developer's Handbook a whole chapter about Zope3
 workflow components and utilities, but these classes don't seem to be
 part of my current Zope3 release (3.3.0b1) anymore...

 Any link ?
Look for hurry.workflow by Martijn if you need a simple one, or wfmc in
z3 svn if you need a complex one (with XPDL compatibility, split/join
and everything)

Schooltool uses wfmc.


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users