comparison doc/upgrade.txt @ 713:5420fe9d99a9 trunk

The `Markup` class now supports mappings for right hand of the `%` (modulo) operator in the same way the Python string classes do, except that the substituted values are escape. Also, the special constructor which took positional arguments that would be substituted was removed. Thus the `Markup` class now supports the same arguments as that of its `unicode` base class. Closes #211. Many thanks to Christian Boos for the patch!
author cmlenz
date Tue, 08 Apr 2008 18:18:18 +0000
parents 07e3f6f0ef57
children fc6d9d2a3527
comparison
equal deleted inserted replaced
710:0af8f63514b8 713:5420fe9d99a9
1 ================
1 Upgrading Genshi 2 Upgrading Genshi
2 ================ 3 ================
3 4
4 5
5 .. contents:: Contents 6 .. contents:: Contents
6 :depth: 2 7 :depth: 2
7 .. sectnum:: 8 .. sectnum::
8 9
9 10
11 ------------------------------------
10 Upgrading from Genshi 0.4.x to 0.5.x 12 Upgrading from Genshi 0.4.x to 0.5.x
11 ------------------------------------ 13 ------------------------------------
12 14
13 Genshi 0.5 introduces a new, alternative syntax for text templates, 15 Error Handling
14 which is more flexible and powerful compared to the old syntax. For 16 --------------
15 backwards compatibility, this new syntax is not used by default,
16 though it will be in a future version. It is recommended that you
17 migrate to using this new syntax. To do so, simply rename any
18 references in your code to ``TextTemplate`` to ``NewTextTemplate``. To
19 explicitly use the old syntax, use ``OldTextTemplate`` instead, so
20 that you can be sure you'll be using the same language when the
21 default in Genshi is changed (at least until the old implementation is
22 completely removed).
23 17
24 The default error handling mode has been changed to "strict". This 18 The default error handling mode has been changed to "strict". This
25 means that accessing variables not defined in the template data will 19 means that accessing variables not defined in the template data will
26 now generate an immediate exception, as will accessing object 20 now generate an immediate exception, as will accessing object
27 attributes or dictionary keys that don't exist. If your templates rely 21 attributes or dictionary keys that don't exist. If your templates rely
28 on the old lenient behavior, you can configure Genshi to use that 22 on the old lenient behavior, you can configure Genshi to use that
29 instead. See the documentation for details on how to do that. But be 23 instead. See the documentation for details on how to do that. But be
30 warned that lenient error handling may be removed completely in a 24 warned that lenient error handling may be removed completely in a
31 future release. 25 future release.
26
27 Match Template Processing
28 -------------------------
32 29
33 There has also been a subtle change to how ``py:match`` templates are 30 There has also been a subtle change to how ``py:match`` templates are
34 processed: in previous versions, all match templates would be applied 31 processed: in previous versions, all match templates would be applied
35 to the content generated by the matching template, and only the 32 to the content generated by the matching template, and only the
36 matching template itself was applied recursively to the original 33 matching template itself was applied recursively to the original
40 original content, and match templates declared after the matching 37 original content, and match templates declared after the matching
41 template are applied to the generated content. This change should not 38 template are applied to the generated content. This change should not
42 have any effect on most applications, but you may want to check your 39 have any effect on most applications, but you may want to check your
43 use of match templates to make sure. 40 use of match templates to make sure.
44 41
42 Text Templates
43 --------------
45 44
45 Genshi 0.5 introduces a new, alternative syntax for text templates,
46 which is more flexible and powerful compared to the old syntax. For
47 backwards compatibility, this new syntax is not used by default,
48 though it will be in a future version. It is recommended that you
49 migrate to using this new syntax. To do so, simply rename any
50 references in your code to ``TextTemplate`` to ``NewTextTemplate``. To
51 explicitly use the old syntax, use ``OldTextTemplate`` instead, so
52 that you can be sure you'll be using the same language when the
53 default in Genshi is changed (at least until the old implementation is
54 completely removed).
55
56 ``Markup`` Constructor
57 ----------------------
58
59 The ``Markup`` class now longer has a specialized constructor. The old
60 (undocumented) constructor provided a shorthand for doing positional
61 substitutions. If you have code like this:
62
63 .. code-block:: python
64
65 Markup('<b>%s</b>', name)
66
67 You can simply replace it by the more explicit:
68
69 .. code-block:: python
70
71 Markup('<b>%s</b>') % name
72
73
74 ------------------------------------
46 Upgrading from Genshi 0.3.x to 0.4.x 75 Upgrading from Genshi 0.3.x to 0.4.x
47 ------------------------------------ 76 ------------------------------------
48 77
49 The modules ``genshi.filters`` and ``genshi.template`` have been 78 The modules ``genshi.filters`` and ``genshi.template`` have been
50 refactored into packages containing multiple modules. While code using 79 refactored into packages containing multiple modules. While code using
64 in ``QName`` objects, so users of the ``Attrs`` class need to do this 93 in ``QName`` objects, so users of the ``Attrs`` class need to do this
65 themselves. See the documentation of the ``Attrs`` class for more 94 themselves. See the documentation of the ``Attrs`` class for more
66 information. 95 information.
67 96
68 97
98 ---------------------
69 Upgrading from Markup 99 Upgrading from Markup
70 --------------------- 100 ---------------------
71 101
72 Prior to version 0.3, the name of the Genshi project was "Markup". The 102 Prior to version 0.3, the name of the Genshi project was "Markup". The
73 name change means that you will have to adjust your import statements 103 name change means that you will have to adjust your import statements
Copyright (C) 2012-2017 Edgewall Software