当前位置: 首页>>代码示例>>Python>>正文


Python LocalFile.setId方法代码示例

本文整理汇总了Python中MaKaC.conference.LocalFile.setId方法的典型用法代码示例。如果您正苦于以下问题:Python LocalFile.setId方法的具体用法?Python LocalFile.setId怎么用?Python LocalFile.setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MaKaC.conference.LocalFile的用法示例。


在下文中一共展示了LocalFile.setId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: archiveTempBackgrounds

# 需要导入模块: from MaKaC.conference import LocalFile [as 别名]
# 或者: from MaKaC.conference.LocalFile import setId [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 = {}
开发者ID:Ictp,项目名称:indico,代码行数:32,代码来源:badge.py

示例2: uploadProcess

# 需要导入模块: from MaKaC.conference import LocalFile [as 别名]
# 或者: from MaKaC.conference.LocalFile import setId [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")
开发者ID:aninhalacerda,项目名称:indico,代码行数:22,代码来源:handlers.py

示例3: uploadProcess

# 需要导入模块: from MaKaC.conference import LocalFile [as 别名]
# 或者: from MaKaC.conference.LocalFile import setId [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")
开发者ID:ferhatelmas,项目名称:indico,代码行数:24,代码来源:handlers.py


注:本文中的MaKaC.conference.LocalFile.setId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。