Re: [Zope3-Users] Using 'if object' evaluates false even if object exists

2007-04-12 Thread Aleksander Kowalczyk

On 4/12/07, Giovannetti, Mark [EMAIL PROTECTED] wrote:


Hi list,

Hope everyone's having a splendid day/evening/whatever.

I've encountered a strange error.  I have two chunks
of nearly identical code below.  The only difference
is the first if statement.  One has:

if context:

the other has:

if context is not None

The first fails to be true even if context is not None.
This can be seen by the output from the logs showing the
context variable as:



Possibly a context is a container-like object.
For containers operation
if context is equal to if len(context)  0.  So even if context is not
None, it still may be False if the container does not contain any elements.
___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] vary formlib render_submit_button by skin

2007-04-19 Thread Aleksander Kowalczyk

On 4/19/07, Christian Theune [EMAIL PROTECTED] wrote:


Am Mittwoch, den 18.04.2007, 17:09 -0400 schrieb Fred Drake:
 On 4/18/07, Leonardo Rochael [EMAIL PROTECTED] wrote:
  I was looking at formlib and I found that If i want to customize
widgets per
  skin, I just have to register their view to a different type, e.g.:

 As you can for all views.

  However I found no such way of customizing the render_submit_button
adapter
  per-skin. All examples I found of the action renderer declarations are
like
 ...
  Is there any way of specializing the action rendering per-skin? I
expect
  there to be one since it's html generation, which should be skinnable.

 It should be, but isn't.  :-(  I've run up against this as well, and
 working around it is more painful than it should be.

Do you consider it a bug? Is it tracked somewhere already?



I think I have similar problem with action renderer: I would like to attach
a javascript handler for my action button.
Unfortunately the renderer seems to not allow to pass any additional
attributes for the html button (like onclick attribute).

Leonardo,
you mentioned about overriding the renderer adapter. This could also solve
my problem, if possible. How to do that?

Regards!
_
Alek Kowalczyk
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] vary formlib render_submit_button by skin

2007-04-19 Thread Aleksander Kowalczyk

On 4/19/07, Marius Gedminas [EMAIL PROTECTED] wrote:


On Thu, Apr 19, 2007 at 11:20:07AM +0200, Aleksander Kowalczyk wrote:
 I think I have similar problem with action renderer: I would like to
attach
 a javascript handler for my action button.
 Unfortunately the renderer seems to not allow to pass any additional
 attributes for the html button (like onclick attribute).

Yes.  I recently needed to add a CSS class to an action button (in Zope
3.2 -- there's no time to port to 3.3/3.4 because Customers Demand
Features).  In the end I subclassed zope.formlib.form.Action and made
render a regular method that did what I wanted it to do.

 Leonardo,
 you mentioned about overriding the renderer adapter. This could also
solve
 my problem, if possible. How to do that?

Reading zope/formlib/namedtemplate.txt might help.  You either have to
use ZCML overrides, or subclass zope.formlib.form.Action (or
attach marker interfaces to its instances, although that might not work
given its copy-on-__get__ descriptorish behaviour).



Can I somehow override this directive (from formlib/configure.zcml) in my
instance's etc/overrides.zcml ?
 adapter factory=.form.render_submit_button name=render /

I think I asked about similar thing some time ago - and the response I
received was no...

Regards!
Alek




--
_
Alek Kowalczyk
http://iblog.blox.pl
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users