# Path: doodle/common/time_format.py
# def datetime_to_timestamp(dt):  # UTC datetime
#     return calendar.timegm(dt.utctimetuple())


from datetime import datetime
from doodle.common.time_format import datetime_to_timestamp
import time
        return value

    def is_empty(self, value):
        return not value


class DateTimeProperty(Property):
    def __init__(self, auto_now=False, **kwargs):
        super(DateTimeProperty, self).__init__(**kwargs)
        self.auto_now = auto_now

    def validate(self, value):
        if value is not None:
            if isinstance(value, datetime):
                return datetime_to_timestamp(value)
            try:
                value = int(value)
            except ValueError:
                raise ValueError('Property %s must be a timestamp' % self.name)
            if value < 0:
                raise ValueError('Property %s must be non-negative' % self.name)
            return value
        if self.auto_now:
            return int(time.time())


class IntegerProperty(Property):
    def validate(self, value):
        if value is not None:
            try:

# Path: doodle/common/time_format.py
# def datetime_to_timestamp(dt):  # UTC datetime
#     return calendar.timegm(dt.utctimetuple())


# Path: doodle/core/property.py
from datetime import datetime
from doodle.common.time_format import datetime_to_timestamp
import time

        return value

    def is_empty(self, value):
        return not value


class DateTimeProperty(Property):
    def __init__(self, auto_now=False, **kwargs):
        super(DateTimeProperty, self).__init__(**kwargs)
        self.auto_now = auto_now

    def validate(self, value):
        if value is not None:
            if isinstance(value, datetime):
                return datetime_to_timestamp(value)
            try:
                value = int(value)
            except ValueError:
                raise ValueError('Property %s must be a timestamp' % self.name)
            if value < 0:
                raise ValueError('Property %s must be non-negative' % self.name)
            return value
        if self.auto_now:
            return int(time.time())


class IntegerProperty(Property):
    def validate(self, value):
        if value is not None:
            try:

                return int(value)