pombreda / formalchemy

Automatically exported from code.google.com/p/formalchemy
MIT License
0 stars 0 forks source link

FieldSet constructor crashes on column_property fields #82

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create an ORM mapping that includes a column_property, eg.:
  sqlalchemy.orm.mapper(MyClass, mytable, properties = {
    'something': column_property(some_sql_expr.label('something')) })
2. Attempt to instantiate a fieldset using this mapped class, eg.:
  fs=FieldSet(MyClass)

What is the expected output? What do you see instead?
An exception is raised:
AttributeError: '_Label' object has no attribute 'nullable'
Module formalchemy.fields:993 in __init__

An ideal solution would probably involve FA automatically recognizing
column_property fields and marking them as read-only. Barring that, it
should be able to instatiate the fieldset without crashing.

What version of the product are you using? On what operating system?
FormAlchemy-1.2-py2.5

Original issue reported on code.google.com by jmayb...@gmail.com on 24 Mar 2009 at 2:47

GoogleCodeExporter commented 9 years ago

Original comment by jbel...@gmail.com on 24 Mar 2009 at 10:24

GoogleCodeExporter commented 9 years ago
fixed in r734

Original comment by jbel...@gmail.com on 26 Mar 2009 at 9:22

GoogleCodeExporter commented 9 years ago
Hi - I still see this happening with Formalchemy 1.3.1 and instrumented 
attributes such as:

    month = deferred(sql.func.date_trunc('month', timelogs_table.c.recordStartDate))
I imagine a fix for this from march 26 would be included in formalchemy by now?

Original comment by damiandi...@gmail.com on 30 Jun 2010 at 12:54

GoogleCodeExporter commented 9 years ago
defered != column_property.

I sugest to open a new ticket with the full traceback and a code snippet to 
reproduce the problem

Original comment by gael.pas...@gmail.com on 30 Jun 2010 at 1:04

GoogleCodeExporter commented 9 years ago
It isn't indeed - but it results in exactly the same error if you use 
column_property!  Have now also tried with FormAlchemy 1.3.3, so it seems this 
has come back?  

File 
'/Users/ddimmich/Src/monipol/trunk/timelogger/timelogger/controllers/main.py', 
line 315 in editTimelog
  c.form = FieldSet(record)
File 
'/sw/lib/python2.5/site-packages/FormAlchemy-1.3.3-py2.5.egg/formalchemy/forms.p
y', line 152 in __init__
  AbstractFieldSet.__init__(self, *args, **kwargs)
File 
'/sw/lib/python2.5/site-packages/FormAlchemy-1.3.3-py2.5.egg/formalchemy/forms.p
y', line 51 in __init__
  base.EditableRenderer.__init__(self, *args, **kwargs)
File 
'/sw/lib/python2.5/site-packages/FormAlchemy-1.3.3-py2.5.egg/formalchemy/base.py
', line 210 in __init__
  L = [fields.AttributeField(attr, self) for attr in attrs]
File 
'/sw/lib/python2.5/site-packages/FormAlchemy-1.3.3-py2.5.egg/formalchemy/fields.
py', line 1413 in __init__
  if not self.is_collection and not self.is_readonly() and [c for c in _columns if not c.nullable]:
AttributeError: 'Function' object has no attribute 'nullable'

Original comment by damiandi...@gmail.com on 30 Jun 2010 at 3:16