New attributes API #117

Closed
opened 2017-04-02 23:18:04 +02:00 by nik · 9 comments
Owner

We want to move a more abstract API for setting attributes on game objects.

For setting an attribute: my_object.foo = bar
For getting an ttribute: my_obecjt.foo

Doing that, we also want to support storing arbitrary data types. It might be advisable to use the Pickle data type from SQLAlchemy as the attribute's value column instead of string.

The __setattr__ method must make sure to not handle attributes that are real databse columns - it must only handle attributes that are not used by the model itself! All others must be passed on to the superclass' __setattr__ method.

Same goes for __getattr__, which must return existing, real attributes verbatim.

Mind that there are a lot of corner cases for all of that!

We want to move a more abstract API for setting attributes on game objects. For setting an attribute: `my_object.foo = bar` For getting an ttribute: `my_obecjt.foo` Doing that, we also want to support storing arbitrary data types. It might be advisable to use the Pickle data type from SQLAlchemy as the attribute's value column instead of string. The `__setattr__` method must make sure to not handle attributes that are real databse columns - it must only handle attributes that are not used by the model itself! All others must be passed on to the superclass' `__setattr__` method. Same goes for `__getattr__`, which must return existing, real attributes verbatim. Mind that there are *a lot* of corner cases for all of that!
Author
Owner

@Creeparoo please work in a new branch, branched from current master.

@Creeparoo please work in a new branch, branched from current `master`.
Author
Owner

Started branch 117-new-attributes-api

Started branch [`117-new-attributes-api`](https://edugit.org/Veripeditus/veripeditus-server/compare/master...117-new-attributes-api)
Author
Owner

Mentioned in commit ac6023acdf

Mentioned in commit ac6023acdf762b0c9b34c458d8d348e34918afd6
Author
Owner

Mentioned in commit 7af3125bc0

Mentioned in commit 7af3125bc07fbb1c17a2c9f2bdb9e4a323a87847
Author
Owner

Mentioned in commit 793fc1acb4

Mentioned in commit 793fc1acb41970b16dfa70da86fd4b874d3fe87c
Author
Owner

Mentioned in commit 270e2a1140

Mentioned in commit 270e2a11409efe9011e4ab9954c6a379fae3d228
Author
Owner

Mentioned in commit 29e7e88323

Mentioned in commit 29e7e88323c8f0f2b0c7239879aa051b6c28cd9e
Author
Owner

Mentioned in commit d83abed90b

Mentioned in commit d83abed90bf6abcc9418475ef35d187f78e60fab
Author
Owner

Status changed to closed by commit d83abed90b

Status changed to closed by commit d83abed90bf6abcc9418475ef35d187f78e60fab
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nik/veripeditus-server#117
No description provided.