本文整理汇总了Python中pootle_project.models.Project.ignoredfiles方法的典型用法代码示例。如果您正苦于以下问题:Python Project.ignoredfiles方法的具体用法?Python Project.ignoredfiles怎么用?Python Project.ignoredfiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pootle_project.models.Project
的用法示例。
在下文中一共展示了Project.ignoredfiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: import_projects
# 需要导入模块: from pootle_project.models import Project [as 别名]
# 或者: from pootle_project.models.Project import ignoredfiles [as 别名]
def import_projects(parsed_data):
# This could prompt the user, asking:
# "Want us to import projects? Say no if you have already
# added the projects to the new Pootle DB in the web UI."
data = parsed_data.__root__._assignments # Is this really the right way?
prefix = 'Pootle.projects.'
# Filter out unrelated keys
keys = [key for key in data if key.startswith(prefix)]
# Clean up 'pootle.fullname' into 'pootle'
projs = set([key[len(prefix):].split('.')[0] for key in keys])
en = require_english()
for proj in map(lambda s: unicode(s, 'utf-8'), projs):
# id, for free
# code:
try:
db_proj = Project.objects.get(code=proj)
logging.log(logging.INFO,
'Already found a project named %s.\n'\
'Data for this project are not imported.',
proj)
continue
except Project.DoesNotExist:
db_proj = Project(code=proj, source_language=en)
# fullname
db_proj.fullname = _get_attribute(data, proj, 'fullname', prefix=prefix)
# description
db_proj.description = _get_attribute(data, proj, 'description',
prefix=prefix)
# checkstyle
db_proj.checkstyle = _get_attribute(data, proj, 'checkerstyle',
unicode_me = False, prefix=prefix)
# localfiletype
db_proj.localfiletype = _get_attribute(data, proj, 'localfiletype',
default='po', prefix=prefix)
# treestyle
db_proj.treestyle = _get_attribute(data, proj, 'treestyle',
unicode_me = False, default='auto', prefix=prefix)
# ignoredfiles
db_proj.ignoredfiles = _get_attribute(data, proj, 'ignoredfiles',
default=u'', prefix=prefix)
logging.info("Creating project %s", db_proj)
db_proj.save()