本文整理汇总了Python中MaKaC.conference.LocalFile.archive方法的典型用法代码示例。如果您正苦于以下问题:Python LocalFile.archive方法的具体用法?Python LocalFile.archive怎么用?Python LocalFile.archive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.conference.LocalFile
的用法示例。
在下文中一共展示了LocalFile.archive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: archiveTempBackgrounds
# 需要导入模块: from MaKaC.conference import LocalFile [as 别名]
# 或者: from MaKaC.conference.LocalFile import archive [as 别名]
def archiveTempBackgrounds(self, conf):
""" Archives all the temporary backgrounds of this template.
This method archives all of the temporary backgrounds of this template, which are
stored in the form of filepath strings, in the __tempBackgroundsFilePaths dictionary,
to a dictionary which stores LocalFile objects. The ids are copied, since there is a
shared id counter for both dictionaries.
After the archiving, the __tempBackgroundsFilePaths dictionary is reset to {}
"""
for backgroundId, filePath in self.__tempBackgroundsFilePaths.iteritems():
cfg = Config.getInstance()
tempPath = cfg.getUploadedFilesSharedTempDir()
filePath = os.path.join(tempPath, filePath)
fileName = "background" + str(backgroundId) + "_t" + self.__id + "_c" + conf.id
from MaKaC.conference import LocalFile
file = LocalFile()
file.setName( fileName )
file.setDescription( "Background " + str(backgroundId) + " of the template " + self.__id + " of the conference " + conf.id )
file.setFileName( fileName )
file.setFilePath( filePath )
file.setOwner( conf )
file.setId( fileName )
file.archive( conf._getRepository() )
self.__backgrounds[backgroundId] = file
self.notifyModification()
self.__tempBackgroundsFilePaths = {}
示例2: uploadProcess
# 需要导入模块: from MaKaC.conference import LocalFile [as 别名]
# 或者: from MaKaC.conference.LocalFile import archive [as 别名]
def uploadProcess(self):
# We save the file
try:
f = LocalFile()
f.setFileName("EAForm-%s"%self.spkUniqueId)
f.setFilePath(self.filePath)
f.setId(self.spkUniqueId)
# Update status for speaker wrapper
manager = self._conf.getCSBookingManager()
spkWrapper = manager.getSpeakerWrapperByUniqueId(self.spkUniqueId)
repo = self._conf._getRepository()
f.setOwner(spkWrapper)
f.archive(repo)
# if no error, update the speaker wrapper...
spkWrapper.setStatus(SpeakerStatusEnum.FROMFILE) #change status
spkWrapper.setLocalFile(f) # set path to file
spkWrapper.triggerNotification() # trigger notification task
except:
raise MaKaCError("Unexpected error while uploading file")
示例3: uploadProcess
# 需要导入模块: from MaKaC.conference import LocalFile [as 别名]
# 或者: from MaKaC.conference.LocalFile import archive [as 别名]
def uploadProcess(self):
# We save the file
try:
f = LocalFile()
__, extension = os.path.splitext(self.file.filename)
f.setFileName("EAForm-{0}{1}".format(self.spkUniqueId, extension))
f.setFilePath(self.filePath)
f.setId(self.spkUniqueId)
# Update status for speaker wrapper
manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId())
spkWrapper = manager.getSpeakerWrapperByUniqueId(self.spkUniqueId)
repo = self._conf._getRepository()
f.setOwner(spkWrapper)
f.archive(repo)
# if no error, update the speaker wrapper...
spkWrapper.setStatus(SpeakerStatusEnum.FROMFILE) #change status
spkWrapper.setLocalFile(f) # set path to file
spkWrapper.triggerNotification() # trigger notification task
except:
Logger.get('file_upload').exception("Error uploading file")
raise MaKaCError("Unexpected error while uploading file")