Adds the template to the self.templates of dictionaries. There is no check, so the calling function can overwrite existing templates. Answer the template. >>> name ='TestTemplate' >>> t = Template(w=200, h=300, name=name) >>> doc = Document(name='TestDoc')
(self, name, template)
| 344 | return self.templates.get(name, self.defaultTemplate) |
| 345 | |
| 346 | def addTemplate(self, name, template): |
| 347 | """Adds the template to the self.templates of dictionaries. There is no |
| 348 | check, so the calling function can overwrite existing templates. Answer the |
| 349 | template. |
| 350 | |
| 351 | >>> name ='TestTemplate' |
| 352 | >>> t = Template(w=200, h=300, name=name) |
| 353 | >>> doc = Document(name='TestDoc') |
| 354 | >>> doc.addTemplate('myTemplate', t) |
| 355 | <Template> |
| 356 | >>> doc.getTemplate('myTemplate').name == name |
| 357 | True |
| 358 | """ |
| 359 | template.parent = self |
| 360 | self.templates[name] = template |
| 361 | return template |
| 362 | |
| 363 | def _get_defaultTemplate(self): |
| 364 | """Answers the default template of the document. |
no outgoing calls
no test coverage detected