@Paweł Stradomski
University of Technology in Gdańsk
Ok. I understood this. But - i must wrote this methods. Simple CRUD
isn't something bad. SQLAlchemy could support something like this:
class User(SQLAlchemy.CRUD):
pass
and give optionaly something like in django. This will be nice. Now i
do for example something like this.
def __new__(cls, *args, **kwargs):
if 'username' in kwargs.keys():
uid = getpwnam(kwargs.get('username')).pw_uid
if 'uid' in kwargs.keys():
uid = kwargs.get('uid')
# @todo - poprawic czytelnosc
if uid:
if meta.Session.query(Informations).get(uid) == None:
return object.__new__(cls, *args, **kwargs)
else:
return meta.Session.query(Informations).get(uid)
else:
return object.__new__(cls, *args, **kwargs)
IMHO this could be standard for all classes (why not). I understood
this SQLAlchemy forces you to write your own class methods wrap
meta.Session - but this isn't cool :P because i waste my time :P
Greetings from Poland
--
Jan Koprowski
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---