Exemple #1
0
 def decorator(directive_method):
     if apply_globally:
         hug.defaults.directives[underscore(directive_method.__name__)] = directive_method
     else:
         module = _api_module(directive_method.__module__)
         module.__hug__.add_directive(directive_method)
     directive_method.directive = True
     return directive_method
Exemple #2
0
 def decorator(directive_method):
     if apply_globally:
         hug.defaults.directives[underscore(directive_method.__name__)] = directive_method
     else:
         api = hug.api.from_object(directive_method)
         api.add_directive(directive_method)
     directive_method.directive = True
     return directive_method
Exemple #3
0
 def decorator(directive_method):
     if apply_globally:
         hug.defaults.directives[underscore(directive_method.__name__)] = directive_method
     else:
         module = _api_module(directive_method.__module__)
         module.__hug__.add_directive(directive_method)
     directive_method.directive = True
     return directive_method
Exemple #4
0
 def decorator(directive_method):
     if apply_globally:
         hug.defaults.directives[underscore(
             directive_method.__name__)] = directive_method
     else:
         api = hug.api.from_object(directive_method)
         api.add_directive(directive_method)
     directive_method.directive = True
     return directive_method
Exemple #5
0
def _underscore_dict(dictionary):
    new_dictionary = {}
    for key, value in dictionary.items():
        if isinstance(value, dict):
            value = _underscore_dict(value)
        if isinstance(key, str):
            key = underscore(key)
        new_dictionary[key] = value
    return new_dictionary