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


Python Note.uuid方法代码示例

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


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

示例1: _import

# 需要导入模块: from note import Note [as 别名]
# 或者: from note.Note import uuid [as 别名]
    def _import(self):
        self.noteList = {}
        for infile in glob.glob(os.path.join(os.path.expanduser("~/.conboy"), "*.note")):
            try:
                parser = xml.sax.make_parser()
                handler = textHandler()
                parser.setContentHandler(handler)
                parser.parse(infile)
            except Exception:
                import traceback

                print traceback.format_exc()

            try:
                note = Note()
                uuid = handler._content.split("\n", 1)[0].strip(" \t\r\n")
                uuid = getValidFilename(uuid)
                path = os.path.join(note.NOTESPATH, uuid)
                if os.path.exists(path + ".txt"):
                    index = 2
                    while os.path.exists(os.path.join(note.NOTESPATH, "%s %s.txt" % (path, unicode(index)))):
                        index = index + 1
                    uuid = "%s %s" % (os.path.basename(path), unicode(index))

                note.uuid = uuid + ".txt"
                note.write(handler._content)
                try:
                    from rfc3339.rfc3339 import strtotimestamp

                    mtime = strtotimestamp(handler._last_change)
                    lpath = os.path.join(Note.NOTESPATH, note.uuid)
                    os.utime(lpath, (-1, mtime))
                except Exception:
                    import traceback

                    print traceback.format_exc()

            except Exception:
                import traceback

                print traceback.format_exc()

        self._set_running(False)
        self.on_finished.emit()
开发者ID:harmattan,项目名称:KhtNotes,代码行数:46,代码来源:importer.py

示例2: _import

# 需要导入模块: from note import Note [as 别名]
# 或者: from note.Note import uuid [as 别名]
    def _import(self):
        self.noteList = {}
        for infile in glob.glob( \
            os.path.join(os.path.expanduser('~/.conboy'), '*.note')):
            try:
                parser = xml.sax.make_parser()
                handler = textHandler()
                parser.setContentHandler(handler)
                parser.parse(infile)
            except Exception, err:
                import traceback
                print traceback.format_exc()

            try:
                note = Note()
                uuid = handler._content.split('\n', 1)[0].strip(' \t\r\n')
                uuid = getValidFilename(uuid)
                path = os.path.join(note.NOTESPATH, uuid)
                if os.path.exists(path + '.txt'):
                    index = 2
                    while (os.path.exists(os.path.join( \
                            note.NOTESPATH,'%s %s.txt' \
                            % (path, \
                            unicode(index))))):
                        index = index + 1
                    uuid = ('%s %s' \
                            % (os.path.basename(path), \
                            unicode(index)))

                note.uuid = uuid + '.txt'
                note.write(handler._content)
                try:
                    from rfc3339.rfc3339 import strtotimestamp
                    mtime = strtotimestamp(handler._last_change)
                    lpath = os.path.join(Note.NOTESPATH, note.uuid)
                    os.utime(lpath, (-1, mtime))
                except Exception, err:
                    import traceback
                    print traceback.format_exc()

            except Exception, err:
                import traceback
                print traceback.format_exc()
开发者ID:jul,项目名称:KhtNotes,代码行数:45,代码来源:importer.py


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