[Zope-dev] Dynamic formlibs

2008-03-06 Thread Marcelo de Moraes Serpa
Hello,

I have posted this message to the gepaid mailing list but nobody answered
yet, so I thought I would give a try on this mailing list, as this issue is
also related to Zope 3.

Basically I have a fork of PloneGetPaid and did I am doing some major
modification in it to adapt it to my business domain and requirements.

In my modified version of PGP, the ShippingMethod and PaymentProcessor are
not configured Store-wide, instead, they are configured per PayableItem.
When a user creates a new payableitem (which in this particular framework is
actually a custom content type and not regular content types marked by
interfaces) the user can choose what Shipping Method and Payment Processor
to use for this particular item. They are named adapters and I store their
names in the object.

What I would like to do (and have been trying to do without success) is to
have the checkout forms be generated according to metadata defined on both
the IShippingMethod and IPaymentMethod adapters.


When the user chooses to buy a PayableItem, it goes straight to the checkout
process (the checkout view is called in the payable item's view instead of
the portal root). In the checkout-review-pay form's __init__ method, both
named adapters are instantiated (using component.getAdapter
(context,IShipphingMethod,name=context.getShipping_method()).

There's a particular ShippingMethod that doesn't require any fields (only
has some logic that is ran when the order is paid) . For this, I would like
to show a warning in the form (arbitrary HTML) instead of fields, something
like:

This product will be installed by our team, we will contact you with
details

The User contact info and address are queried from the user model.

Also for the PaymentProcessor, different payment processor require different
fields or interface elements.

My idea is to transfer the code that define, create and register the
Transient bags, the code that define the fieldsets and widgets all to these
adapters (IShippingMethod and IPaymentProcessor).

However, I'm not sure yet on what to use to implement it. I thought on using
viewlets, since it would add another layer of abstraction and allow me to
insert html in them.

Please, I really need some help here, what do you experienced getpaid
developers think I should do in order to achieve this?

I think that this idea could make into a good featureset for future getpaid
releases!

Thanks,

Marcelo.
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Character enconding problems in zope.formlib

2008-03-12 Thread Marcelo de Moraes Serpa
Hello,

I'm using zope.formlib to generate some HTML forms and I'm having some
issues with character enconding.

The schema is like the followng:

class IBoletoBancarioPaymentOptions( IPaymentProcessorOptions ):


dias_de_prazo_para_pagamento  =  schema.Int(
   title = _(uNosso número),
   required = True,
   description = _(uNosso
número),
   default = 5,
   )

Note that I'm actually using the u thing before the string, however, even
so, the string is still incorrectly rendered.

The title and description strings get rendered like:

Nosso número (the ú char is not rendered correctly)

The browser is using UTF-8 enconding.

I should mention that I'm using Zope 3 formlib through Five in Plone 3.

How could I solve it? I have no idea where to start.

Thanks.
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Setting the size of a zope.formlib's schema html input

2008-04-06 Thread Marcelo de Moraes Serpa
Hello,

This might sound lik a stupid question, but I couldn't find any simple
solution or answer for this anywhere else, so hopefully someone in this list
knows the answer.

I'm using zope.formlib to generate a simple contact form. It is simple and
effective. But the framework complicates for simple things such as setting
the size of a textfield. I don't want all the textfields to be of the same
size - I want that, depending on the field, the size of the html input will
vary. And that's exactly what I couldn't do as of yet. Does anyone know how
could I set the size of a textfield?

Take this as example:

Telefone = schema.TextLine(title=_(uTelefone para Contato),
  required=True)

Is there an attribute like size or something?

Thanks in advance,

Marcelo.
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Setting the size of a zope.formlib's schema html input

2008-04-07 Thread Marcelo de Moraes Serpa
Thank you all for the replies!

I wouldn't like to use CSS since I would like a self-contained form - all
the data necessary to built the form would be in the schema. I think that
the size of the text inputs, though being presentational in nature, in this
case are **very** specific to the form and vary depending on the semantics
of the fields, so, I don't think moving this data to a CSS would be the best
option.

Could someone show me an example of defining a widget to set the size of the
rendered input?

Marcelo.

On Mon, Apr 7, 2008 at 8:10 AM, Jim Fulton [EMAIL PROTECTED] wrote:


 On Apr 6, 2008, at 9:41 PM, Marcelo de Moraes Serpa wrote:

  Hello,
 
  This might sound lik a stupid question, but I couldn't find any simple
  solution or answer for this anywhere else, so hopefully someone in this list
  knows the answer.
 
  I'm using zope.formlib to generate a simple contact form. It is simple
  and effective. But the framework complicates for simple things such as
  setting the size of a textfield. I don't want all the textfields to be of
  the same size - I want that, depending on the field, the size of the html
  input will vary. And that's exactly what I couldn't do as of yet. Does
  anyone know how could I set the size of a textfield?
 
  Take this as example:
 
  Telefone = schema.TextLine(title=_(uTelefone para Contato),
   required=True)
 
  Is there an attribute like size or something?
 


 Someone (you?) asked this in IRC.

 Schema's (and schema fields) are for specification, not presentation.
 (Yes, the title and description are used for presentation by default.)

 If you want to provide finer control over presentation, provide custom
 widget in the form field definition. (It might be nice if zope.formlib.Field
 provided the ability to provide widget data without having to specify the
 widget.)

 Jim

 --
 Jim Fulton
 Zope Corporation



___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )