annotate doc/upgrade.txt @ 694:812671b40022

Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
author cmlenz
date Wed, 26 Mar 2008 22:10:36 +0000
parents 9ada030ad986
children a58a50e89d04 109fb7dfe95e
rev   line source
233
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
1 Upgrading Genshi
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
2 ================
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
3
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
4
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
5 .. contents:: Contents
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
6 :depth: 2
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
7 .. sectnum::
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
8
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
9
592
7145e4eba2ec Add a new syntax for text templates, which is available alongside the old syntax for now. The new syntax is more poweful and flexible, using Django-style directive notation.
cmlenz
parents: 452
diff changeset
10 Upgrading from Genshi 0.4.x to 0.5.x
7145e4eba2ec Add a new syntax for text templates, which is available alongside the old syntax for now. The new syntax is more poweful and flexible, using Django-style directive notation.
cmlenz
parents: 452
diff changeset
11 ------------------------------------
7145e4eba2ec Add a new syntax for text templates, which is available alongside the old syntax for now. The new syntax is more poweful and flexible, using Django-style directive notation.
cmlenz
parents: 452
diff changeset
12
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
13 Genshi 0.5 introduces a new, alternative syntax for text templates,
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
14 which is more flexible and powerful compared to the old syntax. For
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
15 backwards compatibility, this new syntax is not used by default,
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
16 though it will be in a future version. It is recommended that you
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
17 migrate to using this new syntax. To do so, simply rename any
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
18 references in your code to ``TextTemplate`` to ``NewTextTemplate``. To
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
19 explicitly use the old syntax, use ``OldTextTemplate`` instead, so
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
20 that you can be sure you'll be using the same language when the
592
7145e4eba2ec Add a new syntax for text templates, which is available alongside the old syntax for now. The new syntax is more poweful and flexible, using Django-style directive notation.
cmlenz
parents: 452
diff changeset
21 default in Genshi is changed (at least until the old implementation is
7145e4eba2ec Add a new syntax for text templates, which is available alongside the old syntax for now. The new syntax is more poweful and flexible, using Django-style directive notation.
cmlenz
parents: 452
diff changeset
22 completely removed).
7145e4eba2ec Add a new syntax for text templates, which is available alongside the old syntax for now. The new syntax is more poweful and flexible, using Django-style directive notation.
cmlenz
parents: 452
diff changeset
23
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
24 The default error handling mode has been changed to "strict". This
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
25 means that accessing variables not defined in the template data will
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
26 now generate an immediate exception, as will accessing object
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
27 attributes or dictionary keys that don't exist. If your templates rely
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
28 on the old lenient behavior, you can configure Genshi to use that
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
29 instead. See the documentation for details on how to do that. But be
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
30 warned that lenient error handling may be removed completely in a
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
31 future release.
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
32
694
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
33 There has also been a subtle change to how ``py:match`` templates are
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
34 processed: in previous versions, all match templates would be applied
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
35 to the content generated by the matching template, and only the
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
36 matching template itself was applied recursively to the original
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
37 content. This behavior resulted in problems with many kinds of
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
38 recursive matching, and hence was changed for 0.5: now, all match
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
39 templates declared before the matching template are applied to the
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
40 original content, and match templates declared after the matching
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
41 template are applied to the generated content. This change should not
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
42 have any effect on most applications, but you may want to check your
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
43 use of match templates to make sure.
812671b40022 Match templates are now applied in a more controlled fashion: in the order they are declared in the template source, all match templates up to (and including) the matching template itself are applied to the matched content, whereas the match templates declared after the matching template are only applied to the generated content. Fixes #186. Many thanks to Matt Chaput for reporting the problem and providing a test case.
cmlenz
parents: 606
diff changeset
44
592
7145e4eba2ec Add a new syntax for text templates, which is available alongside the old syntax for now. The new syntax is more poweful and flexible, using Django-style directive notation.
cmlenz
parents: 452
diff changeset
45
336
5f2c7782cd8a Refactoring: `genshi.template` is now a package, it was getting way to crowded in that file.
cmlenz
parents: 233
diff changeset
46 Upgrading from Genshi 0.3.x to 0.4.x
5f2c7782cd8a Refactoring: `genshi.template` is now a package, it was getting way to crowded in that file.
cmlenz
parents: 233
diff changeset
47 ------------------------------------
5f2c7782cd8a Refactoring: `genshi.template` is now a package, it was getting way to crowded in that file.
cmlenz
parents: 233
diff changeset
48
452
0ed55216e8f2 Add `filters` package in `setup.py`.
cmlenz
parents: 442
diff changeset
49 The modules ``genshi.filters`` and ``genshi.template`` have been
0ed55216e8f2 Add `filters` package in `setup.py`.
cmlenz
parents: 442
diff changeset
50 refactored into packages containing multiple modules. While code using
0ed55216e8f2 Add `filters` package in `setup.py`.
cmlenz
parents: 442
diff changeset
51 the regular APIs should continue to work without problems, you should
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
52 make sure to remove any leftover traces of the files ``filters.py``
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
53 and ``template.py`` in the ``genshi`` package on the installation
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
54 path (including the corresponding ``.pyc`` files). This is not
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
55 necessary when Genshi was installed as a Python egg.
336
5f2c7782cd8a Refactoring: `genshi.template` is now a package, it was getting way to crowded in that file.
cmlenz
parents: 233
diff changeset
56
343
4ff2338e89cd Remove automatic calling of expression evaluation results if they are callable. See [http://groups.google.com/group/genshi/browse_thread/thread/f515986760918d41 this mailing list thread].
cmlenz
parents: 336
diff changeset
57 Results of evaluating template expressions are no longer implicitly
4ff2338e89cd Remove automatic calling of expression evaluation results if they are callable. See [http://groups.google.com/group/genshi/browse_thread/thread/f515986760918d41 this mailing list thread].
cmlenz
parents: 336
diff changeset
58 called if they are callable. If you have been using that feature, you
4ff2338e89cd Remove automatic calling of expression evaluation results if they are callable. See [http://groups.google.com/group/genshi/browse_thread/thread/f515986760918d41 this mailing list thread].
cmlenz
parents: 336
diff changeset
59 will need to add the parenthesis to actually call the function.
4ff2338e89cd Remove automatic calling of expression evaluation results if they are callable. See [http://groups.google.com/group/genshi/browse_thread/thread/f515986760918d41 this mailing list thread].
cmlenz
parents: 336
diff changeset
60
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
61 Instances of ``genshi.core.Attrs`` are now immutable. Filters
411
2f4a525c32d5 Updated change log.
cmlenz
parents: 397
diff changeset
62 manipulating the attributes in a stream may need to be updated. Also,
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
63 the ``Attrs`` class no longer automatically wraps all attribute names
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
64 in ``QName`` objects, so users of the ``Attrs`` class need to do this
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
65 themselves. See the documentation of the ``Attrs`` class for more
411
2f4a525c32d5 Updated change log.
cmlenz
parents: 397
diff changeset
66 information.
2f4a525c32d5 Updated change log.
cmlenz
parents: 397
diff changeset
67
345
8e75b83d3e71 Make `Attrs` instances immutable.
cmlenz
parents: 343
diff changeset
68
233
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
69 Upgrading from Markup
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
70 ---------------------
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
71
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
72 Prior to version 0.3, the name of the Genshi project was "Markup". The
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
73 name change means that you will have to adjust your import statements
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
74 and the namespace URI of XML templates, among other things:
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
75
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
76 * The package name was changed from "markup" to "genshi". Please
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
77 adjust any import statements referring to the old package name.
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
78 * The namespace URI for directives in Genshi XML templates has changed
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
79 from ``http://markup.edgewall.org/`` to
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
80 ``http://genshi.edgewall.org/``. Please update the ``xmlns:py``
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
81 declaration in your template files accordingly.
233
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
82
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
83 Furthermore, due to the inclusion of a text-based template language,
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
84 the class::
233
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
85
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
86 markup.template.Template
233
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
87
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
88 has been renamed to::
233
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
89
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
90 genshi.template.MarkupTemplate
233
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
91
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
92 If you've been using the Template class directly, you'll need to
606
9ada030ad986 Changed the default error handling mode to "strict".
cmlenz
parents: 592
diff changeset
93 update your code (a simple find/replace should do—the API itself
233
7a426ab6407a * Added implementation of a simple text-based template engine. Closes #47.
cmlenz
parents:
diff changeset
94 did not change).
Copyright (C) 2012-2017 Edgewall Software