当前位置: 首页>>代码示例>>Python>>正文


Python User.get_by_irc_id方法代码示例

本文整理汇总了Python中db.User.get_by_irc_id方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_by_irc_id方法的具体用法?Python User.get_by_irc_id怎么用?Python User.get_by_irc_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在db.User的用法示例。


在下文中一共展示了User.get_by_irc_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: PostUpdate

# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import get_by_irc_id [as 别名]
 def PostUpdate(self, source, *args, **kwargs):
     user = User.get_by_irc_id(source)
     if not user.banned:
         status = super(IdenticaApi,self).PostUpdate(*args, **kwargs)
         user.add_post(status, source)
         if user.gets_mail:
             try:
                 self._send_information_mail(user, status.decode('utf-8'))
             except BaseException, e:
                 print 'Error in send_infomation_mail:', type(e).__name__, e
                 exit(1)
开发者ID:miri64,项目名称:spline_social,代码行数:13,代码来源:apicalls.py

示例2: _set_bann

# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import get_by_irc_id [as 别名]
 def _set_bann(self, username, bann_status):
     try:
         if username[0] == '@':
             bannee = User.get_by_user_id(username[1:])
         else:
             bannee = User.get_by_irc_id(username)
         banner = User.get_by_irc_id(self.event.source())
         if banner.banned:
             reply = 'You are banned.'
         elif not banner.admin:
             reply = 'You are no admin.'
         elif bannee != None:
             if bannee.user_id == banner.user_id:
                 reply = 'You can\'t %sban yourself.' % ('' if bann_status else 'un')
             else:
                 bannee.banned = bann_status
                 reply = 'You %sbanned user %s.' % ('' if bann_status else 'un', bannee.user_id)
         else:
             reply = 'User %s does not exist.' % username
     except User.NotLoggedIn, e:
         reply = str(e)
开发者ID:miri64,项目名称:spline_social,代码行数:23,代码来源:irc.py

示例3: do_admin

# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import get_by_irc_id [as 别名]
 def do_admin(self,username):
     try:
         if username[0] == '@':
             user = User.get_by_user_id(username[1:])
         else:
             user = User.get_by_irc_id(username)
         admin = User.get_by_irc_id(self.event.source())
         if admin == None:
             reply = 'You are no admin.'
         elif not admin.admin:
             reply = 'You are no admin.'
         elif user != None:
             if user.user_id != admin.user_id:
                 user.admin = not user.admin
                 if user.admin:
                     reply = 'You made %s an admin.' % user.user_id
                 else:
                     reply = 'You took admin rights from %s.' % user.user_id
             else:
                 reply = 'You can not strip yourself of your admin rights.'
     except User.NotLoggedIn, e:
         reply = str(e)
开发者ID:miri64,项目名称:spline_social,代码行数:24,代码来源:irc.py


注:本文中的db.User.get_by_irc_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。