Esempio n. 1
0
    def __init__(self, data):
        self.field_map = {}
        if "sync_profile" in data:
            sync_profile = data.pop("sync_profile")
            sync_profile = unserialize(sync_profile)
            self.sync_profile = sync_profile

        self.profile = data
        self.id = str(data["id"])
        self.db_config = {
            'default': {
                "table_prefix": self.sync_profile["mysql_prefix"],
                "db": self.sync_profile["mysql_dbname"],
                'user': self.sync_profile["mysql_username"],
                "passwd": self.sync_profile["mysql_password"],
                "host": self.sync_profile["mysql_server"]
            }
        }

        if self.sync_profile["staticUrl"]:
            self.staticUrl = self.sync_profile["staticUrl"]

        #静态上传类型 none, ftp, aliyun
        self.static_type = self.sync_profile["staticType"]

        if self.static_type == "aliyun":
            self.static_type = "qbox"

        self.upload_handler = None
Esempio n. 2
0
    def __init__(self, data):
	self.field_map = {}
	if "sync_profile" in data:
	    sync_profile = data.pop("sync_profile")
	    sync_profile = unserialize(sync_profile)
	    self.sync_profile = sync_profile

	self.profile = data
	self.id = str(data["id"])
	self.db_config = {
	    'default' : {
		"table_prefix" : self.sync_profile["mysql_prefix"],
		"db" : self.sync_profile["mysql_dbname"],
		'user' : self.sync_profile["mysql_username"],
		"passwd" : self.sync_profile["mysql_password"],
		"host" : self.sync_profile["mysql_server"]
	    }	    
	}

	if self.sync_profile["staticUrl"]:
	    self.staticUrl = self.sync_profile["staticUrl"]

	#静态上传类型 none, ftp, aliyun
	self.static_type = self.sync_profile["staticType"]

	if self.static_type == "aliyun":
	    self.static_type = "qbox"

	self.upload_handler = None
Esempio n. 3
0
    def __init__(self, rule, seed):
	if not rule:
	    raise RuleEmpty

	self.seed = seed;

	'''
	extrarules 额外规则表
	这些额外的规则是动态的, 每个都有一个field id
	'''
	field_db = Seed_fields()
	r = field_db.list(seed["sid"])
	if len(r) > 0:
	    self.extrarules = r.list();
	
        rule = rule.encode("utf-8");
        rule = unserialize(rule, decode_strings=True)
	self.rule = rule;