• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.server
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Change
  • Next Change →

Changeset 2866 for trunk

Show
Ignore:
Timestamp:
10/03/08 13:34:34 (7 weeks ago)
Author:
jmoore
Message:

ticket:1106 - Adding support for 'isLoaded' to OmeroPy __getattr__

Files:
1 modified

  • trunk/components/blitz/resources/templates/combined.vm (modified) (1 diff)

Legend:

Unmodified
Added
Removed
  • trunk/components/blitz/resources/templates/combined.vm

    r2865 r2866  
    15251525[$pyc]       def __getattr__(self, name): 
    15261526[$pyc]           """ 
    1527 [$pyc]           Reroutes all access to object.field through object.getField() 
     1527[$pyc]           Reroutes all access to object.field through object.getField() or object.isField() 
    15281528[$pyc]           """ 
    15291529[$pyc]           field  = "_" + name 
    1530 [$pyc]           getter = "get" + name[0].capitalize() + name[1:] 
    1531 [$pyc]           if hasattr(self, field) and hasattr(self, getter): 
    1532 [$pyc]               method = getattr(self, getter) 
    1533 [$pyc]               return method() 
     1530[$pyc]           capitalized = name[0].capitalize() + name[1:] 
     1531[$pyc]           getter = "get" + capitalized 
     1532[$pyc]           questn = "is" + capitalized 
     1533[$pyc]           if hasattr(self, field): 
     1534[$pyc]               if hasattr(self, getter): 
     1535[$pyc]                   method = getattr(self, getter) 
     1536[$pyc]                   return method() 
     1537[$pyc]               elif hasattr(self, questn): 
     1538[$pyc]                   method = getattr(self, questn) 
     1539[$pyc]                   return method() 
    15341540[$pyc]           else: 
    1535 [$pyc]               raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, getter)) 
     1541[$pyc]               raise AttributeError("'%s' object has no attribute '%s' or '%s'" % (self.__class__.__name__, getter, questn)) 
    15361542[$pyc] 
    15371543[$pyc]       def __setattr__(self, name, value): 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/