Esempio n. 1
0
 def _get_relations(cls):
     """ Returns the relations defined with the Relation decorator """
     disable_sa_deprecation_warnings()
     relations = []
     for method in cls.__dict__.values():
         if hasattr(method, 'decorator') and method.decorator == Relation:
             relations.append(method.relation_name)
             method.deferred_import()
     enable_sa_deprecation_warnings()
     return relations
Esempio n. 2
0
 def insert(self, flush=True, commit=False):
     """ Save the current instance into the session """
     sess = self.session
     disable_sa_deprecation_warnings()
     sess.add(self)
     enable_sa_deprecation_warnings()
     if flush is True:
         sess.flush()
     if commit is True:
         sess.commit()