Mercurial > genshi > genshi-test
comparison doc/upgrade.txt @ 606:9ada030ad986
Changed the default error handling mode to "strict".
author | cmlenz |
---|---|
date | Mon, 27 Aug 2007 20:05:31 +0000 |
parents | UPGRADE.txt@7145e4eba2ec |
children | 812671b40022 |
comparison
equal
deleted
inserted
replaced
605:bc5faca93699 | 606:9ada030ad986 |
---|---|
1 Upgrading Genshi | |
2 ================ | |
3 | |
4 | |
5 .. contents:: Contents | |
6 :depth: 2 | |
7 .. sectnum:: | |
8 | |
9 | |
10 Upgrading from Genshi 0.4.x to 0.5.x | |
11 ------------------------------------ | |
12 | |
13 Genshi 0.5 introduces a new, alternative syntax for text templates, | |
14 which is more flexible and powerful compared to the old syntax. For | |
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 | |
24 The default error handling mode has been changed to "strict". This | |
25 means that accessing variables not defined in the template data will | |
26 now generate an immediate exception, as will accessing object | |
27 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 | |
29 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 | |
31 future release. | |
32 | |
33 | |
34 Upgrading from Genshi 0.3.x to 0.4.x | |
35 ------------------------------------ | |
36 | |
37 The modules ``genshi.filters`` and ``genshi.template`` have been | |
38 refactored into packages containing multiple modules. While code using | |
39 the regular APIs should continue to work without problems, you should | |
40 make sure to remove any leftover traces of the files ``filters.py`` | |
41 and ``template.py`` in the ``genshi`` package on the installation | |
42 path (including the corresponding ``.pyc`` files). This is not | |
43 necessary when Genshi was installed as a Python egg. | |
44 | |
45 Results of evaluating template expressions are no longer implicitly | |
46 called if they are callable. If you have been using that feature, you | |
47 will need to add the parenthesis to actually call the function. | |
48 | |
49 Instances of ``genshi.core.Attrs`` are now immutable. Filters | |
50 manipulating the attributes in a stream may need to be updated. Also, | |
51 the ``Attrs`` class no longer automatically wraps all attribute names | |
52 in ``QName`` objects, so users of the ``Attrs`` class need to do this | |
53 themselves. See the documentation of the ``Attrs`` class for more | |
54 information. | |
55 | |
56 | |
57 Upgrading from Markup | |
58 --------------------- | |
59 | |
60 Prior to version 0.3, the name of the Genshi project was "Markup". The | |
61 name change means that you will have to adjust your import statements | |
62 and the namespace URI of XML templates, among other things: | |
63 | |
64 * The package name was changed from "markup" to "genshi". Please | |
65 adjust any import statements referring to the old package name. | |
66 * The namespace URI for directives in Genshi XML templates has changed | |
67 from ``http://markup.edgewall.org/`` to | |
68 ``http://genshi.edgewall.org/``. Please update the ``xmlns:py`` | |
69 declaration in your template files accordingly. | |
70 | |
71 Furthermore, due to the inclusion of a text-based template language, | |
72 the class:: | |
73 | |
74 markup.template.Template | |
75 | |
76 has been renamed to:: | |
77 | |
78 genshi.template.MarkupTemplate | |
79 | |
80 If you've been using the Template class directly, you'll need to | |
81 update your code (a simple find/replace should do—the API itself | |
82 did not change). |