本文整理汇总了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)