192 query that correctly order files by their `data_name` attribute. |
192 query that correctly order files by their `data_name` attribute. |
193 |
193 |
194 |
194 |
195 .. Note:: |
195 .. Note:: |
196 |
196 |
197 * Adapters have been introduced in CubicWeb 3.9 / cubicweb-folder 1.8. |
|
198 |
|
199 * As seen earlier, we want to **replace** the folder's `ITree` adapter by our |
197 * As seen earlier, we want to **replace** the folder's `ITree` adapter by our |
200 implementation, hence the custom `registration_callback` method. |
198 implementation, hence the custom `registration_callback` method. |
201 |
199 |
202 |
200 |
203 Ouf. That one was tricky... |
201 Ouf. That one was tricky... |
239 previous / next entity or `None`. We make an RQL query to get files in the same |
237 previous / next entity or `None`. We make an RQL query to get files in the same |
240 folder, ordered similarly (eg by their `data_name` attribute). We set |
238 folder, ordered similarly (eg by their `data_name` attribute). We set |
241 ascendant/descendant ordering and a strict comparison with current file's name |
239 ascendant/descendant ordering and a strict comparison with current file's name |
242 (the "X" variable representing the current file). |
240 (the "X" variable representing the current file). |
243 |
241 |
244 .. Note:: |
|
245 |
|
246 * Former `implements` selector should be replaced by one of `is_instance` / |
|
247 `adaptable` selector with CubicWeb >= 3.9. In our case, `is_instance` to |
|
248 tell our adapter is able to adapt `File` entities. |
|
249 |
|
250 Notice that this query supposes we wont have two files of the same name in the |
242 Notice that this query supposes we wont have two files of the same name in the |
251 same folder, else things may go wrong. Fixing this is out of the scope of this |
243 same folder, else things may go wrong. Fixing this is out of the scope of this |
252 blog. And as I would like to have at some point a smarter, context sensitive |
244 blog. And as I would like to have at some point a smarter, context sensitive |
253 previous/next entity, I'll probably never fix this query (though if I had to, I |
245 previous/next entity, I'll probably never fix this query (though if I had to, I |
254 would probably choosing to add a constraint in the schema so that we can't add |
246 would probably choosing to add a constraint in the schema so that we can't add |
356 $ cubicweb-ctl upgrade sytweb |
348 $ cubicweb-ctl upgrade sytweb |
357 |
349 |
358 You'll have to answer some questions, as we've seen in `an earlier post`_. |
350 You'll have to answer some questions, as we've seen in `an earlier post`_. |
359 |
351 |
360 Now that everything is tested, I can transfer the new code to the production |
352 Now that everything is tested, I can transfer the new code to the production |
361 server, `apt-get upgrade` cubicweb 3.9 and its dependencies, and eventually |
353 server, `apt-get upgrade` cubicweb and its dependencies, and eventually |
362 upgrade the production instance. |
354 upgrade the production instance. |
363 |
355 |
364 |
356 |
365 .. _`several improvments`: http://www.cubicweb.org/blogentry/1179899 |
357 .. _`several improvments`: http://www.cubicweb.org/blogentry/1179899 |
366 .. _`3.8`: http://www.cubicweb.org/blogentry/917107 |
358 .. _`3.8`: http://www.cubicweb.org/blogentry/917107 |