relations are now "directives", and code is cleaned up.
This commit is contained in:
		@@ -126,9 +126,9 @@ def caller_locals():
 | 
			
		||||
        del stack
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_calling_package_name():
 | 
			
		||||
def get_calling_module_name():
 | 
			
		||||
    """Make sure that the caller is a class definition, and return the
 | 
			
		||||
       module's name.
 | 
			
		||||
       enclosing module's name.
 | 
			
		||||
    """
 | 
			
		||||
    stack = inspect.stack()
 | 
			
		||||
    try:
 | 
			
		||||
@@ -322,6 +322,27 @@ def match(string):
 | 
			
		||||
    return match
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def DictWrapper(dictionary):
 | 
			
		||||
    """Returns a class that wraps a dictionary and enables it to be used
 | 
			
		||||
       like an object."""
 | 
			
		||||
    class wrapper(object):
 | 
			
		||||
        def __getattr__(self, name):
 | 
			
		||||
            return dictionary[name]
 | 
			
		||||
 | 
			
		||||
        def __setattr__(self, name, value):
 | 
			
		||||
            dictionary[name] = value
 | 
			
		||||
            return value
 | 
			
		||||
 | 
			
		||||
        def setdefault(self, *args):
 | 
			
		||||
            return dictionary.setdefault(*args)
 | 
			
		||||
 | 
			
		||||
        def get(self, *args):
 | 
			
		||||
            return dictionary.get(*args)
 | 
			
		||||
 | 
			
		||||
    return wrapper()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class RequiredAttributeError(ValueError):
 | 
			
		||||
    def __init__(self, message):
 | 
			
		||||
        super(RequiredAttributeError, self).__init__(message)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user