Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.
Ticket #2415: 02-reload-templates-fix.patch
| File 02-reload-templates-fix.patch,
2.2 KB
(added by xaka, 2 years ago) |
|
|
-
|
old
|
new
|
|
| 121 | 121 | ttime = mtime |
| 122 | 122 | # Check the status of all base moduls. |
| 123 | 123 | for module in _get_extended_modules(tclass): |
| 124 | | mtime = stat(sys.modules[module].__file__).st_mtime |
| | 124 | # In some situations module will not exist in |
| | 125 | # sys.modules dict and we should correctly handle |
| | 126 | # this situation to prevent from KeyError exception |
| | 127 | # raising. |
| | 128 | # Load mtime of base module from cache |
| | 129 | # in this situation |
| | 130 | try: |
| | 131 | mtime = stat(sys.modules[module].__file__).st_mtime |
| | 132 | except KeyError: |
| | 133 | mtime = ct[module] |
| | 134 | |
| 125 | 135 | if mtime > ct[module]: |
| 126 | 136 | # base template has changed |
| 127 | 137 | del sys.modules[module] |
| 128 | 138 | ct[module] = mtime |
| 129 | 139 | reload_template = True |
| | 140 | |
| 130 | 141 | if mtime > ttime: |
| 131 | 142 | # base module has changed |
| 132 | 143 | reload_template = True |
| … |
… |
|
| 152 | 163 | ttime = stat(sys.modules[classname].__file__).st_mtime |
| 153 | 164 | for module in _get_extended_modules(tclass): |
| 154 | 165 | mtime = stat(sys.modules[module].__file__).st_mtime |
| 155 | | ct[module] = mtime |
| | 166 | |
| | 167 | # we must use setdefault instead of ct[module] = mtime |
| | 168 | # to prevent from modification already calculated max |
| | 169 | # mtimes for loaded base templates |
| | 170 | ct.setdefault(module, mtime) |
| | 171 | |
| 156 | 172 | if mtime > ttime: |
| 157 | 173 | ttime = mtime |
| 158 | 174 | # Store max of mtimes of template and all of its bases. |
Download in other formats: