Changeset 3541:7b6d0883f8d9 in livinglogic.python.xist

Show
Ignore:
Timestamp:
07/26/08 18:12:12 (11 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Rename CallMethAction? to CallAttrAction?.

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • MIGRATION.rst

    r3529 r3541  
    1 Migrating to version 3.3 
     1Migrating to version 3.4 
    22======================== 
    33 
    44Changes to the make module 
    55-------------------------- 
     6 
     7*   :class:`CallMethAction` has been renamed to :class:`CallAttrAction`. 
    68 
    79*   :class:`XISTPublishAction` has been renamed to :class:`XISTBytesAction`. 
  • NEWS.rst

    r3540 r3541  
    4545 
    4646*   Fixed a bug in the caching logic in :meth:`ll.make.CacheAction`. 
     47 
     48*   :class:`ll.make.CallMethAction` has been renamed to :class:`CallAttrAction` 
     49    because it can be used to e.g. call functions in a module too. 
    4750 
    4851 
  • src/ll/make.py

    r3539 r3541  
    11791179 
    11801180 
    1181 class CallMethAction(Action): 
    1182     """ 
    1183     This action calls a method of an object with a number of arguments. Both 
    1184     positional and keyword arguments are supported and the object, the method 
     1181class CallAttrAction(Action): 
     1182    """ 
     1183    This action calls an attribute of an object with a number of arguments. Both 
     1184    positional and keyword arguments are supported and the object, the atribute 
    11851185    name and the arguments can be static objects or actions. 
    11861186    """ 
    1187     def __init__(self, obj, methname, *args, **kwargs): 
     1187    def __init__(self, obj, attrname, *args, **kwargs): 
    11881188        Action.__init__(self) 
    11891189        self.obj = obj 
    1190         self.methname = methname 
     1190        self.attrname = attrname 
    11911191        self.args = args 
    11921192        self.kwargs = kwargs 
     
    11941194    def __iter__(self): 
    11951195        yield self.obj 
    1196         yield self.methname 
     1196        yield self.attrname 
    11971197        for input in self.args: 
    11981198            yield input 
     
    12011201 
    12021202    def getargs(self): 
    1203         return (self.obj, self.methname) + self.args 
     1203        return (self.obj, self.attrname) + self.args 
    12041204 
    12051205    def getkwargs(self): 
    12061206        return self.kwargs 
    12071207 
    1208     def execute(self, project, obj, methname, *args, **kwargs): 
    1209         meth = getattr(obj, methname) 
    1210         project.writestep(self, "Calling %r" % meth) 
    1211         return meth(*args, **kwargs) 
     1208    def execute(self, project, obj, attrname, *args, **kwargs): 
     1209        func = getattr(obj, attrname) 
     1210        project.writestep(self, "Calling %r" % func) 
     1211        return func(*args, **kwargs) 
    12121212 
    12131213