Пример #1
0
 def create_limits(self, limits):
     try:
         with sql.session_for_write() as session:
             for limit in limits:
                 if limit.get('region_id') is None:
                     self._check_unified_limit_without_region(
                         limit, is_registered_limit=False)
                 ref = LimitModel.from_dict(limit)
                 session.add(ref)
     except db_exception.DBReferenceError:
         raise exception.NoLimitReference()
Пример #2
0
 def create_limits(self, limits):
     try:
         with sql.session_for_write() as session:
             new_limits = []
             for limit in limits:
                 self._check_unified_limit_unique(limit,
                                                  is_registered_limit=False)
                 target = self._check_and_fill_registered_limit_id(limit)
                 ref = LimitModel.from_dict(target)
                 session.add(ref)
                 new_limits.append(ref.to_dict())
             return new_limits
     except db_exception.DBReferenceError:
         raise exception.NoLimitReference()