Ignore:
Timestamp:
Feb 26, 2009, 11:09:28 PM (16 years ago)
Author:
price
Message:

small fixes to Record

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-database/python/database/owner.py

    r2187 r2191  
    1616    _identity_field = 'owner_id'
    1717
    18     def getMemoryQuotas(owner):
    19         owner_info = Owner.query().filter_by(owner_id=owner).first()
     18    @classmethod
     19    def getMemoryQuotas(cls, owner):
     20        owner_info = cls.query().filter_by(owner_id=owner).first()
    2021        if owner_info == None:
    21             owner_info = Owner(owner_id=owner)
     22            owner_info = cls(owner_id=owner)
    2223        return (owner_info.get('ram_quota_total'), owner_info.get('ram_quota_single'))
    23     getMemoryQuotas = staticmethod(getMemoryQuotas)
    2424
    25     def getDiskQuotas(owner):
    26         owner_info = Owner.query().filter_by(owner_id=owner).first()
     25    @classmethod
     26    def getDiskQuotas(cls, owner):
     27        owner_info = cls.query().filter_by(owner_id=owner).first()
    2728        if owner_info == None:
    28             owner_info = Owner(owner_id=owner)
     29            owner_info = cls(owner_id=owner)
    2930        return (owner_info.get('disk_quota_total'), owner_info.get('disk_quota_single'))
    30     getDiskQuotas = staticmethod(getDiskQuotas)
    3131
    32     def getVMQuotas(owner):
    33         owner_info = Owner.query().filter_by(owner_id=owner).first()
     32    @classmethod
     33    def getVMQuotas(cls, owner):
     34        owner_info = cls.query().filter_by(owner_id=owner).first()
    3435        if owner_info == None:
    35             owner_info = Owner(owner_id=owner)
     36            owner_info = cls(owner_id=owner)
    3637        return (owner_info.get('vms_quota_total'), owner_info.get('vms_quota_active'))
    37     getVMQuotas = staticmethod(getVMQuotas)
    38 
    39     def _ignore(self):
    40         return super(Owner, self)._ignore() + ['getMemoryQuotas', 'getDiskQuotas', 'getVMQuotas']
Note: See TracChangeset for help on using the changeset viewer.