Changeset 14138
- Timestamp:
- 03/16/12 11:51:05 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sara_cmt/sara_cmt/cluster/templatetags/cmts_extras.py
r14137 r14138 178 178 if len(definition) == 4: 179 179 180 #RB: OLDSTYLE 180 181 #RB: 4 arguments means: {% store /path/filename as output %} 181 182 #RB: old style: DONT try to resolve variable … … 184 185 path_str = "'%s'" %path_arg 185 186 187 # RB: parse the entire template for old-style 188 nodelist = parser.parse() 189 190 # RB: set backwards compatibility for StoreOutput 191 bw_compat = True 192 186 193 else: 187 194 #RB: NEWSTYLE 188 195 #RB: 2 arguments can mean: {% store 'string' %} 189 196 #RB: 2 arguments can mean: {% store variable %} … … 191 198 path_str = path_arg 192 199 193 # RB: parse the template thing until %endstore found 194 nodelist = parser.parse(('endstore',)) 195 parser.delete_first_token() 200 # RB: parse the template thing until %endstore found 201 nodelist = parser.parse(('endstore',)) 202 # RB: throw away %endstore tag 203 parser.delete_first_token() 204 205 # RB: no backwards compatibility for StoreOutput 206 bw_compat = False 196 207 197 208 # RB: Now lets start writing output files 198 return generateStoreOutput(tag, path_str, nodelist )209 return generateStoreOutput(tag, path_str, nodelist, bw_compat) 199 210 200 211 class generateStoreOutput(template.Node): 201 212 202 def __init__(self, tag, path_str, nodelist ):213 def __init__(self, tag, path_str, nodelist, bw_compat=False): 203 214 self.tag = tag 204 215 self.nodelist = nodelist 205 216 self.path_str = path_str 217 self.bw_compat = bw_compat 206 218 207 219 def render(self, context): … … 219 231 #raise template.TemplateSyntaxError, '%r tag argument 1: not a variable %r' %( tag, path_str ) 220 232 pass 233 234 if self.bw_compat: 235 # RB: store 'output' variable filename for BW compat 236 237 context[ 'output' ] = mypath_str 221 238 222 239 # RB: render template between store tags
Note: See TracChangeset
for help on using the changeset viewer.