📄 site_info.py
字号:
#!/usr/bin/env python# -*- coding: utf-8 -*-# Copyright (C) 1994 Ling Li## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU Library General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.import md5, randomfrom UserDict import UserDictrandom.seed()class SiteFolder(UserDict): "SiteFolder is used to organize sites" name = None def __init__(self, name = None): UserDict.__init__(self) self.name = nameclass SiteInfo(UserDict): """SiteInfo is a entity object, it stores information of a site. Currently,the following items can be stored:id: unique idsite_name: Site Nameserver_addr: IP/Address of serverserver_port: Port number of serverusername: username used for loginpassword: password for loginremote_path: the default remote pathlocal_path: the default local pathremote_charset: the default filename charset for remote""" def __init__(self, data = None): UserDict.__init__(self) if data != None: self.data = data else: self.data = {} m = md5.new() m.update(str(random.random())) self.data['id'] = m.hexdigest() self.data['remote_charset'] = 'GBK' return def from_xml_node(self, node): def get_text(nodelist): rc = '' for n in nodelist: if n.nodeType == n.TEXT_NODE: rc = rc + n.data return rc for child_node in node.childNodes: if child_node.nodeType == child_node.TEXT_NODE: continue name = child_node.tagName value = get_text(child_node.childNodes) self.data[name] = value return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -