I defined the following table:

db.define_table('css_selectorproperty',
    Field('selector',length=48,default='',notnull=True),
    Field('property',length=36,default='',notnull=True),
    Field('name',length=84,default='',notnull=True,compute=lambda r:
str(r['selector']) + ' ' +
str(r['property']),writable=False,readable=False),
    migrate=False)

db.css_selectorproperty.selector.requires=IS_IN_DB(db,db.css_selector.name,'%
(name)s',zero=None)
db.css_selectorproperty.property.requires=IS_IN_DB(db,db.css_property.name,'%
(name)s',zero=None)
db.css_selectorproperty.name.requires=[IS_LENGTH(84,error_message='length
exceeds 84 characters'),IS_NOT_EMPTY()]

When I insert a record in admin the name field isn't being set, so I
guess this:

compute=lambda r: str(r['selector']) + ' ' + str(r['property'])

is syntactically incorrect. What is the correct syntax? name should
contain a concatenation of the fields selector and property.


Kind regards,

Annet

Reply via email to