annotate doc/upgrade.txt @ 820:1837f39efd6f experimental-inline

Sync (old) experimental inline branch with trunk@1027.
author cmlenz
date Wed, 11 Mar 2009 17:51:06 +0000
parents
children 09cc3627654c
rev   line source
820
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
1 ================
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
2 Upgrading Genshi
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
3 ================
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
4
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
5
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
6 .. contents:: Contents
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
7 :depth: 2
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
8 .. sectnum::
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
9
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
10
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
11 ------------------------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
12 Upgrading from Genshi 0.5.x to 0.6.x
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
13 ------------------------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
14
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
15 Required Python Version
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
16 -----------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
17
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
18 Support for Python 2.3 has been dropped in this release. Python 2.4 is
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
19 now the minimum version of Python required to run Genshi.
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
20
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
21
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
22 ------------------------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
23 Upgrading from Genshi 0.4.x to 0.5.x
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
24 ------------------------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
25
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
26 Error Handling
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
27 --------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
28
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
29 The default error handling mode has been changed to "strict". This
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
30 means that accessing variables not defined in the template data will
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
31 now generate an immediate exception, as will accessing object
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
32 attributes or dictionary keys that don't exist. If your templates rely
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
33 on the old lenient behavior, you can configure Genshi to use that
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
34 instead. See the documentation for details on how to do that. But be
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
35 warned that lenient error handling may be removed completely in a
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
36 future release.
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
37
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
38 Match Template Processing
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
39 -------------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
40
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
41 There has also been a subtle change to how ``py:match`` templates are
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
42 processed: in previous versions, all match templates would be applied
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
43 to the content generated by the matching template, and only the
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
44 matching template itself was applied recursively to the original
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
45 content. This behavior resulted in problems with many kinds of
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
46 recursive matching, and hence was changed for 0.5: now, all match
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
47 templates declared before the matching template are applied to the
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
48 original content, and match templates declared after the matching
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
49 template are applied to the generated content. This change should not
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
50 have any effect on most applications, but you may want to check your
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
51 use of match templates to make sure.
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
52
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
53 Text Templates
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
54 --------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
55
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
56 Genshi 0.5 introduces a new, alternative syntax for text templates,
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
57 which is more flexible and powerful compared to the old syntax. For
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
58 backwards compatibility, this new syntax is not used by default,
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
59 though it will be in a future version. It is recommended that you
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
60 migrate to using this new syntax. To do so, simply rename any
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
61 references in your code to ``TextTemplate`` to ``NewTextTemplate``. To
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
62 explicitly use the old syntax, use ``OldTextTemplate`` instead, so
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
63 that you can be sure you'll be using the same language when the
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
64 default in Genshi is changed (at least until the old implementation is
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
65 completely removed).
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
66
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
67 ``Markup`` Constructor
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
68 ----------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
69
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
70 The ``Markup`` class no longer has a specialized constructor. The old
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
71 (undocumented) constructor provided a shorthand for doing positional
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
72 substitutions. If you have code like this:
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
73
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
74 .. code-block:: python
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
75
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
76 Markup('<b>%s</b>', name)
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
77
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
78 You must replace it by the more explicit:
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
79
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
80 .. code-block:: python
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
81
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
82 Markup('<b>%s</b>') % name
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
83
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
84 ``Template`` Constructor
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
85 ------------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
86
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
87 The constructor of the ``Template`` class and its subclasses has changed
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
88 slightly: instead of the optional ``basedir`` parameter, it now expects
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
89 an (also optional) ``filepath`` parameter, which specifies the absolute
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
90 path to the template. You probably aren't using those constructors
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
91 directly, anyway, but using the ``TemplateLoader`` API instead.
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
92
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
93
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
94 ------------------------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
95 Upgrading from Genshi 0.3.x to 0.4.x
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
96 ------------------------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
97
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
98 The modules ``genshi.filters`` and ``genshi.template`` have been
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
99 refactored into packages containing multiple modules. While code using
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
100 the regular APIs should continue to work without problems, you should
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
101 make sure to remove any leftover traces of the files ``filters.py``
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
102 and ``template.py`` in the ``genshi`` package on the installation
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
103 path (including the corresponding ``.pyc`` files). This is not
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
104 necessary when Genshi was installed as a Python egg.
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
105
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
106 Results of evaluating template expressions are no longer implicitly
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
107 called if they are callable. If you have been using that feature, you
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
108 will need to add the parenthesis to actually call the function.
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
109
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
110 Instances of ``genshi.core.Attrs`` are now immutable. Filters
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
111 manipulating the attributes in a stream may need to be updated. Also,
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
112 the ``Attrs`` class no longer automatically wraps all attribute names
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
113 in ``QName`` objects, so users of the ``Attrs`` class need to do this
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
114 themselves. See the documentation of the ``Attrs`` class for more
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
115 information.
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
116
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
117
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
118 ---------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
119 Upgrading from Markup
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
120 ---------------------
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
121
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
122 Prior to version 0.3, the name of the Genshi project was "Markup". The
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
123 name change means that you will have to adjust your import statements
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
124 and the namespace URI of XML templates, among other things:
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
125
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
126 * The package name was changed from "markup" to "genshi". Please
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
127 adjust any import statements referring to the old package name.
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
128 * The namespace URI for directives in Genshi XML templates has changed
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
129 from ``http://markup.edgewall.org/`` to
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
130 ``http://genshi.edgewall.org/``. Please update the ``xmlns:py``
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
131 declaration in your template files accordingly.
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
132
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
133 Furthermore, due to the inclusion of a text-based template language,
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
134 the class::
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
135
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
136 markup.template.Template
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
137
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
138 has been renamed to::
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
139
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
140 genshi.template.MarkupTemplate
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
141
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
142 If you've been using the Template class directly, you'll need to
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
143 update your code (a simple find/replace should do—the API itself
1837f39efd6f Sync (old) experimental inline branch with trunk@1027.
cmlenz
parents:
diff changeset
144 did not change).
Copyright (C) 2012-2017 Edgewall Software