Пример #1
0
    def normalize_value(self, value):
        minute = transform_for('integer').deserialize(value)

        if minute < 0 or minute > 59:
            raise ForbiddenError('Minute filter accepts only numbers from 0 to 59.')

        return minute
Пример #2
0
    def normalize_value(self, value):
        second = transform_for('integer').deserialize(value)

        if second < 0 or second > 59:
            raise ForbiddenError('Second filter accepts only numbers from 0 to 59.')

        return second
Пример #3
0
    def normalize_value(self, value):
        week_day = transform_for('integer').deserialize(value)

        if week_day < 1 or week_day > 7:
            raise ForbiddenError('Week day filter accepts only numbers from 1 to 7.')

        return week_day
Пример #4
0
    def normalize_value(self, value):
        hour = transform_for('integer').deserialize(value)

        if hour < 0 or hour > 23:
            raise ForbiddenError('Hour filter accepts only numbers from 0 to 23.')

        return hour
Пример #5
0
    def normalize_value(self, value):
        month = transform_for('integer').deserialize(value)

        if month < 1 or month > 12:
            raise ForbiddenError('Month filter accepts only numbers from 1 to 12.')

        return month
Пример #6
0
    def normalize_value(self, value):
        day = transform_for('integer').deserialize(value)

        if day < 1 or day > 31:
            raise ForbiddenError('Day filter accepts only numbers from 1 to 31.')

        return day
Пример #7
0
    def normalize_value(self, value):
        minute = transform_for('integer').deserialize(value)

        if minute < 0 or minute > 59:
            raise ForbiddenError(
                'Minute filter accepts only numbers from 0 to 59.')

        return minute
Пример #8
0
    def normalize_value(self, value):
        month = transform_for('integer').deserialize(value)

        if month < 1 or month > 12:
            raise ForbiddenError(
                'Month filter accepts only numbers from 1 to 12.')

        return month
Пример #9
0
    def normalize_value(self, value):
        second = transform_for('integer').deserialize(value)

        if second < 0 or second > 59:
            raise ForbiddenError(
                'Second filter accepts only numbers from 0 to 59.')

        return second
Пример #10
0
    def normalize_value(self, value):
        hour = transform_for('integer').deserialize(value)

        if hour < 0 or hour > 23:
            raise ForbiddenError(
                'Hour filter accepts only numbers from 0 to 23.')

        return hour
Пример #11
0
    def normalize_value(self, value):
        week_day = transform_for('integer').deserialize(value)

        if week_day < 1 or week_day > 7:
            raise ForbiddenError(
                'Week day filter accepts only numbers from 1 to 7.')

        return week_day
Пример #12
0
    def normalize_value(self, value):
        day = transform_for('integer').deserialize(value)

        if day < 1 or day > 31:
            raise ForbiddenError(
                'Day filter accepts only numbers from 1 to 31.')

        return day
Пример #13
0
    def inspect_primary_key(self):
        primary_key = None

        for field_name in self.get_all_model_field_names():
            field = self.get_model_field(field_name)
            attr_name = None

            primary_key = getattr(field, 'primary_key', False)

            if primary_key and self.is_one_to_one_field(field_name, field):
                attr_name = field_name + '_id'

            if primary_key:
                kind = kind_of_field(field)
                transform = transform_for(kind)

                primary_key = PrimaryKey(transform=transform, attr_name=attr_name)
                break

        setattr(self.resource, '_primary_key', primary_key)
Пример #14
0
 def normalize_value(self, value):
     return transform_for('boolean').deserialize(value)
Пример #15
0
 def normalize_value(self, value):
     return transform_for('boolean').deserialize(value)
Пример #16
0
 def normalize_value(self, value):
     return transform_for('integer').deserialize(value)
Пример #17
0
 def normalize_value(self, value):
     return transform_for('integer').deserialize(value)