kapilt / getpaid

Automatically exported from code.google.com/p/getpaid
0 stars 0 forks source link

Products.PloneGetPaid.browser.CheckoutAddress __form_fields #217

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Bug in CheckoutAddress:

fields = getattr(self, '__form_fields', None)
if not fields:
    self.__form_fields = cached_value

Because Python treats double-underscore specially, the variable is really
named _CheckoutAddress__form_fields and the shortcut is never taken.

The simplest solution is to remove an underscore: self._form_fields =
cached_value

(For some reason this class is instantiated 2 or 3 times to display the
form, and this property is accessed 5 times each time the address form is
displayed.)

Original issue reported on code.google.com by dho...@gmail.com on 26 Sep 2008 at 5:22

GoogleCodeExporter commented 8 years ago
A try/except AttributeError, e: would be a nice Pythonic solution and would get 
rid
of getattr

Original comment by dho...@gmail.com on 26 Sep 2008 at 5:29