예제 #1
0
 def register(self, obj):
     """Extend to ensure that obj is callable. Could check signature, too.
     """
     if not is_callable(obj):
         raise TypeError("Hooks must be callable objects; this isn't: %s."
                         % str(obj))
     list.append(self, obj)
예제 #2
0
 def register(self, obj):
     """Extend to ensure that obj is callable. Could check signature, too.
     """
     if not is_callable(obj):
         raise TypeError("Hooks must be callable objects; this isn't: %s." %
                         str(obj))
     list.append(self, obj)
예제 #3
0
 def _set(self, name, hydrated, flat, context, name_in_context):
     """Set value at self.name, calling value if it's callable.
     """
     if aspen.is_callable(hydrated):
         hydrated = hydrated()  # Call it if we can.
     setattr(self, name, hydrated)
     if name_in_context:
         assert isinstance(flat, unicode) # sanity check
         name_in_context = " %s=%s" % (name_in_context, flat)
     out = "  %-22s %-30s %-24s"
     return out % (name, hydrated, context + name_in_context)