Revision 3a7732f5

b/commissioning/__init__.py
6 6
                                InvalidKeyError,
7 7
                                NoEntityError,
8 8
                                NoQuantityError,
9
                                NoCapacityError)
9
                                NoCapacityError,
10
				ExportLimitError,
11
				ImportLimitError)
10 12

  
11 13
from .api.callpoint     import  Callpoint, get_callpoint, mkcallargs
12 14
from .api.physical      import  Physical
b/commissioning/api/exception.py
20 20
class NoCapacityError(CommissionException):
21 21
    pass
22 22

  
23
class ExportLimitError(CommissionException):
24
    pass
25

  
26
class ImportLimitError(CommissionException):
27
    pass
23 28

  
b/commissioning/servers/quotaholder/django_backend/callpoint.py
3 3
                            Callpoint, CommissionException,
4 4
                            CorruptedError, InvalidDataError,
5 5
                            InvalidKeyError, NoEntityError,
6
                            NoQuantityError, NoCapacityError    )
6
                            NoQuantityError, NoCapacityError,
7
                            ExportLimitError, ImportLimitError)
7 8

  
8 9

  
9 10
from django.db.models import Model, BigIntegerField, CharField, ForeignKey
......
280 281

  
281 282
            hp = h.policy
282 283

  
284
            if (hp.export_limit is not None and
285
                h.exporting + quantity > hp.export_limit):
286
                    m = ("Export limit reached for %s.%s" % (entity, resource))
287
                    raise ExportLimitError(m)
288

  
283 289
            if h.importing - h.exported + hp.quantity - quantity < 0:
284 290
                m = ("There is not enough quantity "
285 291
                     "to allocate from in %s.%s" % (entity, resource))
......
294 300

  
295 301
            tp = th.policy
296 302

  
303
            if (tp.import_limit is not None and
304
                th.importing + quantity > tp.import_limit):
305
                    m = ("Import limit reached for %s.%s" % (target, resource))
306
                    raise ImportLimitError(m)
307

  
297 308
            if (    th.exported - th.importing - tp.quantity
298 309
                    + tp.capacity - quantity                ) < 0:
299 310

  

Also available in: Unified diff