Example #1
0
    def updateAccountInfo(self, account):
        """ Update account settings from :class:`AccountInfo` """
        inst = self.core.accountManager.getAccount(account.plugin, account.loginname, self.user)
        if not account:
            return

        inst.activated = to_bool(account.activated)
        inst.shared = to_bool(account.shared)
        inst.updateConfig(account.config)
Example #2
0
    def updateAccountInfo(self, account):
        """ Update account settings from :class:`AccountInfo` """
        inst = self.core.accountManager.getAccount(account.aid, account.plugin,
                                                   self.user)
        if not inst:
            return

        inst.activated = to_bool(account.activated)
        inst.shared = to_bool(account.shared)
        inst.updateConfig(account.config)
Example #3
0
    def __init__(self, manager, loginname, password, options):
        Base.__init__(self, manager.core)

        if "activated" in options:
            self.activated = to_bool(options["activated"])
        else:
            self.activated = Account.activated

        for opt in self.known_opt:
            if opt not in options:
                options[opt] = ""

        for opt in options.keys():
            if opt not in self.known_opt:
                del options[opt]

        self.loginname = loginname
        self.options = options

        self.manager = manager

        self.lock = RLock()
        self.timestamp = 0
        self.login_ts = 0 # timestamp for login
        self.cj = CookieJar()
        self.password = password
        self.error = None

        self.init()
Example #4
0
def from_string(value, typ=None):
    """ cast value to given type, unicode for strings """

    # value is no string
    if not isinstance(value, basestring):
        return value

    value = decode(value)

    if typ == InputType.Int:
        return int(value)
    elif typ == InputType.Bool:
        return to_bool(value)
    elif typ == InputType.Time:
        if not value: value = "0:00"
        if not ":" in value: value += ":00"
        return value
    else:
        return value
Example #5
0
def from_string(value, typ=None):
    """ cast value to given type, unicode for strings """

    # value is no string
    if not isinstance(value, basestring):
        return value

    value = decode(value)

    if typ == InputType.Int:
        return int(value)
    elif typ == InputType.Bool:
        return to_bool(value)
    elif typ == InputType.Time:
        if not value: value = "0:00"
        if not ":" in value: value += ":00"
        return value
    else:
        return value