~ubuntu-branches/ubuntu/raring/kiwi/raring

« back to all changes in this revision

Viewing changes to kiwi/accessor.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-01-30 09:52:28 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070130095228-n0mkqlt82e74twqc
Tags: 1.9.12-0ubuntu1
* New upstream release.
* debian/patches/03_epyrun_use_local_modules.patch:
  - updated.
* debian/control:
  - moved python-support from Build-Depends to Build-Depends-Indep.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
import string
37
37
import types
38
38
 
 
39
from kiwi.log import Logger
 
40
 
 
41
log = Logger('kiwi.accessor')
 
42
 
39
43
def get_default_getter(model, attr_name, cache):
40
44
    """Obtains from model a callable through which attr_name can be
41
45
    retrieved.  This callable is an accessor named get_foo, where
45
49
    attr_name) is returned."""
46
50
    func = getattr(model, "get_%s" % attr_name, None)
47
51
    if callable(func):
 
52
        log.info('kgetattr based get_%s method is deprecated, '
 
53
                 'replace it with a property' % attr_name)
48
54
        return func
49
55
    else:
50
56
        return (model, attr_name)
58
64
    attr_name) is returned."""
59
65
    func = getattr(model, "set_%s" % attr_name, None)
60
66
    if callable(func):
 
67
        log.info('ksetattr based set_%s method is deprecated, '
 
68
                 'replace it with a property' % attr_name)
61
69
        return func
62
70
    else:
63
71
        return (model, attr_name)
208
216
 
209
217
                func = getattr(obj, "get_%s" % name, None)
210
218
                if callable(func):
 
219
                    log.info('kgetattr based get_%s method is deprecated, '
 
220
                             'replace it with a property' % name)
211
221
                    icode = FAST_METHOD_ACCESS
212
222
                    data1 = func.im_func
213
223
                    data2 = None
380
390
 
381
391
            func = getattr(model, "set_%s" % attr_name, None)
382
392
            if callable(func):
 
393
                log.info('ksetattr based set_%s method is deprecated, '
 
394
                         'replace it with a property' % attr_name)
383
395
                icode = FAST_METHOD_ACCESS
384
396
                data1 = func.im_func
385
397
                data2 = None