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


Python rhnLib.rfc822time函数代码示例

本文整理汇总了Python中spacewalk.common.rhnLib.rfc822time函数的典型用法代码示例。如果您正苦于以下问题:Python rfc822time函数的具体用法?Python rfc822time怎么用?Python rfc822time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _fileFeatures

    def _fileFeatures(filePath):
        """ From a filepath, construct a dictionary of file features. """
        # pylint: disable=W0702
        log_debug(3, filePath)
        if not filePath:
            raise rhnFault(17, "While looking for file: `%s'"
                           % os.path.basename(filePath))
        try:
            s = os.stat(filePath)
        except:
            s = None
        if not s:
            l = 0
            lastModified = 0
        else:
            l = s[stat.ST_SIZE]
            lastModified = s[stat.ST_MTIME]
        del s

        # Build the result hash
        result = {}
        result['name'] = os.path.basename(filePath)
        result['length'] = l
        result['path'] = filePath
        if lastModified:
            result['lastModified'] = rfc822time(lastModified)
        else:
            result['lastModified'] = None
        return result
开发者ID:hlawatschek,项目名称:spacewalk,代码行数:29,代码来源:rhnRepository.py

示例2: test_rfc822time_japan_locale

 def test_rfc822time_japan_locale(self):
     "rfc822time: Test result in ja_JP locale."
     test_arg = 1138371125
     target = "Fri, 27 Jan 2006 14:12:05 GMT"
     old_locale = locale.getlocale(locale.LC_TIME)
     locale.setlocale(locale.LC_TIME, 'ja_JP')
     result = rhnLib.rfc822time(test_arg)
     locale.setlocale(locale.LC_TIME, old_locale)
     self.assertEqual(result, target, result + " != " + target)
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:9,代码来源:test_rhnLib.py

示例3: _set_last_modified

 def _set_last_modified(last_modified, extra_headers=None):
     log_debug(4, last_modified)
     if not last_modified:
         return None
     # Set a field with the name of the header
     transport = rhnFlags.get('outputTransportOptions')
     if last_modified:
         # Put the last-modified info too
         if isinstance(last_modified, (usix.IntType, usix.FloatType)):
             last_modified = rfc822time(last_modified)
         transport['Last-Modified'] = last_modified
     if extra_headers:
         for k, v in extra_headers.items():
             transport[str(k)] = str(v)
     return transport
开发者ID:hlawatschek,项目名称:spacewalk,代码行数:15,代码来源:rhnRepository.py

示例4: getObsoletes

    def getObsoletes(self, version):
        """ Returns a list of packages that obsolete other packages """
        log_debug(3, self.channelName, version)
        # Check to see if the version they are requesting is the latest

        # check the validity of what the client thinks about this channel
        # or blow up
        self.__check_channel(version)

        obsoletes = rhnChannel.list_obsoletes(self.channelName)

        # Set the transport options
        transportOptions = rhnFlags.get('outputTransportOptions')
        transportOptions['Last-Modified'] = rfc822time(timestamp(version))
        rhnFlags.set("compress_response", 1)
        return obsoletes
开发者ID:TJM,项目名称:spacewalk,代码行数:16,代码来源:rhnRepository.py

示例5: listAllPackagesComplete

    def listAllPackagesComplete(self, version):
        """ Creates and/or serves up a cached copy of all the packages for
        this channel including requires, obsoletes, conflicts, etc.
        """
        log_debug(3, self.channelName, version)
        # Check to see if the version they are requesting is the latest

        # check the validity of what the client thinks about this channel
        # or blow up
        self.__check_channel(version)

        packages = rhnChannel.list_all_packages_complete(self.channelName)

        # transport options...
        transportOptions = rhnFlags.get('outputTransportOptions')
        transportOptions['Last-Modified'] = rfc822time(timestamp(version))
        rhnFlags.set("compress_response", 1)
        return packages
开发者ID:TJM,项目名称:spacewalk,代码行数:18,代码来源:rhnRepository.py

示例6: test_rfc822time_normal_float_arg

 def test_rfc822time_normal_float_arg(self):
     "rfc822time: Simple call using a valid float argument."
     test_arg = 1138371125
     target = "Fri, 27 Jan 2006 14:12:05 GMT"
     result = rhnLib.rfc822time(test_arg)
     self.assertEqual(result, target, result + " != " + target)
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:6,代码来源:test_rhnLib.py

示例7: test_rfc822time_normal_list_arg

 def test_rfc822time_normal_list_arg(self):
     "rfc822time: Simple call using a valid list argument."
     test_arg = [2006, 1, 27, 9, 12, 5, 4, 27, -1]
     target = "Fri, 27 Jan 2006 14:12:05 GMT"
     result = rhnLib.rfc822time(test_arg)
     self.assertEqual(result, target, result + " != " + target)
开发者ID:bjmingyang,项目名称:spacewalk,代码行数:6,代码来源:test_rhnLib.py

示例8: test_rfc822time_normal_tuple

 def test_rfc822time_normal_tuple(self):
     "rfc822time: Simple call using a valid tuple argument."
     test_arg = (2006, 1, 27, (14 - TIMEZONE_SHIFT), 12, 5, 4, 27, -1)
     target = "Fri, 27 Jan 2006 14:12:05 GMT"
     result = rhnLib.rfc822time(test_arg)
     self.assertEqual(result, target, result + " != " + target)
开发者ID:BlackSmith,项目名称:spacewalk,代码行数:6,代码来源:test_rhnLib.py


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