comparison piecrust/app.py @ 1182:31e8ee0bf5b2

prepare: Refactor scaffolding code.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 21 May 2020 22:08:23 -0700
parents c4cf3cfe2726
children
comparison
equal deleted inserted replaced
1177:e307f61d7034 1182:31e8ee0bf5b2
222 for pub in self.publishers: 222 for pub in self.publishers:
223 if pub.target == target_name: 223 if pub.target == target_name:
224 return pub 224 return pub
225 return None 225 return None
226 226
227 def getCommand(self, command_name):
228 for cmd in self.plugin_loader.getCommands():
229 if cmd.name == command_name:
230 return cmd
231 return None
232
233 def getCommandExtensions(self, command_name, supported_only=True):
234 extensions = self.plugin_loader.getCommandExtensions()
235 for e in extensions:
236 if (e.command_name == command_name and
237 (not supported_only or e.supports(self))):
238 yield e
239
227 def getPage(self, source, content_item): 240 def getPage(self, source, content_item):
228 cache_key = '%s@%s' % (source.name, content_item.spec) 241 cache_key = '%s@%s' % (source.name, content_item.spec)
229 return self.env.page_repository.get( 242 return self.env.page_repository.get(
230 cache_key, 243 cache_key,
231 lambda: Page(source, content_item)) 244 lambda: Page(source, content_item))