OK, I guess I just solved the problem :)

*it was:*

class Article(BaseModel):
        tablename = "article"
        properties = [
                      # main
                      Field("author", "reference auth_user"),
                      Field("author_nickname", "string"),
                      Field("title", "string"),

*Now it is:*

class Article(BaseModel):
    def set_model(self):
        self.tablename = "article"
        self.properties = [
                      # main
                      Field("author", "reference auth_user"),
                      Field("author_nickname", "string"),
                      Field("title", "string"),


I figured out that I cant use Field as class attribute and I need to use it
as instance atribute.

*I wanted to do it (which is more idiomatic):*

class Article(BaseModel):
    def set_model(self):
        self.tablename = "article"
        self.name = Field("author", "reference auth_user")
        self.author = Field("author_nickname", "string")
        self.author_nickname = Field("title", "string")

So I could use "inspect" or dir(article) to get all properties, iterate and
isolate the FIeld's to build the table, But I can't ensure the order as
dir() and inspect.get_members() returns unordered dict of attributes.

I think it is solved by now, In modules qe can't define dynamic attributes
in top level of module or class, all needs to be inside instances! (even
the imports)

Thanks.

-- 

Bruno Rocha
[http://rochacbruno.com.br]

Reply via email to