Part of twistar.tests.utils View In Hierarchy
Split Table into Classes Show Methods in One Table
Inherited from DBObject:
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 0 | Class Variable | HASMANY | A list made up of some number of strings and
dicts. If an element is a string, it represents what the
class has many of, for instance 'users'. If an element is a
dict, then it should minimally have a name
attribute (with a value the same as if the element were a string) and then
any additional options. See Relationship
and HasMany
for more information. |
| 0 | Class Variable | HASONE | A list made up of some number of strings and
dicts. If an element is a string, it represents what the
class has one of, for instance 'location'. If an element is a
dict, then it should minimally have a name
attribute (with a value the same as if the element were a string) and then
any additional options. See Relationship
and HasOne for
more information. |
| 0 | Class Variable | HABTM | A list made up of some number of strings and
dicts. If an element is a string, it represents what the
class has many of (and which in turn has many of this current object type),
for instance a teacher has and belongs to many students. Both the
Student and Teacher classes should have a class
variable that is HABTM = ['teachers'] and HABTM =
['students'], respectively. If an element is a dict,
then it should minimally have a name attribute (with a value
the same as if the element were a string) and then any additional options.
See Relationship
and HABTM
for more information. |
| 0 | Class Variable | BELONGSTO | A list made up of some number of strings and
dicts. If an element is a string, it represents what the
class belongs to, for instance 'user'. If an element is a
dict, then it should minimally have a name
attribute (with a value the same as if the element were a string) and then
any additional options. See Relationship
and BelongsTo for
more information. |
| 0 | Class Variable | TABLENAME | If specified, use the given tablename as the one for this object.
Otherwise, use the lowercase, plural version of this class's name. See the
DBObject.tablename
method. |
| 61 | Method | __init__ | Constructor. DO NOT OVERWRITE. Use the DBObject.afterInit
method. |
| 80 | Method | updateAttrs | Set the attributes of this object based on the given
dict. |
| 91 | Method | save | Save this object to the database. Validation is performed first; if the
validation fails (that is, if obj.errors.isEmpty() is False)
then the object will not be saved. To test for errors, use
obj.errors.isEmpty(). |
| 114 | Method | validate | No summary |
| 124 | Method | isValid | This method first calls validate
and then returns a deferred that returns True if there were no errors and
False otherwise. |
| 134 | Method | beforeCreate | Method called before a new object is created. Classes can overwrite
this method. If False is returned, then the object is not saved in the
database. This method may return a Deferred. |
| 142 | Method | beforeUpdate | Method called before an existing object is updated. Classes can
overwrite this method. If False is returned, then the object is not saved
in the database. This method may return a Deferred. |
| 150 | Method | beforeSave | Method called before an object is saved. Classes can overwrite this
method. If False is returned, then the object is not saved in the database.
This method may return a Deferred. |
| 161 | Method | afterInit | Method called when a new DBObject is
instantiated. Classes can overwrite this method. This method may return a
Deferred. |
| 168 | Method | beforeDelete | Method called before a DBObject is deleted.
Classes can overwrite this method. If False is returned, then the DBObject is not
deleted from database. This method may return a Deferred. |
| 222 | Method | refresh | Update the properties for this object from the database. |
| 231 | Method | toHash | Convert this object to a dictionary. |
| 257 | Method | delete | Delete this instance from the database. Calls beforeDelete
before deleting from the database. |
| 284 | Method | loadRelations | No summary |
| 313 | Class Method | addRelation | Add a relationship to the given Class. |
| 342 | Class Method | initRelationshipCache | Initialize the cache of relationship objects for this class. |
| 353 | Class Method | tablename | Get the tablename for the given class. If the class has a
TABLENAME variable then that will be used - otherwise, it is
is inferred from the class name. |
| 368 | Class Method | findOrCreate | Find all instances of a given class based on the attributes given (just
like findBy). |
| 382 | Class Method | findBy | Find all instances of the given class based on an exact match of attributes. |
| 396 | Class Method | find | Find instances of a given class. |
| 428 | Class Method | count | Count instances of a given class. |
| 444 | Class Method | all | Get all instances of the given class in the database. Note that this is
the equivalent of calling find with no
arguments. |
| 456 | Class Method | deleteAll | Delete all instances of klass in the database without
instantiating the records first or invoking callbacks (beforeDelete
is not called). This will run a single SQL DELETE statement in the
database. |
| 473 | Class Method | exists | Find whether or not at least one instance of the given
klass exists, optionally with specific conditions specified in
where. |
| 489 | Method | __str__ | Get the string version of this object. |
| 501 | Method | __getattribute__ | Get the given attribute. |
| 520 | Method | __eq__ | Determine if this object is the same as another (only taking the type of
the other class and it's id into account). |
| 534 | Method | __neq__ | Determine if this object is not the same as another (only taking the
type of the other class and it's id into account). |
| 176 | Method | _create | Method to actually create an object in the DB. Handles calling this
class's beforeCreate
followed by it's beforeSave
method. |
| 199 | Method | _update | Method to actually save an existing object in the DB. Handles calling
this class's beforeUpdate
and beforeSave
methods. |
Inherited from Validator (via DBObject):
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 0 | Class Variable | VALIDATIONS | A list of functions to call when testing whether or not a
particular instance is valid. |
| 95 | Class Method | clearValidations | Clear the given class's validations. |
| 103 | Class Method | addValidator | Add a function to the given classes validation list. |
| 121 | Class Method | validatesPresenceOf | A validator to test whether or not some named properties are set. For
those named properties that are not set, an error will be recorded in
obj.errors. |
| 137 | Class Method | validatesUniquenessOf | A validator to test whether or not some named properties are unique. For
those named properties that are not unique, an error will be recorded in
obj.errors. |
| 153 | Class Method | validatesLengthOf | No summary |
| 175 | Class Method | _validate | Validate a given object using all of the set validators for the objects
class. If errors are found, they will be recorded in the objects
errors property. |
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 520 | Method | __eq__ | Determine if this object is the same as another (only taking the type of
the other class and it's id into account). |
| 501 | Method | __getattribute__ | Get the given attribute. |
| 61 | Method | __init__ | Constructor. DO NOT OVERWRITE. Use the DBObject.afterInit
method. |
| 534 | Method | __neq__ | Determine if this object is not the same as another (only taking the
type of the other class and it's id into account). |
| 489 | Method | __str__ | Get the string version of this object. |
| 313 | Class Method | addRelation | Add a relationship to the given Class. |
| 103 | Class Method | addValidator | Add a function to the given classes validation list. |
| 161 | Method | afterInit | Method called when a new DBObject is
instantiated. Classes can overwrite this method. This method may return a
Deferred. |
| 444 | Class Method | all | Get all instances of the given class in the database. Note that this is
the equivalent of calling find with no
arguments. |
| 134 | Method | beforeCreate | Method called before a new object is created. Classes can overwrite
this method. If False is returned, then the object is not saved in the
database. This method may return a Deferred. |
| 168 | Method | beforeDelete | Method called before a DBObject is deleted.
Classes can overwrite this method. If False is returned, then the DBObject is not
deleted from database. This method may return a Deferred. |
| 150 | Method | beforeSave | Method called before an object is saved. Classes can overwrite this
method. If False is returned, then the object is not saved in the database.
This method may return a Deferred. |
| 142 | Method | beforeUpdate | Method called before an existing object is updated. Classes can
overwrite this method. If False is returned, then the object is not saved
in the database. This method may return a Deferred. |
| 0 | Class Variable | BELONGSTO | A list made up of some number of strings and
dicts. If an element is a string, it represents what the
class belongs to, for instance 'user'. If an element is a
dict, then it should minimally have a name
attribute (with a value the same as if the element were a string) and then
any additional options. See Relationship
and BelongsTo for
more information. |
| 95 | Class Method | clearValidations | Clear the given class's validations. |
| 428 | Class Method | count | Count instances of a given class. |
| 257 | Method | delete | Delete this instance from the database. Calls beforeDelete
before deleting from the database. |
| 456 | Class Method | deleteAll | Delete all instances of klass in the database without
instantiating the records first or invoking callbacks (beforeDelete
is not called). This will run a single SQL DELETE statement in the
database. |
| 473 | Class Method | exists | Find whether or not at least one instance of the given
klass exists, optionally with specific conditions specified in
where. |
| 396 | Class Method | find | Find instances of a given class. |
| 382 | Class Method | findBy | Find all instances of the given class based on an exact match of attributes. |
| 368 | Class Method | findOrCreate | Find all instances of a given class based on the attributes given (just
like findBy). |
| 0 | Class Variable | HABTM | A list made up of some number of strings and
dicts. If an element is a string, it represents what the
class has many of (and which in turn has many of this current object type),
for instance a teacher has and belongs to many students. Both the
Student and Teacher classes should have a class
variable that is HABTM = ['teachers'] and HABTM =
['students'], respectively. If an element is a dict,
then it should minimally have a name attribute (with a value
the same as if the element were a string) and then any additional options.
See Relationship
and HABTM
for more information. |
| 0 | Class Variable | HASMANY | A list made up of some number of strings and
dicts. If an element is a string, it represents what the
class has many of, for instance 'users'. If an element is a
dict, then it should minimally have a name
attribute (with a value the same as if the element were a string) and then
any additional options. See Relationship
and HasMany
for more information. |
| 0 | Class Variable | HASONE | A list made up of some number of strings and
dicts. If an element is a string, it represents what the
class has one of, for instance 'location'. If an element is a
dict, then it should minimally have a name
attribute (with a value the same as if the element were a string) and then
any additional options. See Relationship
and HasOne for
more information. |
| 342 | Class Method | initRelationshipCache | Initialize the cache of relationship objects for this class. |
| 124 | Method | isValid | This method first calls validate
and then returns a deferred that returns True if there were no errors and
False otherwise. |
| 284 | Method | loadRelations | No summary |
| 222 | Method | refresh | Update the properties for this object from the database. |
| 91 | Method | save | Save this object to the database. Validation is performed first; if the
validation fails (that is, if obj.errors.isEmpty() is False)
then the object will not be saved. To test for errors, use
obj.errors.isEmpty(). |
| 0 | Class Variable | TABLENAME | If specified, use the given tablename as the one for this object.
Otherwise, use the lowercase, plural version of this class's name. See the
DBObject.tablename
method. |
| 353 | Class Method | tablename | Get the tablename for the given class. If the class has a
TABLENAME variable then that will be used - otherwise, it is
is inferred from the class name. |
| 231 | Method | toHash | Convert this object to a dictionary. |
| 80 | Method | updateAttrs | Set the attributes of this object based on the given
dict. |
| 114 | Method | validate | No summary |
| 153 | Class Method | validatesLengthOf | No summary |
| 121 | Class Method | validatesPresenceOf | A validator to test whether or not some named properties are set. For
those named properties that are not set, an error will be recorded in
obj.errors. |
| 137 | Class Method | validatesUniquenessOf | A validator to test whether or not some named properties are unique. For
those named properties that are not unique, an error will be recorded in
obj.errors. |
| 0 | Class Variable | VALIDATIONS | A list of functions to call when testing whether or not a
particular instance is valid. |
| 176 | Method | _create | Method to actually create an object in the DB. Handles calling this
class's beforeCreate
followed by it's beforeSave
method. |
| 199 | Method | _update | Method to actually save an existing object in the DB. Handles calling
this class's beforeUpdate
and beforeSave
methods. |
| 175 | Class Method | _validate | Validate a given object using all of the set validators for the objects
class. If errors are found, they will be recorded in the objects
errors property. |