@@ -7,13 +7,13 @@ Components
7
7
First let's see the component, that is elements taking parts in collections::
8
8
9
9
>>> from dolmen.collection.components import Component
10
- >>> c1 = Component(u 'The Sun', 'sun')
10
+ >>> c1 = Component('The Sun', 'sun')
11
11
>>> c1
12
12
<Component The Sun>
13
13
>>> c1.identifier
14
14
'sun'
15
15
>>> c1.title # doctest: +ALLOW_UNICODE
16
- u 'The Sun'
16
+ 'The Sun'
17
17
18
18
It correctly implement IComponent::
19
19
@@ -24,13 +24,13 @@ It correctly implement IComponent::
24
24
25
25
You can create a component without an id, using a title::
26
26
27
- >>> c2 = Component(u 'Moon')
27
+ >>> c2 = Component('Moon')
28
28
>>> c2
29
29
<Component Moon>
30
30
>>> c2.identifier
31
31
'moon'
32
32
>>> c2.title # doctest: +ALLOW_UNICODE
33
- u 'Moon'
33
+ 'Moon'
34
34
35
35
Title only accept string argument
36
36
a number (it won't be converted to string. Like this, this support
@@ -44,10 +44,10 @@ If by doing so, the title contain spaces, they will be replaced by
44
44
``-``. If UTF-8 character are included, the identifiant will be
45
45
encoded::
46
46
47
- >>> c3 = Component(u 'Some lost planet')
47
+ >>> c3 = Component('Some lost planet')
48
48
>>> c3.identifier
49
49
'some-lost-planet'
50
- >>> c4 = Component(u 'État du désir')
50
+ >>> c4 = Component('État du désir')
51
51
>>> c4.identifier
52
52
'44379436291150180186884816837720809088'
53
53
@@ -179,19 +179,19 @@ You can remove all elements from a collection::
179
179
Ignoring already defined components
180
180
...................................
181
181
182
- >>> from dolmen.collection.components import IGNORE
182
+ >>> from dolmen.collection.components import IGNORE
183
183
>>> ignoring = Collection()
184
184
>>> ignoring.behavior = IGNORE
185
-
185
+
186
186
>>> ignoring.append(c1)
187
187
>>> list(ignoring)
188
188
[<Component The Sun>]
189
189
>>> ignoring.append(c2)
190
190
>>> list(ignoring)
191
191
[<Component The Sun>, <Component Moon>]
192
192
193
- >>> c1prime = Component(u 'The Sun prime', 'sun')
194
-
193
+ >>> c1prime = Component('The Sun prime', 'sun')
194
+
195
195
You can add twice the same component, the second is ignored::
196
196
197
197
>>> ignoring.append(c1prime)
@@ -202,7 +202,7 @@ You can add twice the same component, the second is ignored::
202
202
Overriding already defined components
203
203
.....................................
204
204
205
- >>> from dolmen.collection.components import OVERRIDE
205
+ >>> from dolmen.collection.components import OVERRIDE
206
206
>>> overriding = Collection()
207
207
>>> overriding.behavior = OVERRIDE
208
208
@@ -213,8 +213,8 @@ Overriding already defined components
213
213
>>> list(overriding)
214
214
[<Component The Sun>, <Component Moon>]
215
215
216
- >>> c1prime = Component(u 'The Sun prime', 'sun')
217
-
216
+ >>> c1prime = Component('The Sun prime', 'sun')
217
+
218
218
You can add twice the same component, the second overrides the first::
219
219
220
220
>>> overriding.append(c1prime)
@@ -389,7 +389,7 @@ Parameters on collections
389
389
You can provides extra parameters on collections that will be set as
390
390
attributes on the object::
391
391
392
- >>> s6 = Collection(s2, name=u 'me', city=u 'rotterdam')
392
+ >>> s6 = Collection(s2, name='me', city='rotterdam')
393
393
>>> s6
394
394
<Collection>
395
395
>>> list(s6)
0 commit comments