[Schevo-devel] Field name in field-spec

Tom Locke tom at livelogix.com
Fri Dec 9 08:59:58 EST 2005


>The field_spec is an ordered dictionary of field_name : FieldClass
>pairs.  So field_spec.keys() would get you a list of field names.
>  
>
To clarify:

In [21]:f = db.PhoneNumber.field_spec["person"]

In [22]:type(f)
   [22]:<class 'schevo.field.FieldMeta'>

This 'f' thing has all the details about my field right?

In [24]:f.name
AttributeError: type object 'Entity' has no attribute 'name'

But not its name.

>You might have to provide a more detailed use-case.
>
I needed it at one point, but as my design has moved on, I no longer 
need it, so maybe it's not useful after all :-). Basically I had to pass 
both the FieldMeta and the field name (as a separate param) to some 
function somewhere, and that seemed unnecessary.

It just seems to belong there. in order to make that 'f' a complete 
description of the field, just like:

MyClass.__name__
db.Person.name

A reference from the FieldMeta back to the extent seems appropriate too. 
The name of the field and the extent it belongs to are certainly field 
metadata.

Tom.




More information about the Schevo-devel mailing list