本文整理汇总了Python中rapuma.core.tools.Tools.getProjIdList方法的典型用法代码示例。如果您正苦于以下问题:Python Tools.getProjIdList方法的具体用法?Python Tools.getProjIdList怎么用?Python Tools.getProjIdList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rapuma.core.tools.Tools
的用法示例。
在下文中一共展示了Tools.getProjIdList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProjData
# 需要导入模块: from rapuma.core.tools import Tools [as 别名]
# 或者: from rapuma.core.tools.Tools import getProjIdList [as 别名]
class ProjData (object) :
def __init__(self, pid, gid = None) :
'''Intitate the whole class and create the object.'''
self.pid = pid
self.gid = gid
self.tools = Tools()
self.user = UserConfig()
self.userConfig = self.user.userConfig
self.local = ProjLocal(pid)
self.log = ProjLog(pid)
self.projHome = os.path.join(os.path.expanduser(self.userConfig['Resources']['projects']), self.pid)
self.projList = self.tools.getProjIdList(os.path.expanduser(self.userConfig['Resources']['projects']))
# Log messages for this module
self.errorCodes = {
'1220' : ['LOG', 'Project [<<1>>] already registered in the system.'],
'1240' : ['ERR', 'Could not find/open the Project configuration file for [<<1>>]. Project could not be registered!'],
'3410' : ['LOG', 'Backup file cull skipping: [<<1>>] Not a recognized Rapuma backup file name format.'],
'3510' : ['ERR', 'The path (or name) given is not valid: [<<1>>].'],
'3530' : ['MSG', 'Project backup: [<<1>>] has been restored to: [<<2>>]. A backup of the orginal project remains and must be manually removed.'],
'3550' : ['ERR', 'Project backup version request: [<<1>>] exceeds the maxium number which could be in storage which is: [<<2>>]. Request an earlier (lesser) version.'],
'3610' : ['ERR', 'The [<<1>>]. project is not registered. No backup was done.'],
'3620' : ['ERR', 'The path to the backup folder is not valid [<<1>>]. Please try again.'],
'3622' : ['ERR', 'The path to the backup folder is not set. Please set it and try again.'],
'3625' : ['ERR', 'The path given to the backup folder is not valid [<<1>>]. Please set the system backup path.'],
'3630' : ['MSG', 'Backup for [<<1>>] created and saved to: [<<2>>]'],
'4110' : ['MSG', 'Completed merging data.'],
'4120' : ['MSG', 'No files updated.'],
'4130' : ['MSG', 'Added: <<1>> file(s).'],
'4140' : ['MSG', 'Updated: <<1>> file(s)'],
'4150' : ['WRN', 'The project data in: [<<1>>] will be replaced with the data from: [<<2>>].'],
'4210' : ['MSG', 'Completed pulling/restoring data from the cloud.'],
'4220' : ['ERR', 'Cannot resolve path: [<<1>>]'],
'4250' : ['ERR', 'The cloud project [<<1>>] you want to pull from is owned by [<<2>>]. Use force (-f) to pull the project and change the local owner ID.'],
'4260' : ['ERR', 'The local project [<<1>>] is newer than the cloud copy. If you seriously want to overwrite it, use force (-f) to do so.'],
'4270' : ['MSG', 'Restored the project [<<1>>] from the cloud copy. Local copy is owned by [<<2>>].'],
}
###############################################################################
############################## General Functions ##############################
###############################################################################
####################### Error Code Block Series = 1000 ########################
###############################################################################
###############################################################################
########################## Archive Project Functions ##########################
###############################################################################
####################### Error Code Block Series = 2000 ########################
###############################################################################
def makeExcludeFileList (self, source) :
'''Return a list of files that are not necessary to be included in a backup
template or an archive. These will be all auto-generated files that containe system-
specific paths, etc.'''
excludeFiles = []
excludeTypes = ['delayed', 'log', 'notepages', 'parlocs', 'pdf', 'tex', 'piclist', 'adj', 'zip']
excludeFolders = ['Draft', 'Final', 'HelperScript', 'Proof']
# Process the excluded folders
for root, dirs, files in os.walk(source) :
for fileName in files :
if os.path.basename(root) in excludeFolders :
excludeFiles.append(os.path.join(root, fileName))
else :
# Get rid of edited backup files
if fileName[-1] == '~' :
excludeFiles.append(os.path.join(root, fileName))
continue
ext = os.path.splitext(fileName)[1][1:]
if ext in excludeTypes :
# A special indicator for file we want to keep
if fileName.find('-ext.') > 0 :
continue
return excludeFiles
# FIXME: Should archiveProject() use self.pid instead of explicitly passing in a pid?
def archiveProject (self, pid, path = None) :
'''Archive a project. Send the compressed archive file to the user-specified
archive folder. If none is specified, put the archive in cwd. If a valid
path is specified, send it to that location. Like backup, this too will
overwrite any existing file of the same name. The difference is that this
will also disable the project so it cannot be accesses by Rapuma. When a
project is archived, all work should cease on the project.'''
# Make a private project object just for archiving
aProject = Project(pid, self.gid)
# Set some paths and file names
archName = aProject.projectIDCode + '.rapuma'
#.........这里部分代码省略.........