Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (16 sloc) 481 Bytes
from ext import db
class BaseMixin(object):
def create(cls, **kw):
session = db.session
if 'id' in kw:
obj = session.query(cls).get(kw['id'])
if obj:
return obj
obj = cls(**kw)
return obj
def __eq__(self, other):
return all([getattr(self, attr) == getattr(other, attr)
for attr in ('id', 'nick_name')])
You can’t perform that action at this time.