Exemple #1
0
 def save(self, session=None):
     """Save this object."""
     if not session:
         session = get_session()
     session.add(self)
     try:
         session.flush()
     except IntegrityError, e:
         if str(e).endswith('is not unique'):
             raise exception.Duplicate(str(e))
         else:
             raise
 def save(self, session=None):
     """Save this object."""
     if not session:
         session = get_session()
     session.add(self)
     try:
         session.flush()
     except IntegrityError, e:
         if str(e).endswith("is not unique"):
             raise exception.Duplicate(str(e))
         else:
             raise