The spyne.model.primitive package contains types with values that fit in a single field.
See spyne.protocol._model for {to,from}_string implementations.
Bases: spyne.model._base.SimpleModel
A dict instance that can contain other dicts, iterables or primitive types. Its serialization is protocol-dependent.
Bases: spyne.model.primitive.Unicode
A special kind of String type designed to hold an uri.
Bases: object
A special object that is just a better way of carrying the information carried with a link.
Parameters: |
|
---|
Bases: spyne.model._base.SimpleModel
An xml node that can contain any number of sub nodes. It’s represented by an ElementTree object.
Bases: spyne.model._base.SimpleModel
Life is simple here. Just true or false.
Bases: spyne.model.primitive.DateTime
Just that, Date. No time zone support.
Native type is datetime.date.
Bases: spyne.model.primitive.Attributes
Customizable attributes of the spyne.model.primitive.Date type.
DateTime format fed to the strftime function. See: http://docs.python.org/library/datetime.html?highlight=strftime#strftime-strptime-behavior Ignored by protocols like SOAP which have their own ideas about how Date objects should be serialized.
The date should be greater than or equal to this date.
The date should be greater than this date.
The date should be lower than or equal to this date.
The date should be lower than this date.
A regular expression that matches the whole date. See here for more info: http://www.regular-expressions.info/xml.html
Bases: spyne.model._base.SimpleModel
A compact way to represent dates and times together. Supports time zones. Working with timezones is a bit quirky – Spyne works very hard to have all datetimes with time zones internally and only strips them when explicitly requested with timezone=False. See DateTime.Attributes.as_timezone for more information.
Native type is datetime.datetime.
Bases: spyne.model._base.Attributes
Customizable attributes of the spyne.model.primitive.DateTime type.
Outgoing values to the given time zone (by calling .astimezone()).
Incoming values without tzinfo to the given time zone by calling .replace(tzinfo=<as_timezone>) and values with tzinfo to the
given timezone by calling .astimezone().
Either None or a return value of pytz.timezone()
When this is None and a datetime with tzinfo=None comes in, it’s converted to spyne.LOCAL_TZ which defaults to pytz.utc. You can use tzlocal to set it to local time right after import spyne.
DateTime format fed to the strftime function. See: http://docs.python.org/library/datetime.html?highlight=strftime#strftime-strptime-behavior Ignored by protocols like SOAP which have their own ideas about how DateTime objects should be serialized.
The datetime should be greater than or equal to this datetime. It must always have a timezone.
The datetime should be greater than this datetime. It must always have a timezone.
The datetime should be lower than or equal to this datetime. It must always have a timezone.
The datetime should be lower than this datetime. It must always have a timezone.
A regular expression that matches the whole datetime. See here for more info: http://www.regular-expressions.info/xml.html
One of (None, ‘sec’, ‘sec_float’, ‘msec’, ‘msec_float’, ‘usec’)
A regular python string formatting string. %s will contain the date string. See here for more info: http://docs.python.org/library/stdtypes.html#string-formatting
If False, time zone info is stripped before serialization. Also makes sqlalchemy schema generator emit ‘timestamp without timezone’.
Bases: spyne.model._base.SimpleModel
The primitive that corresponds to the native python Decimal.
This is also the base class for denoting numbers.
Note that it is your responsibility to make sure that the scale and precision constraints set in this type is consistent with the values in the context of the decimal package. See the decimal.getcontext() documentation for more information.
Bases: spyne.model._base.Attributes
Customizable attributes of the spyne.model.primitive.Decimal type.
A regular python string formatting string. See here: http://docs.python.org/library/stdtypes.html#string-formatting
Maximum number of digits after the decimal separator.
The value should be greater than or equal to this number.
The value should be greater than this number.
The value should be lower than or equal to this number.
The value should be lower than this number.
Hardware limit that determines the highest value this type can store.
The maximum length of string to be attempted to convert to number.
Hardware limit that determines the lowest value this type can store.
A regular expression that matches the whole field. See here for more info: http://www.regular-expressions.info/xml.html
A regular python string formatting string used by invoking its format() function. See here: http://docs.python.org/2/library/string.html#format-string-syntax
Maximum number of digits.
Bases: spyne.model.primitive.Decimal
This is serialized as the python float. So this type comes with its gotchas. Unless you really know what you’re doing, you should use a Decimal with a pre-defined number of integer and decimal digits.
Bases: spyne.model._base.SimpleModel
Native type is datetime.timedelta.
Bases: spyne.model.primitive.Double
Synonym for Double (as far as python side of things are concerned). It’s here for compatibility reasons.
Bases: spyne.model.primitive.AnyUri
A special kind of String that holds the uri of an image.
Bases: spyne.model.primitive.Decimal
The arbitrary-size signed integer.
The 16-bit signed integer, also known as short.
alias of _BoundedInteger
The 64-bit signed integer, also known as int.
alias of _BoundedInteger
The 64-bit signed integer, also known as long.
alias of _BoundedInteger
The 8-bit signed integer, also known as byte.
alias of _BoundedInteger
Bases: spyne.model.primitive.Unicode
A line type whose native format is a WKT string. You can use shapely.wkt.loads() to get a proper line type.
It’s a subclass of the Unicode type, so regular Unicode constraints apply. The only additional parameter is the number of dimensions.
Parameters: | dim – Number of dimensons. |
---|
The 64-bit signed integer, alias for Integer64.
alias of _BoundedInteger
Bases: spyne.model.primitive.Unicode
A MultiLine type whose native format is a WKT string. You can use shapely.wkt.loads() to get a proper MultiLine type.
It’s a subclass of the Unicode type, so regular Unicode constraints apply. The only additional parameter is the number of dimensions.
Parameters: | dim – Number of dimensons. |
---|
Bases: spyne.model.primitive.Unicode
A MultiPoint type whose native format is a WKT string. You can use shapely.wkt.loads() to get a proper MultiPoint type.
It’s a subclass of the Unicode type, so regular Unicode constraints apply. The only additional parameter is the number of dimensions.
Parameters: | dim – Number of dimensons. |
---|
Bases: spyne.model.primitive.Unicode
A MultiPolygon type whose native format is a WKT string. You can use shapely.wkt.loads() to get a proper MultiPolygon type.
It’s a subclass of the Unicode type, so regular Unicode constraints apply. The only additional parameter is the number of dimensions.
Parameters: | dim – Number of dimensons. |
---|
The arbitrary-size unsigned integer, alias for UnsignedInteger.
alias of UnsignedInteger
Bases: spyne.model.primitive.Unicode
A point type whose native format is a WKT string. You can use shapely.wkt.loads() to get a proper point type.
It’s a subclass of the Unicode type, so regular Unicode constraints apply. The only additional parameter is the number of dimensions.
Parameters: | dim – Number of dimensons. |
---|
Bases: spyne.model.primitive.Unicode
A polygon type whose native format is a WKT string. You can use shapely.wkt.loads() to get a proper polygon type.
It’s a subclass of the Unicode type, so regular Unicode constraints apply. The only additional parameter is the number of dimensions.
Parameters: | dim – Number of dimensons. |
---|
Bases: spyne.model.primitive.UnsignedInteger
The arbitrary-size positive integer (natural number).
The 16-bit signed integer, alias for Integer16.
alias of _BoundedInteger
Bases: spyne.model._base.SimpleModel
Just that, Time. No time zone support.
Native type is datetime.time.
Bases: spyne.model._base.Attributes
Customizable attributes of the spyne.model.primitive.Time type.
The time should be greater than or equal to this time.
The time should be greater than this time.
The time should be lower than or equal to this time.
The time should be lower than this time.
A regular expression that matches the whole time. See here for more info: http://www.regular-expressions.info/xml.html
Bases: spyne.model._base.SimpleModel
The type to represent human-readable data. Its native format is unicode or str with given encoding.
Bases: spyne.model._base.Attributes
Customizable attributes of the spyne.model.primitive.Unicode type.
The encoding of str objects this class may have to deal with.
A regular python string formatting string. See here: http://docs.python.org/library/stdtypes.html#string-formatting
Maximum length of string. Can be set to decimal.Decimal('inf') to accept strings of arbitrary length. You may also need to adjust spyne.server.wsgi.MAX_CONTENT_LENGTH.
Minimum length of string. Can be set to any positive integer
A regular expression that matches the whole string. See here for more info: http://www.regular-expressions.info/xml.html
The argument to the unicode builtin; one of ‘strict’, ‘replace’ or ‘ignore’.
The 8-bit unsigned integer, alias for UnsignedInteger8.
alias of _BoundedUnsignedInteger
The 32-bit unsigned integer, alias for UnsignedInteger32.
alias of _BoundedUnsignedInteger
Bases: spyne.model.primitive.Integer
The arbitrary-size unsigned integer, also known as nonNegativeInteger.
The 16-bit unsigned integer, also known as unsignedShort.
alias of _BoundedUnsignedInteger
The 64-bit unsigned integer, also known as unsignedInt.
alias of _BoundedUnsignedInteger
The 64-bit unsigned integer, also known as unsignedLong.
alias of _BoundedUnsignedInteger
The 8-bit unsigned integer, also known as unsignedByte.
alias of _BoundedUnsignedInteger
The 64-bit unsigned integer, alias for UnsignedInteger64.
alias of _BoundedUnsignedInteger
The 16-bit unsigned integer, alias for UnsignedInteger16.
alias of _BoundedUnsignedInteger
Bases: spyne.model.primitive.Unicode
Unicode subclass for Universially-Unique Identifiers.