本文整理汇总了Python中users.Users.get_users方法的典型用法代码示例。如果您正苦于以下问题:Python Users.get_users方法的具体用法?Python Users.get_users怎么用?Python Users.get_users使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类users.Users
的用法示例。
在下文中一共展示了Users.get_users方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from users import Users [as 别名]
# 或者: from users.Users import get_users [as 别名]
class UUS:
def __init__(self):
self.__LOG_TAG__ = "UUS"
self.rss_list = URL_list()
self.html_list = URL_list()
self.users = Users()
def to_str(self):
return "rss_list:\n"+self.rss_list.to_str()+'\n\nhtml_list:\n'+self.html_list.to_str()
def print_users(self, p_users):
for user in self.users.get_users():
print str(user.get_id()) + " " + str(user.get_nick()) + " " + str(user.get_url_list())
print
def get_url_split(self, p_url):
"RSS|http://www.hardware.com.br/feeds/global.xml"
ret = "", ""
try:
ret = p_url.split('|')
except:
log.error(self.__LOG_TAG__, "Error getting URL type")
return ret[0], ret[1]
def update(self, p_user):
user_id = p_user.get_id()
user_urls = p_user.get_url_list()
for url in user_urls:
url_type, url_link = self.get_url_split(url)
if url_type == "RSS":
self.rss_list.add_link(url_link)
self.rss_list.add_user(url_link, user_id)
elif url_type == "HTML":
self.html_list.add_link(url_link)
self.html_list.add_user(url_link, user_id)
else:
log.error(self.__LOG_TAG__, "URL type[%s] invalid" % (url_type))
def maintenance_url_lists(self):
#atualizar tabela user
self.users.update_users()
#atualizar tabela url de acordo com nova tabela user
for user in self.users.get_users():
user_status = user.get_status()
if user_status == 0:
#status 0 = funcionando. nao fazer nada.
pass
elif (user_status == 1) or (user_status == 2):
#novo ou alterado. atualizar.
self.update(user)
elif (user_status == 3):
#block(user)
pass
elif (user_status == 9):
#delete(user)
pass
else:
log.error(self.__LOG_TAG__, "Error: invalid status[%s]" % (user_status))