本文整理匯總了Python中allura.lib.plugin.ProjectRegistrationProvider.get方法的典型用法代碼示例。如果您正苦於以下問題:Python ProjectRegistrationProvider.get方法的具體用法?Python ProjectRegistrationProvider.get怎麽用?Python ProjectRegistrationProvider.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類allura.lib.plugin.ProjectRegistrationProvider
的用法示例。
在下文中一共展示了ProjectRegistrationProvider.get方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: execute
# 需要導入模塊: from allura.lib.plugin import ProjectRegistrationProvider [as 別名]
# 或者: from allura.lib.plugin.ProjectRegistrationProvider import get [as 別名]
def execute(cls, options):
provider = ProjectRegistrationProvider.get()
for proj in options.projects:
proj = cls.get_project(proj)
if proj:
log.info('Purging %s%s. Reason: %s', proj.neighborhood.url_prefix, proj.shortname, options.reason)
provider.purge_project(proj, disable_users=options.disable_users, reason=options.reason)
示例2: search_projects
# 需要導入模塊: from allura.lib.plugin import ProjectRegistrationProvider [as 別名]
# 或者: from allura.lib.plugin.ProjectRegistrationProvider import get [as 別名]
def search_projects(self, q=None, f=None, page=0, limit=None, **kw):
fields = [('shortname', 'shortname'), ('name', 'full name')]
add_fields = aslist(tg.config.get('search.project.additional_search_fields'), ',')
r = self._search(M.Project, fields, add_fields, q, f, page, limit, **kw)
r['search_results_template'] = 'allura:templates/site_admin_search_projects_results.html'
r['additional_display_fields'] = \
aslist(tg.config.get('search.project.additional_display_fields'), ',')
r['provider'] = ProjectRegistrationProvider.get()
return r
示例3: parse_projects
# 需要導入模塊: from allura.lib.plugin import ProjectRegistrationProvider [as 別名]
# 或者: from allura.lib.plugin.ProjectRegistrationProvider import get [as 別名]
def parse_projects(self, projects):
"""Takes projects from user input and returns a list of tuples (input, project, error)"""
provider = ProjectRegistrationProvider.get()
projects = projects.splitlines()
projects = self.remove_comments(projects)
parsed_projects = []
for input in projects:
if input.strip():
p, error = provider.project_from_url(input.strip())
parsed_projects.append((input, p, error))
return parsed_projects
示例4: execute
# 需要導入模塊: from allura.lib.plugin import ProjectRegistrationProvider [as 別名]
# 或者: from allura.lib.plugin.ProjectRegistrationProvider import get [as 別名]
def execute(cls, options):
provider = ProjectRegistrationProvider.get()
auth_provider = AuthenticationProvider.get(Request.blank('/'))
for proj in options.projects:
proj = cls.get_project(proj)
if proj:
if proj.is_user_project:
# disable user as well
user = proj.user_project_of
if user:
auth_provider.disable_user(user, audit=False)
msg = u'Account disabled because user-project was specified for deletion. Reason: {}'.format(
options.reason)
log_entry = h.auditlog_user(msg, user=user)
session(log_entry).flush(log_entry)
else:
log.info('Could not find associated user for user-project %s', proj.shortname)
log.info('Purging %s Reason: %s', proj.url(), options.reason)
provider.purge_project(proj, disable_users=options.disable_users, reason=options.reason)
示例5: __init__
# 需要導入模塊: from allura.lib.plugin import ProjectRegistrationProvider [as 別名]
# 或者: from allura.lib.plugin.ProjectRegistrationProvider import get [as 別名]
def __init__(self, source):
super(ProjectImportForm, self).__init__()
provider = ProjectRegistrationProvider.get()
self.add_field('tools', ToolsValidator(source))
self.add_field('project_shortname', provider.shortname_validator)
self.allow_extra_fields = True
示例6: deserialize
# 需要導入模塊: from allura.lib.plugin import ProjectRegistrationProvider [as 別名]
# 或者: from allura.lib.plugin.ProjectRegistrationProvider import get [as 別名]
def deserialize(self, node, cstruct):
if cstruct is col.null:
return col.null
return ProjectRegistrationProvider.get().shortname_validator.to_python(cstruct,
check_allowed=not self.update,
neighborhood=self.nbhd)