Re: [Zope3-Users] formlib vs. cancel button

2007-02-14 Thread Dennis Schulz

I dont know if it is the proper way,
but when I return an empty string there is no validation error.

This was also one of the strangest things I found out with formlib.

Dennis

Martin Aspeli escribió:

Hi,

I really thought I knew how to do this, but now I can't get it to work 
and I'm really confused.


I have a formlib EditForm, with an action like this:

@form.action(Cancel, validator=lambda *args, **kwargs: True)
def handle_cancel_action(self, action, data):
nextURL = self.nextURL()
if nextURL:
self.request.response.redirect(self.nextURL())
return ''

However, I still get validation errors when I click Cancel. I also 
tried a validator to return None, and no validator at all, and 
validator=None, they all have the same effect.


Is there a proper/easy way of doing this?

Martin

___
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


[Zope3-Users] redirect to views dynamically

2007-02-06 Thread Dennis Schulz

Hello List,

one question about views:

I know that is is possible to register a default view for an object.
Is there a way to decide, at runtime, which view to call?

Maybe a traversal adapter can do this,but is there an easier way?

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


Re: [Zope3-Users] default text for dropdown widget empty selection

2007-01-02 Thread Dennis Schulz
You can override the setupWidgets() method of your formlib class and 
write something like this. (assuming that project is your dropdown field 
and your view is called MyAddingView)


def setUpWidgets(self, ignore_request=False):
   super(MyAddingView, 
self).setUpWidgets(ignore_request=ignore_request)

   self.widgets['project']._messageNoValue = (no project)


The thing that bothers me is that once you assign a value it is not 
possible to set it back to no value.

Anyone knows how to fix this?


Dennis



Roy Mathew escribió:

Hi Folks,

Currently, the builtin dropdown widgets show the string '(no value)'
as the empty default. Is it possible to show different text in its
place?

  



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


[Zope3-Users] 3 step selection widget

2006-12-21 Thread Dennis Schulz

hello,

I have the current use case to write a 3 step-selection widget.
The user has to choose 1. Division, 2. Cost Center and 3. Budget (which 
is the actual choice)
So I need 3 different vocabularies that change according to the current 
context.

It would be nice to have a onChange event.

Anyone has done something similar before?

Thanks, Dennis

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


[Zope3-Users] Zope 3 UML Model / Architecture

2006-12-18 Thread Dennis Schulz

I am looking for examples of Zope 3 UML Diagrams / Architecture.
I would be especially interested  in widget / view rendering. (maybe 
even formlib) but also basic architecture.



Dennis

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


[Zope3-Users] better selection widget

2006-12-15 Thread Dennis Schulz
also if this is just to select a supplier from the table, i'd 
recommend having a look at the vocabulary framework... i put together 
a really simple one for the states vocabulary in orgpeople, but you 
can do more complex examples, see zope.schema/sources.txt it allows 
you to bind a vocabulary to context before fetching values.


thanks i will have a closer look to it. I also have phillip's new book 
now and there is a section about voabularies and sources.


so in your opinion, what would be the most sane way to have a supplier 
selection (being part of a purchase requisition edit form) on a 
different screen?
(I would like to have a more sophisticated supplier selection where you 
have a table view with search filter and possibility to create a new one)


I thought of many possibilities, probably half of it is nonsense:

- right now I have it like this (not very good solved at all): I use an 
objectwidget in the purchase requisition edit, that only serves as 
display and contains a button to the supplier container that is 
acquisitioned from the mapped instance.
here I link every entry in the table with a link like 
purchaserequisitions/3/suppliers/4/@@selectthissupplier.
Here I would like to assign prinstance.supplier = thissupplier, but of 
course thissupplier not provides IObject (Objectwidget) which leads to 
an error. direct db update here is nonsense because I want the update 
only when the complete transaction of the predit form is 
savedso its a one way.


- I can see clearly that this is nonsence, because  I am not 
correctly using the schema, the supplier relation has to be a IChoice 
and not an IObject. Maybe it is also nonsence to have the business logic 
in the __call__ method of @@selectthissupplier view, I would like to 
have an action here but I think if you render the table with zc.table it 
is not possible to have an action for every single row, is it?


- so it would be possible to take the ItemsWidgetBase (already contains 
a vocabulary) and build a custom view upon that shows the details of the 
currently selected supplier and offers a button supplier select to the 
table view. However,
I think it is difficult to have the table view updating the parent edit 
form. Actually when the table view is an independent view it is not a 
parent form at all, I have to do the updates manually, in addition to 
that the previously entered request data will probably be lost when I 
dont pass it manually.


- probably the best option is, I recently thought, is to pack the table 
selection view into a somehow modified sequence selection widget, that 
has a source / vocabulary having all action happening same form but only 
show this widget and hide everything else.
so we would achieve to have all previously entered data on the edit form 
still in the request easily and have a true parent form - child form 
relation.



Dennis

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


[Zope3-Users] which widget to subclass for custom widget?

2006-12-08 Thread Dennis Schulz
Sorry I have to bother you once more regarding formlib  co  :-)  
(really sorry)


In my application I need something very user defined

In the Edit Form Edit Purchase Requisition I would like to have a 
section Supplier Selection, that should operate as a widget.


Basically I will use a schema Choice Field as a base, I will just 
create another view for the choice than the default select field.
The whole thing should be seen as generic that returns a value at the 
end that should be validated and saved: the supplier id

(which is the idea of widgets in general what I understood until now)

Here the details, should include the following:
- question new supplier? radiobuttons yes / no (onchange event to 
disable / enable textfields that are part of the same widget)
- 2 textfields name+address that allow to enter the new supplier info 
(disabled when above selection no)

- link to an independent supplier selection page (with search and list view)
- the selection made in the supplier selection page should be updated in 
the widget as well (overwrite setupWidgets method I think)


when applying the form, check in the custom _validate method of my 
widget, if radiobutton yes / no.

when yes then add new supplier else just check if value is already in table.


So far the theory, now the first question is, which widget to subclass?

SelectWidget, ItemWidgetBase contain vocabulary and probably too high level.
SimpleInputWidget seems the better choice?

Dennis



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


[Zope3-Users] Widget Error on direct __call__ with pt

2006-12-07 Thread Dennis Schulz

Hello,


I am using the following code for a sequence widget.


class TableRecordSequenceWidget(ListSequenceWidget):
   def __init__(self, context, field, request, template_='', 
subwidget=None):

   super(TableRecordSequenceWidget, self).__init__(
   context, field, request, subwidget)
   def __call__(self):
   render sth


It works good as long as I write the rendered html directly in the 
__call__ method.
But after a while it gets dirty, I would like to have it in a page 
template..


However when I try to change it to return a page template in the call 
method,


(like I found it in many examples)

   def __call__(self):
   class TemplateObjectWidgetView(ObjectWidgetView):
   template = ZopeTwoPageTemplateFile(itemwidget.pt)
   template = TemplateObjectWidgetView(self, self.request)
   return template()

I have the following error:

Any help? Again, the version without the page template works perfectly

   td tal:define=widget python:view.widgets.get('items')  
div class=CellsTableRowListHeader 
tal:content=structure widget/div

   /td


 Module ZPublisher.Publish, line 115, in publish
 Module ZPublisher.mapply, line 88, in mapply
 Module ZPublisher.Publish, line 41, in call_object
 Module zope.formlib.form, line 898, in __call__
 Module zope.formlib.form, line 892, in render
 Module Shared.DC.Scripts.Bindings, line 311, in __call__
 Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
 Module Products.PageTemplates.PageTemplateFile, line 113, in _exec
 Module Products.PageTemplates.PageTemplate, line 104, in pt_render
  - ImplicitAcquirerWrapper object at 0x05BA8110
 Module TAL.TALInterpreter, line 238, in __call__
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 749, in do_useMacro
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 457, in do_optTag_tal
 Module TAL.TALInterpreter, line 442, in do_optTag
 Module TAL.TALInterpreter, line 437, in no_tag
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 749, in do_useMacro
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 457, in do_optTag_tal
 Module TAL.TALInterpreter, line 442, in do_optTag
 Module TAL.TALInterpreter, line 437, in no_tag
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 780, in do_defineSlot
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 457, in do_optTag_tal
 Module TAL.TALInterpreter, line 442, in do_optTag
 Module TAL.TALInterpreter, line 437, in no_tag
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 728, in do_defineMacro
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 772, in do_defineSlot
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 728, in do_defineMacro
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 780, in do_defineSlot
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 772, in do_defineSlot
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 749, in do_useMacro
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 457, in do_optTag_tal
 Module TAL.TALInterpreter, line 442, in do_optTag
 Module TAL.TALInterpreter, line 437, in no_tag
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 780, in do_defineSlot
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 457, in do_optTag_tal
 Module TAL.TALInterpreter, line 442, in do_optTag
 Module TAL.TALInterpreter, line 437, in no_tag
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 749, in do_useMacro
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 457, in do_optTag_tal
 Module TAL.TALInterpreter, line 442, in do_optTag
 Module TAL.TALInterpreter, line 437, in no_tag
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 749, in do_useMacro
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 457, in do_optTag_tal
 Module TAL.TALInterpreter, line 442, in do_optTag
 Module TAL.TALInterpreter, line 437, in no_tag
 Module TAL.TALInterpreter, line 281, in interpret
 Module TAL.TALInterpreter, line 647, in do_insertStructure_tal
 Module Products.PageTemplates.TALES, line 221, in evaluate
  - URL: index
  - Line 286, Column 4
  - Expression: standard:'widget'
  - Names:
 {'container': PurchaseRequisition at 
/Plone/purchaserequisition.2006-11-29.5884219316/pr/196,
  'context': PurchaseRequisition at 
/Plone/purchaserequisition.2006-11-29.5884219316/pr/196,
  'default': Products.PageTemplates.TALES.Default instance at 
0x017EB5F8,
  'here': 

[Zope3-Users] Formlib: passing default values

2006-12-04 Thread Dennis Schulz

Hello,

In my Formlib based add form, I would like to pass a value through that 
should not be edited (readonly) and only be viewed (for_display = True)

I also preset the field  (get_rendered = default)

Problem: The field is not included into the form_fields and None value 
provokes DB Insertion Error.
As soon as I use the input field (for_display = False) everything works 
fine and the Value is not None


When I try to choose a different widget - same error

How can I provoke that a display field is also included in the field set?
Is there a way to provoke the getInput or something?

Dennis

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


[Zope3-Users] Formlib: passing default values

2006-12-04 Thread Dennis Schulz

Hello,

In my Formlib based add form, I would like to pass a value through that
should not be edited (readonly) and only be viewed (for_display = True)
I also preset the field  (get_rendered = defaultvalue)

Problem I have:
The field is not included in the set and has None value after submiting
which provokes a DB Insertion Error.
As soon as I use the input field (for_display = False) everything works
fine and the Value is not None

When I try to choose a different widget - same error

How can I provoke that a display field is also included in the field set?
Is there a way to provoke the getInput or something?

This problem I only have with AddFormbase.

EditFormbase works fine.


Dennis

___
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


[Zope3-Users] formlib widget

2006-11-29 Thread Dennis Schulz

Hi,

in a formlib based form I would like to have more control over the 
rendering of the widgets.
is it possible to call widget with a specific name directly instead of 
running through all on a repeat loop?

for example

 div tal:define=name string:1;
 w1 view/widgets.get(name) 

I saw that there is a get method but I can't access it form the page 
template.


Dennis

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


[Zope3-Users] SVN

2006-11-25 Thread Dennis Schulz

How to get access to the svn

http://svn.zope.org/zc.datetimewidget/trunk/src

I can't access it neighter with eclipse nor with tortoise svn. (PROBFIND 
REQUEST FAILED)

Where can I get a login?

Dennis

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


[Zope3-Users] zc.table delete action column

2006-11-22 Thread Dennis Schulz

Hi List,

I would like to make a column in my zc.table based table that renders a 
trash icon link to a delete handler function inside the same class.


Is it possible somehow to insert a real action like in formlib inside 
a table column?
I could use a submitColumn and link to the same form, but that seems a 
litte buggy to me.

Can I call an action handler manually through the web?


Dennis



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