Commit Graph

22 Commits

Author SHA1 Message Date
Stein Magnus Jodal
3346778c41 models: Fix encoding error in Identifier field
Fixes #1508
2016-08-11 23:55:31 +02:00
Stein Magnus Jodal
6a01a2e906 models: Test Identifier field type 2016-08-07 21:30:56 +02:00
Thomas Adamcik
fb823d1a7c lint: Workaround and fix to account for new version of flake8 2016-07-25 21:09:38 +02:00
Thomas Adamcik
b480311d66 models: Add ValidatedImmutableObject and "revert" ImmutableObject
Testing with extension that use custom models it was discovered that the
changes to have type safe models were a bit to invasive to be suitable for a
minor release. This change fixes this by bringing back ImmutableObjects in
their old form, and moving the shinny new features to ValidatedImmutableObject.

A subset of the tests for ImmutableObjects have been resurrected to have some
confidence in this working the way we think it should.
2015-05-04 23:41:11 +02:00
Thomas Adamcik
7f6809aebb models: Explicitly define which models can be deserialized 2015-05-04 22:36:27 +02:00
Thomas Adamcik
07159f69c2 models: Decouple fields tests from the model metaclass 2015-05-04 21:37:17 +02:00
Thomas Adamcik
bb95dc3b9b models: Make sure parent fields are used by children.
Without this change any sub-class would end up with an empty _fields and none
of the actual fields would be writable even internally.
2015-05-03 22:58:43 +02:00
Thomas Adamcik
94039e06dc models: Make sure sub-classes can extend models 2015-04-29 21:32:43 +02:00
Thomas Adamcik
8851fb151c models: Allow Ref.type to have any value
This is to address a potential breakage brought up in #1150 as it turns out
Mopidy-Podcast uses custom models and ref types.
2015-04-28 22:58:15 +02:00
Thomas Adamcik
7e59a5aecb models: Split models into smaller modules 2015-04-25 00:11:41 +02:00
Thomas Adamcik
20019edf2d models: Fix review comments 2015-04-12 16:03:51 +02:00
Thomas Adamcik
6327a67874 models: Make sure we really only add __weakref__ once 2015-04-11 00:47:53 +02:00
Thomas Adamcik
05244f7e60 models: Deprecate copy and add replace method
Changed as with the memoization copy was lying, so replace is a better name.
2015-04-08 01:41:50 +02:00
Thomas Adamcik
b7375323e9 models: Memoize identical instances automatically
This combined with the previous changes has brought the memory use for a 14k
track test-set down from about 75MB to 17MB or so. Note that this does however,
mean that copy is now lying to us as it does not such thing whenever it can
avoid it.
2015-04-08 01:14:56 +02:00
Thomas Adamcik
86481b1d50 models: Shortcut case where copy didn't change anything
We no longer copy in this case and will just give you the same instance back.
2015-04-08 00:34:02 +02:00
Thomas Adamcik
0fee1b4b11 models: Switch to slots to reduce memory usage per instance 2015-04-08 00:30:53 +02:00
Thomas Adamcik
08fd99ffdb models: Add Identifer type which interns values.
This gives some moderate memory saving since the values are used in multiple
places.
2015-04-08 00:11:23 +02:00
Thomas Adamcik
9b442e1563 review: Address review comments 2015-04-06 23:27:46 +02:00
Thomas Adamcik
2d03cd7290 models: Make fields handle unsetting defaults in __dict__ 2015-04-05 13:09:19 +02:00
Thomas Adamcik
73415ce60f models: Make sure del on attributes does not work 2015-04-05 13:08:15 +02:00
Thomas Adamcik
07912e1091 models: Add fields for supporting validation of models
Feature makes use of python descriptors to hook in type checking and other
validation when fields get set.
2015-04-05 13:08:15 +02:00
Thomas Adamcik
5c0430ef4a tests: Move models tests into a directory 2015-04-05 13:08:15 +02:00