Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What about a "Meta" class ? #36

Open
twidi opened this issue Aug 4, 2012 · 4 comments
Open

What about a "Meta" class ? #36

twidi opened this issue Aug 4, 2012 · 4 comments
Labels

Comments

@twidi
Copy link
Collaborator

twidi commented Aug 4, 2012

Considering that we now have a lot of "meta" fields (database, cacheable, abstract, namespace) it could be useful to regroup them in a Meta subclass of the models, "ala" django.

class MyModel(modelRedisModel):
    foo = fields.StringField()
    bar = fields.StringField()

    class Meta:
        database = main_database
        namespace = 'foobar'
        cacheable = False

What do you think about this ?

(And we could put some internal fields in it too : _fields, _redis_attr*, _hashable_fields, removing their underscore)

@stuaxo
Copy link

stuaxo commented May 11, 2016

This would be great, especially for anyone that has seen other ORMs that have Meta

@twidi
Copy link
Collaborator Author

twidi commented May 12, 2016

I know, I use Django everyday for years, and I am always a bit confused when I work with limpyd (which I do every so often)

But as you can guess, it's not easy work, and I really have no time for this (I guess it's more than one day of work)

@stuaxo
Copy link

stuaxo commented May 12, 2016

The main thing is knowing which fields will go in it, then it's relatively straightforward (metaclass just checks for class called "Meta" during construction, then grabs the fields from there.)

@twidi
Copy link
Collaborator Author

twidi commented May 12, 2016

I know how it works, I'm familiar with the internal of django too ;) And you can see some non trivial metaclass in limpyd too.

But "knowing which fields will go in it" is not as easy as it sounds :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants