コード例 #1
0
 def update(self, article: Article, data: dict):
     if 'name' in data:
         article.name = data['name']
     if 'price' in data:
         article.price = data['price']
     try:
         self._database_session.merge(article)
         self._database_session.flush()
     except IntegrityError:
         raise Error("Error data may be malformed")
     return article
コード例 #2
0
 def create(self, data: dict):
     try:
         art = Article(firstname=data.get('firstname'),email=data.get('price'), type=data.get('quantity'))
         self._database_session.add(art)
         self._database_session.flush()
     except IntegrityError:
         raise Error("Article already exists")
     return art
コード例 #3
0
 def create(self, data: dict):
     try:
         article = Article(name=data.get('name'), price=data.get('price'))
         self._database_session.add(article)
         self._database_session.flush()
     except IntegrityError:
         raise Error("Member already exists")
     return article
コード例 #4
0
 def create(self, data: dict):
     try:
         article = Article(name=data.get('name'),
                           type=data.get('type'),
                           description=data.get('description'),
                           provenance=data.get('provenance'))
         self._database_session.add(article)
         self._database_session.flush()
     except IntegrityError:
         raise Error("Article already exists")
     return article
コード例 #5
0
 def create(self, data: dict):
     try:
         article = Article(name=data.get('name'),
                           size=data.get('size'),
                           theme=data.get('theme'),
                           color=data.get('color'))
         self._database_session.add(article)
         self._database_session.flush()
     except IntegrityError:
         raise Error("Article already exists")
     return article