# Path: nudge/utils.py
# def dehump(string):
#     def fix_caps(match):
#         result = ''
#         for group in match.groups():
#             result += group[0:len(group)-1]+"_"+group[len(group)-1].lower()
#         return result
#     return camel_case.sub(fix_caps, string).strip()


import types
import nudge
import nudge.validator as validate
from nudge.utils import dehump
                if self.optional:
                    return self.default
                elif exists:
                    msg = " is required, exists, but is empty"
                else:
                    msg = " is required but does not exist"
                raise nudge.publisher.HTTPException(
                    400,
                    self.name + msg
                )
            # Query string args will come in list format, take the first.
            # Unless of course we are expecting a list from the json body.
            if type(data) in [types.ListType] and not isinstance(self, List):
                data = data[0]
            try:
                return self.validator(data)
            except (validate.ValidationError), e:
                msg = "invalid value for argument '%s': '%s'" % (
                    self.name,
                    data
                )
                if e.message:
                    msg += ': %s' % e.message
                    raise nudge.publisher.HTTPException(400, msg)
        self.argspec = func

class CustomArg(Arg):

    def __init__(self, name=None):
        if not name and hasattr(self, '__name__'):

# Path: nudge/utils.py
# def dehump(string):
#     def fix_caps(match):
#         result = ''
#         for group in match.groups():
#             result += group[0:len(group)-1]+"_"+group[len(group)-1].lower()
#         return result
#     return camel_case.sub(fix_caps, string).strip()


# Path: nudge/arg.py
import types
import nudge
import nudge.validator as validate
from nudge.utils import dehump

                if self.optional:
                    return self.default
                elif exists:
                    msg = " is required, exists, but is empty"
                else:
                    msg = " is required but does not exist"
                raise nudge.publisher.HTTPException(
                    400,
                    self.name + msg
                )
            # Query string args will come in list format, take the first.
            # Unless of course we are expecting a list from the json body.
            if type(data) in [types.ListType] and not isinstance(self, List):
                data = data[0]
            try:
                return self.validator(data)
            except (validate.ValidationError), e:
                msg = "invalid value for argument '%s': '%s'" % (
                    self.name,
                    data
                )
                if e.message:
                    msg += ': %s' % e.message
                    raise nudge.publisher.HTTPException(400, msg)
        self.argspec = func

class CustomArg(Arg):

    def __init__(self, name=None):
        if not name and hasattr(self, '__name__'):

            name = dehump(self.__name__)