本文整理汇总了Python中point.core.user.User.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python User.__init__方法的具体用法?Python User.__init__怎么用?Python User.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类point.core.user.User
的用法示例。
在下文中一共展示了User.__init__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from point.core.user import User [as 别名]
# 或者: from point.core.user.User import __init__ [as 别名]
def __init__(self, field=None, value=None):
if isinstance(field, (int, long)):
User.__init__(self, field)
return
if field and value:
User.__init__(self, field, value)
return
sess = Session()
self.id = sess['id']
self.login = sess['login']
self.type = 'user'
self.accounts = []
self.accounts_add = []
self.accounts_del = []
self.profile = {}
self.profile_upd = {}
self.info = {}
self.info_upd = {}
self.password = None
self.redis = RedisPool(settings.storage_socket)
if self.id:
self._get_avatar()
示例2: authenticate_ulogin
# 需要导入模块: from point.core.user import User [as 别名]
# 或者: from point.core.user.User import __init__ [as 别名]
def authenticate_ulogin(self, network, uid):
res = db.fetchone("SELECT id FROM users.ulogin_accounts "
"WHERE network=%s AND uid=%s;", [network, uid])
if not res:
raise NotAuthorized
User.__init__(self, int(res[0]))
self.authenticate()
示例3: __init__
# 需要导入模块: from point.core.user import User [as 别名]
# 或者: from point.core.user.User import __init__ [as 别名]
def __init__(self, field, value=None):
self._url = None
if field == 'url':
self._url = value
elif isinstance(field, (str, unicode)):
if field.startswith('http://') or field.startswith('https://'):
self._url = field
elif not value:
raise InvalidFeedUrl
if self._url:
if not parse_url(self._url, exact=True):
raise InvalidFeedUrl
key = 'url_feed_id:%s' % self._url
id = cache_get(key)
if not id:
res = db.fetchone("SELECT id FROM users.feeds WHERE url=%s;",
[self._url])
if res:
id = res['id']
cache_store(key, id)
if not id:
raise FeedNotFound
try:
User.__init__(self, long(id))
except UserNotFound:
raise FeedNotFound
else:
try:
User.__init__(self, field, value)
except UserNotFound:
raise FeedNotFound
self._posts = []