Python google.appengine.ext.db.Property() Examples

The following are 30 code examples of google.appengine.ext.db.Property(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module google.appengine.ext.db , or try the search function .
Example #1
Source File: djangoforms.py    From python-compat-runtime with Apache License 2.0 6 votes vote down vote up
def property_clean(prop, value):
  """Apply Property level validation to value.

  Calls .make_value_from_form() and .validate() on the property and catches
  exceptions generated by either.  The exceptions are converted to
  forms.ValidationError exceptions.

  Args:
    prop: The property to validate against.
    value: The value to validate.

  Raises:
    forms.ValidationError if the value cannot be validated.
  """
  if value is not None:
    try:



      prop.validate(prop.make_value_from_form(value))
    except (db.BadValueError, ValueError), e:
      raise forms.ValidationError(unicode(e)) 
Example #2
Source File: appengine.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
def validate(self, value):
        value = super(CredentialsProperty, self).validate(value)
        logger.info("validate: Got type " + str(type(value)))
        if value is not None and not isinstance(value, client.Credentials):
            raise db.BadValueError(
                'Property {0} must be convertible '
                'to a Credentials instance ({1})'.format(self.name, value))
        return value 
Example #3
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def validate(self, value):
    value = super(CredentialsProperty, self).validate(value)
    logger.info("validate: Got type " + str(type(value)))
    if value is not None and not isinstance(value, Credentials):
      raise db.BadValueError('Property %s must be convertible '
                          'to a Credentials instance (%s)' %
                            (self.name, value))
    #if value is not None and not isinstance(value, Credentials):
    #  return None
    return value 
Example #4
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def _validate(self, value):
      """Validates a value as a proper credentials object.

      Args:
        value: A value to be set on the property.

      Raises:
        TypeError if the value is not an instance of Credentials.
      """
      logger.info('validate: Got type %s', type(value))
      if value is not None and not isinstance(value, Credentials):
        raise TypeError('Property %s must be convertible to a credentials '
                        'instance; received: %s.' % (self._name, value)) 
Example #5
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def validate(self, value):
    if value is not None and not isinstance(value, Flow):
      raise db.BadValueError('Property %s must be convertible '
                          'to a FlowThreeLegged instance (%s)' %
                          (self.name, value))
    return super(FlowProperty, self).validate(value) 
Example #6
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def validate(self, value):
    value = super(CredentialsProperty, self).validate(value)
    logger.info("validate: Got type " + str(type(value)))
    if value is not None and not isinstance(value, Credentials):
      raise db.BadValueError('Property %s must be convertible '
                          'to a Credentials instance (%s)' %
                            (self.name, value))
    #if value is not None and not isinstance(value, Credentials):
    #  return None
    return value 
Example #7
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def _validate(self, value):
      """Validates a value as a proper credentials object.

      Args:
        value: A value to be set on the property.

      Raises:
        TypeError if the value is not an instance of Credentials.
      """
      logger.info('validate: Got type %s', type(value))
      if value is not None and not isinstance(value, Credentials):
        raise TypeError('Property %s must be convertible to a credentials '
                        'instance; received: %s.' % (self._name, value)) 
Example #8
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def validate(self, value):
        if value is not None and not isinstance(value, Flow):
            raise db.BadValueError('Property %s must be convertible '
                                   'to a FlowThreeLegged instance (%s)' %
                                   (self.name, value))
        return super(FlowProperty, self).validate(value) 
Example #9
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def validate(self, value):
        value = super(CredentialsProperty, self).validate(value)
        logger.info("validate: Got type " + str(type(value)))
        if value is not None and not isinstance(value, Credentials):
            raise db.BadValueError('Property %s must be convertible '
                                   'to a Credentials instance (%s)' %
                                   (self.name, value))
        return value 
Example #10
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def _validate(self, value):
            """Validates a value as a proper credentials object.

            Args:
                value: A value to be set on the property.

            Raises:
                TypeError if the value is not an instance of Credentials.
            """
            logger.info('validate: Got type %s', type(value))
            if value is not None and not isinstance(value, Credentials):
                raise TypeError('Property %s must be convertible to a '
                                'credentials instance; received: %s.' %
                                (self._name, value)) 
Example #11
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def validate(self, value):
    if value is not None and not isinstance(value, Flow):
      raise db.BadValueError('Property %s must be convertible '
                          'to a FlowThreeLegged instance (%s)' %
                          (self.name, value))
    return super(FlowProperty, self).validate(value) 
Example #12
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def _validate(self, value):
      """Validates a value as a proper Flow object.

      Args:
        value: A value to be set on the property.

      Raises:
        TypeError if the value is not an instance of Flow.
      """
      logger.info('validate: Got type %s', type(value))
      if value is not None and not isinstance(value, Flow):
        raise TypeError('Property %s must be convertible to a flow '
                        'instance; received: %s.' % (self._name, value)) 
Example #13
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def validate(self, value):
    value = super(CredentialsProperty, self).validate(value)
    logger.info("validate: Got type " + str(type(value)))
    if value is not None and not isinstance(value, Credentials):
      raise db.BadValueError('Property %s must be convertible '
                          'to a Credentials instance (%s)' %
                            (self.name, value))
    #if value is not None and not isinstance(value, Credentials):
    #  return None
    return value 
Example #14
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def _validate(self, value):
      """Validates a value as a proper Flow object.

      Args:
        value: A value to be set on the property.

      Raises:
        TypeError if the value is not an instance of Flow.
      """
      logger.info('validate: Got type %s', type(value))
      if value is not None and not isinstance(value, Flow):
        raise TypeError('Property %s must be convertible to a flow '
                        'instance; received: %s.' % (self._name, value)) 
Example #15
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def _validate(self, value):
            """Validates a value as a proper Flow object.

            Args:
                value: A value to be set on the property.

            Raises:
                TypeError if the value is not an instance of Flow.
            """
            logger.info('validate: Got type %s', type(value))
            if value is not None and not isinstance(value, Flow):
                raise TypeError('Property %s must be convertible to a flow '
                                'instance; received: %s.' % (self._name,
                                                             value)) 
Example #16
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def validate(self, value):
        if value is not None and not isinstance(value, Flow):
            raise db.BadValueError('Property %s must be convertible '
                                   'to a FlowThreeLegged instance (%s)' %
                                   (self.name, value))
        return super(FlowProperty, self).validate(value) 
Example #17
Source File: appengine.py    From data with GNU General Public License v3.0 5 votes vote down vote up
def validate(self, value):
        value = super(CredentialsProperty, self).validate(value)
        logger.info("validate: Got type " + str(type(value)))
        if value is not None and not isinstance(value, Credentials):
            raise db.BadValueError('Property %s must be convertible '
                                   'to a Credentials instance (%s)' %
                                   (self.name, value))
        return value 
Example #18
Source File: appengine.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
def validate(self, value):
        if value is not None and not isinstance(value, client.Flow):
            raise db.BadValueError(
                'Property {0} must be convertible '
                'to a FlowThreeLegged instance ({1})'.format(self.name, value))
        return super(FlowProperty, self).validate(value) 
Example #19
Source File: appengine.py    From twitter-for-bigquery with Apache License 2.0 5 votes vote down vote up
def _validate(self, value):
      """Validates a value as a proper credentials object.

      Args:
        value: A value to be set on the property.

      Raises:
        TypeError if the value is not an instance of Credentials.
      """
      logger.info('validate: Got type %s', type(value))
      if value is not None and not isinstance(value, Credentials):
        raise TypeError('Property %s must be convertible to a credentials '
                        'instance; received: %s.' % (self._name, value)) 
Example #20
Source File: appengine.py    From twitter-for-bigquery with Apache License 2.0 5 votes vote down vote up
def validate(self, value):
    value = super(CredentialsProperty, self).validate(value)
    logger.info("validate: Got type " + str(type(value)))
    if value is not None and not isinstance(value, Credentials):
      raise db.BadValueError('Property %s must be convertible '
                          'to a Credentials instance (%s)' %
                            (self.name, value))
    #if value is not None and not isinstance(value, Credentials):
    #  return None
    return value 
Example #21
Source File: appengine.py    From twitter-for-bigquery with Apache License 2.0 5 votes vote down vote up
def _validate(self, value):
      """Validates a value as a proper Flow object.

      Args:
        value: A value to be set on the property.

      Raises:
        TypeError if the value is not an instance of Flow.
      """
      logger.info('validate: Got type %s', type(value))
      if value is not None and not isinstance(value, Flow):
        raise TypeError('Property %s must be convertible to a flow '
                        'instance; received: %s.' % (self._name, value)) 
Example #22
Source File: appengine.py    From twitter-for-bigquery with Apache License 2.0 5 votes vote down vote up
def validate(self, value):
    if value is not None and not isinstance(value, Flow):
      raise db.BadValueError('Property %s must be convertible '
                          'to a FlowThreeLegged instance (%s)' %
                          (self.name, value))
    return super(FlowProperty, self).validate(value) 
Example #23
Source File: appengine.py    From luci-py with Apache License 2.0 5 votes vote down vote up
def _validate(self, value):
            """Validates a value as a proper credentials object.

            Args:
                value: A value to be set on the property.

            Raises:
                TypeError if the value is not an instance of Credentials.
            """
            logger.info('validate: Got type %s', type(value))
            if value is not None and not isinstance(value, Credentials):
                raise TypeError('Property %s must be convertible to a '
                                'credentials instance; received: %s.' %
                                (self._name, value)) 
Example #24
Source File: appengine.py    From luci-py with Apache License 2.0 5 votes vote down vote up
def validate(self, value):
        value = super(CredentialsProperty, self).validate(value)
        logger.info("validate: Got type " + str(type(value)))
        if value is not None and not isinstance(value, Credentials):
            raise db.BadValueError('Property %s must be convertible '
                                   'to a Credentials instance (%s)' %
                                   (self.name, value))
        return value 
Example #25
Source File: appengine.py    From luci-py with Apache License 2.0 5 votes vote down vote up
def validate(self, value):
        if value is not None and not isinstance(value, Flow):
            raise db.BadValueError('Property %s must be convertible '
                                   'to a FlowThreeLegged instance (%s)' %
                                   (self.name, value))
        return super(FlowProperty, self).validate(value) 
Example #26
Source File: appengine.py    From luci-py with Apache License 2.0 5 votes vote down vote up
def _validate(self, value):
            """Validates a value as a proper credentials object.

            Args:
                value: A value to be set on the property.

            Raises:
                TypeError if the value is not an instance of Credentials.
            """
            logger.info('validate: Got type %s', type(value))
            if value is not None and not isinstance(value, Credentials):
                raise TypeError('Property %s must be convertible to a '
                                'credentials instance; received: %s.' %
                                (self._name, value)) 
Example #27
Source File: appengine.py    From luci-py with Apache License 2.0 5 votes vote down vote up
def validate(self, value):
        value = super(CredentialsProperty, self).validate(value)
        logger.info("validate: Got type " + str(type(value)))
        if value is not None and not isinstance(value, Credentials):
            raise db.BadValueError('Property %s must be convertible '
                                   'to a Credentials instance (%s)' %
                                   (self.name, value))
        return value 
Example #28
Source File: appengine.py    From luci-py with Apache License 2.0 5 votes vote down vote up
def _validate(self, value):
            """Validates a value as a proper Flow object.

            Args:
                value: A value to be set on the property.

            Raises:
                TypeError if the value is not an instance of Flow.
            """
            logger.info('validate: Got type %s', type(value))
            if value is not None and not isinstance(value, Flow):
                raise TypeError('Property %s must be convertible to a flow '
                                'instance; received: %s.' % (self._name,
                                                             value)) 
Example #29
Source File: appengine.py    From luci-py with Apache License 2.0 5 votes vote down vote up
def validate(self, value):
        if value is not None and not isinstance(value, Flow):
            raise db.BadValueError('Property %s must be convertible '
                                   'to a FlowThreeLegged instance (%s)' %
                                   (self.name, value))
        return super(FlowProperty, self).validate(value) 
Example #30
Source File: appengine.py    From luci-py with Apache License 2.0 5 votes vote down vote up
def validate(self, value):
        value = super(CredentialsProperty, self).validate(value)
        logger.info("validate: Got type " + str(type(value)))
        if value is not None and not isinstance(value, Credentials):
            raise db.BadValueError('Property %s must be convertible '
                                   'to a Credentials instance (%s)' %
                                   (self.name, value))
        return value