Changeset 14139
- Timestamp:
- 03/16/12 11:58:38 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sara_cmt/sara_cmt/cluster/templatetags/cmts_extras.py
r14138 r14139 173 173 tag = definition[0] 174 174 path_arg = definition[1] 175 #kw_as = definition[2]176 #kw_output = definition[3]177 175 178 176 if len(definition) == 4: 179 177 180 #RB: OLDSTYLE178 #RB: OLDSTYLE 181 179 #RB: 4 arguments means: {% store /path/filename as output %} 182 180 #RB: old style: DONT try to resolve variable 183 181 #RB: instead convert filename to quoted string 184 182 183 kw_as = definition[2] 184 kw_output_name = definition[3] 185 185 186 path_str = "'%s'" %path_arg 186 187 … … 188 189 nodelist = parser.parse() 189 190 190 # RB: set backwards compatibility for StoreOutput191 bw_compat = True192 193 191 else: 194 #RB: NEWSTYLE192 #RB: NEWSTYLE 195 193 #RB: 2 arguments can mean: {% store 'string' %} 196 194 #RB: 2 arguments can mean: {% store variable %} 195 196 kw_output_name = None 197 197 198 198 path_str = path_arg … … 203 203 parser.delete_first_token() 204 204 205 # RB: no backwards compatibility for StoreOutput206 bw_compat = False207 208 205 # RB: Now lets start writing output files 209 return generateStoreOutput(tag, path_str, nodelist, bw_compat)206 return generateStoreOutput(tag, path_str, nodelist, kw_output_name) 210 207 211 208 class generateStoreOutput(template.Node): 212 209 213 def __init__(self, tag, path_str, nodelist, bw_compat=False):210 def __init__(self, tag, path_str, nodelist, kw_output_name=None): 214 211 self.tag = tag 215 212 self.nodelist = nodelist 216 213 self.path_str = path_str 217 self. bw_compat = bw_compat214 self.kw_output_name = kw_output_name 218 215 219 216 def render(self, context): … … 232 229 pass 233 230 234 if self. bw_compat:231 if self.kw_output_name: 235 232 # RB: store 'output' variable filename for BW compat 236 233 237 context[ 'output'] = mypath_str234 context[ self.kw_output_name ] = mypath_str 238 235 239 236 # RB: render template between store tags
Note: See TracChangeset
for help on using the changeset viewer.