15 |
15 |
16 |
16 |
17 :Formatting and output generation: |
17 :Formatting and output generation: |
18 |
18 |
19 * `view(vid, **kwargs)`, applies the given view to the entity |
19 * `view(vid, **kwargs)`, applies the given view to the entity |
|
20 (and returns an unicode string) |
20 |
21 |
21 * `absolute_url(**kwargs)`, returns an absolute URL to access the primary view |
22 * `absolute_url(**kwargs)`, returns an absolute URL to access the primary view |
22 of an entity |
23 of an entity |
23 |
24 |
24 * `rest_path()`, returns a relative REST URL to get the entity |
25 * `rest_path()`, returns a relative REST URL to get the entity |
30 :Data handling: |
31 :Data handling: |
31 |
32 |
32 * `as_rset()`, converts the entity into an equivalent result set simulating the |
33 * `as_rset()`, converts the entity into an equivalent result set simulating the |
33 request `Any X WHERE X eid _eid_` |
34 request `Any X WHERE X eid _eid_` |
34 |
35 |
35 * `complete(skip_bytes=True)`, executes a request that recovers all at once |
36 * `complete(skip_bytes=True)`, executes a request that recovers at |
36 all the missing attributes of an entity |
37 once all the missing attributes of an entity |
37 |
38 |
38 * `get_value(name)`, returns the value associated to the attribute name given |
39 * `get_value(name)`, returns the value associated to the attribute name given |
39 in parameter |
40 in parameter |
40 |
41 |
41 * `related(rtype, x='subject', limit=None, entities=False)`, returns a list |
42 * `related(rtype, role='subject', limit=None, entities=False)`, |
42 of entities related to the current entity by the relation given in parameter |
43 returns a list of entities related to the current entity by the |
|
44 relation given in parameter |
43 |
45 |
44 * `unrelated(rtype, targettype, x='subject', limit=None)`, returns a result set |
46 * `unrelated(rtype, targettype, role='subject', limit=None)`, |
45 corresponding to the entities not related to the current entity by the |
47 returns a result set corresponding to the entities not (yet) |
46 relation given in parameter and satisfying its constraints |
48 related to the current entity by the relation given in parameter |
|
49 and satisfying its constraints |
47 |
50 |
48 * `set_attributes(**kwargs)`, updates the attributes list with the corresponding |
51 * `set_attributes(**kwargs)`, updates the attributes list with the corresponding |
49 values given named parameters |
52 values given named parameters |
|
53 |
|
54 * `set_relations(**kwargs)`, add relations to the given object. To |
|
55 set a relation where this entity is the object of the relation, |
|
56 use 'reverse_'<relation> as argument name. Values may be an |
|
57 entity, a list of entities, or None (meaning that all relations of |
|
58 the given type from or to this object should be deleted). |
50 |
59 |
51 * `copy_relations(ceid)`, copies the relations of the entities having the eid |
60 * `copy_relations(ceid)`, copies the relations of the entities having the eid |
52 given in the parameters on the current entity |
61 given in the parameters on the current entity |
53 |
62 |
54 * `delete()` allows to delete the entity |
63 * `delete()` allows to delete the entity |
64 |
73 |
65 The class `AnyEntity` is a sub-class of Entity that add methods to it, |
74 The class `AnyEntity` is a sub-class of Entity that add methods to it, |
66 and helps specializing (by further subclassing) the handling of a |
75 and helps specializing (by further subclassing) the handling of a |
67 given entity type. |
76 given entity type. |
68 |
77 |
69 The methods defined for `AnyEntity`, in addition to `Entity`, are the |
78 Most methods defined for `AnyEntity`, in addition to `Entity`, add |
70 following ones: |
79 support for the `Dublin Core`_ metadata. |
|
80 |
|
81 .. _`Dublin Core`: http://dublincore.org/ |
71 |
82 |
72 :Standard meta-data (Dublin Core): |
83 :Standard meta-data (Dublin Core): |
73 |
84 |
74 * `dc_title()`, returns a unicode string corresponding to the |
85 * `dc_title()`, returns a unicode string corresponding to the |
75 meta-data `Title` (used by default is the first non-meta attribute |
86 meta-data `Title` (used by default is the first non-meta attribute |
83 description attribute by default) |
94 description attribute by default) |
84 |
95 |
85 * `dc_authors()`, returns a unicode string corresponding to the meta-data |
96 * `dc_authors()`, returns a unicode string corresponding to the meta-data |
86 `Authors` (owners by default) |
97 `Authors` (owners by default) |
87 |
98 |
|
99 * `dc_creator()`, returns a unicode string corresponding to the |
|
100 creator of the entity |
|
101 |
88 * `dc_date(date_format=None)`, returns a unicode string corresponding to |
102 * `dc_date(date_format=None)`, returns a unicode string corresponding to |
89 the meta-data `Date` (update date by default) |
103 the meta-data `Date` (update date by default) |
90 |
104 |
91 * `dc_type(form='')`, returns a string to display the entity type by |
105 * `dc_type(form='')`, returns a string to display the entity type by |
92 specifying the preferred form (`plural` for a plural form) |
106 specifying the preferred form (`plural` for a plural form) |
93 |
107 |
|
108 * `dc_language()`, returns the language used by the entity |
|
109 |
|
110 |
|
111 :Misc methods: |
|
112 |
|
113 * `after_deletion_path`, return (path, parameters) which should be |
|
114 used as redirect information when this entity is being deleted |
|
115 |
|
116 * `pre_web_edit`, callback called by the web editcontroller when an |
|
117 entity will be created/modified, to let a chance to do some entity |
|
118 specific stuff (does nothing by default) |
94 |
119 |
95 Inheritance |
120 Inheritance |
96 ----------- |
121 ----------- |
97 |
122 |
98 When describing a data model, entities can inherit from other entities as is |
123 When describing a data model, entities can inherit from other entities as is |