• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python model.Member类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中model.Member的典型用法代码示例。如果您正苦于以下问题:Python Member类的具体用法?Python Member怎么用?Python Member使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: get

 def get(self):
     template_values = {}
     template_values['paged_member_keys'] = Member.get_paged_member_keys()
     template_values['is_member'] = True if 'member' in self.session else False
     if 'member' in self.session:
         template_values['member'] = Member.get_member_json(self.session['member'])
     self.render_template(template_name=None, template_values=template_values)
开发者ID:aiyappaganesh,项目名称:beaglesloft,代码行数:7,代码来源:index.py


示例2: post

 def post(self):
     errors = []
     username = str(self.get_cookie('username',''))
     userflag = str(self.get_cookie('userflag',''))
     if not username or not userflag:
         self.write('403')
         return
     myfile = self.request.files.get('myfile',[0])[0]
     if myfile:
         im = Image.open(StringIO(myfile['body']))
         max_w = 73
         max_h = 73
         if im.size[0] > max_w or im.size[1] > max_w:
             ss = max(float(im.size[0])/max_w, float(im.size[1])/max_h)
             im = im.resize((int(im.size[0]/ss), int(im.size[1]/ss)), Image.ANTIALIAS)
         
         output = StringIO()
         im.convert('RGB').save(output, 'JPEG', quality = 95)#95
         img_data = output.getvalue()
         output.close()
         
         #self.set_header('Content-Type','image/jpeg')
         #self.write(img_data)
         #return
         
         if IMG_STORAGE=='sae':
             file_path_name = '%s.jpg'% username
             avatar = put_obj2storage(file_name = file_path_name, data = img_data, domain_name = DOMAIN_NAME_AVATAR)
         elif IMG_STORAGE=='upyun':
             u = UpYun(DOMAIN_NAME_AVATAR, UPYUN_USER, UPYUN_PW)
             file_path_name = '/avatar/%s.jpg'% username
             avatar = u.writeFile( file_path_name, img_data, True)
         
         if avatar:
             if username == 'admin':
                 Member.set_flag(username, '99')
             if userflag == '1':
                 if Member.set_flag(username, '2'):
                     self.set_cookie('userflag', '2', path="/", expires_days = 365 )
                     clear_cache_multi(['cur_user:' + username])
                     self.redirect('/setavatar')
                     return
                 else:
                     errors.append('服务器暂时出错,请稍后再试')
             else:
                 self.redirect('/setavatar')
                 return
         else:
             errors.append('保存图片出错,请稍后再试')
     else:
         errors.append('图片没有正确上传')
         
     self.echo('setavatar.html', {
         'title': "设置头像",
         'errors':errors,
         'wb_avatar_large': '',
     }, layout='_layout.html')
开发者ID:QiaoHaiZhong,项目名称:rebang,代码行数:57,代码来源:view.py


示例3: post

 def post(self, email):
     if not self.session['member'] == email:
         self.response.out.write('access denied')
         return
     image = self.get_uploads("member-image-upload")
     image_key = str(image[0].key()) if image else None
     image_coords = [float(coord) for coord in self['image_coords'].split(',')] if self['image_coords'] else None
     key = email if email else self['email']
     image_url = '/api/members/'+key+'/image' if image_key else None
     Member.create_or_update(key, name=self['name'], organization=self["organization"],
                             designation=self["designation"], image=image_key, website=self["website"],
                             twitter_handle=self["twitter_handle"], facebook_id=self["facebook_id"], bio=self["bio"],
                             password=self['password'], image_coords=image_coords, image_url=image_url)
     self.redirect("/members/profile")
开发者ID:aiyappaganesh,项目名称:beaglesloft,代码行数:14,代码来源:members.py


示例4: get

 def get(self):
     m_name = str(self.get_argument('name',''))
     self.echo('setuserflag.html', {
         'title': "设置用户权限",
         'm_name': m_name,
         'm_obj':Member.get_by_name_for_edit(m_name),
     }, layout='_layout.html')
开发者ID:QiaoHaiZhong,项目名称:rebang,代码行数:7,代码来源:view.py


示例5: report_task

    def report_task(self):
        diff = datetime.timedelta(days=150)
        cutoff_date = datetime.date.today() - diff

        filename = self.get_filename(self.id())
        member_list = Member.all().fetch(LIMIT_ALL)

        lines = list()
        lines.append("number;name;zip;city;date;bil\n")
        for member in member_list:
            if member.member_since >= cutoff_date and member.status.name == "Medlem":
                cars = member.cars.fetch(1)
                if len(cars) > 0:
                    model = cars[0].model.name
                else:
                    model = ""
                lines.append(
                    '"%s";"%s";"%s";"%s";"%s";"%s"\n'
                    % (
                        unicode(member.number),
                        unicode(member.name),
                        unicode(member.zipcode),
                        unicode(member.city),
                        member.member_since.isoformat(),
                        model,
                    )
                )

        self.write_report(filename, lines)
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:29,代码来源:newmembers.py


示例6: expire_members

def expire_members():
    types = MemberType.all().fetch(30)
    expired_type = None
    for mt in types:
        if mt.name == MEMBER_TYPE_EXPIRED:
            expired_type = mt
            break
    if not expired_type:
        print 'Could not find member type for expired members'

    members = Member.all().fetch(3000)
    expired_count = 0
    last_year = datetime.datetime.now().year - 1
    for member in members:
        dues = MembershipDues.all().ancestor(member).fetch(30)
        all_paid = False
        for due in dues:
            if due.year >= last_year and due.paid:
                all_paid = True
                break
        if not all_paid and member.membertype.name == DEFAULT_MEMBER_NAME and member.status.name == DEFAULT_MEMBER_STATUS_NAME:
            print 'Member no', member.number, 'has an expired membership'
            member.membertype = expired_type
            member.put()
            expired_count = expired_count + 1

    print expired_count, 'memberships have been ended'
开发者ID:,项目名称:,代码行数:27,代码来源:


示例7: nonone

def nonone():
    """ Mass update fields set to 'None'. Please don't ask. """
    for member in Member.all().fetch(10000):
        mod = False
        if member.email == 'None':
            member.email = None
            mod = True

        if member.phone == 'None':
            member.phone = None
            mod = True

        if member.phone_work == 'None':
            member.phone_work = None
            mod = True

        if member.phone_home == 'None':
            member.phone_home = None
            mod = True

        if member.address == 'None':
            member.address = None
            mod = True

        if mod:
            member.put()
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:26,代码来源:editcodes.py


示例8: post

    def post(self, member_id):
        import constants
        member = Member.get(member_id)
        if member.status.name == constants.SIGNUP_STATUS_NAME:
            member.status = self.get_status(constants.WELCOME_LETTER_NAME)
            # update the status to paid membership due.
            dues = MembershipDues.all().ancestor(member).fetch(25)

            current_year = datetime.datetime.now().year
            # Set next year if this at the end of the previous.
            if (datetime.datetime.now().month >= 11):
                current_year = current_year + 1

            found = False
            for due in dues:
                if due.year == current_year:
                    due.paid = True
                    found = True
                    print 'Updated existing due'
                    due.put()
            if not found:
                print 'Due not found, created new'
                due = MembershipDues(parent=member, year=current_year, paid=True)
                due.put()
            member.put()
        elif member.status.name == constants.WELCOME_LETTER_NAME:
            member.status = self.get_status(constants.DEFAULT_MEMBER_STATUS_NAME)
            member.put()
        destination = self.request.get('return')
        return self.redirect(destination)
开发者ID:,项目名称:,代码行数:30,代码来源:


示例9: get

 def get(self):
     track = Track.get_by_key_name(self['track_id'])
     program = Program.get_by_key_name(self['program_id'], parent=track)
     modules = ProgramModule.all().ancestor(program).order('name')
     template_values = {'program':program,
                        'track':track,
                        'modules':modules,
                        'listing_heading':program.name}
     template_values['is_member'] = True if 'member' in self.session else False
     if 'member' in self.session:
         email = self.session['member']
         member = Member.get_by_email(email)
         template_values['member'] = member
         if member.role == MEMBER_ROLE[MANAGER]:
             template_values['is_manager'] = True
         else:
             modules_count = modules.count()*1.0
             completed_modules = []
             for module in modules:
                 if module.completed:
                     completed_modules.append(module)
             completed_modules_count = len(completed_modules)
             score = (completed_modules_count/modules_count)*100.0
             engage_score = round(score*random(),0)
             engage_score = int(engage_score) if engage_score > 1 else 1
             template_values['donuts'] = DonutFactory.get_donuts(100, 0.875, [('Engineer1', [DonutSegment(engage_score, '#1c758a'), DonutSegment(score, '#58c4dd')], '/assets/img/tracks/mobile_dev.png')], 'transparent', '#ddd')
     self.render_template(template_name='program_listing.html', template_values=template_values)
开发者ID:aiyappaganesh,项目名称:beaglesloft,代码行数:27,代码来源:tracks.py


示例10: cur_user

 def cur_user(self):
     user_name_cookie = self.get_cookie('username','')
     user_code_cookie = self.get_cookie('usercode','')
     if user_name_cookie and user_code_cookie:
         from model import Member
         return Member.check_loged_user(user_name_cookie, user_code_cookie)
     else:
         return None
开发者ID:agentwx,项目名称:rebang,代码行数:8,代码来源:common.py


示例11: members_with_status

    def members_with_status(self, status_name):
        index = search.Index(name='members')
        results = index.search(query=search.Query('status:' + status_name, options=search.QueryOptions(limit=LIMIT)))

        ret = list()
        for document in results:
            ret.append(Member.search_member_from_document(document))
        return ret
开发者ID:,项目名称:,代码行数:8,代码来源:


示例12: get

    def get(self):
        template = JINJA_ENVIRONMENT.get_template('templates/members/member_list.html')
        countries = Country.all().order('order').fetch(LIMIT)
        statuses = Status.all().order('order').fetch(LIMIT)
        types = MemberType.all().order('order').fetch(LIMIT)

        # TODO: Make sensible
        query_string = ''
        current_search = self.request.get('search')
        query_string +=  current_search

        current_status = self.request.get('status')
        if current_status != '':
            if query_string != '':
                query_string += ' AND '
            query_string += 'status:' + current_status

        current_type = self.request.get('type')
        if current_type != '':
            if query_string != '':
                query_string += ' AND '
            query_string += 'type:'+ current_type

        current_country = self.request.get('country')
        if current_country and current_country != '':
            if query_string != '':
                query_string += ' AND '
            query_string += 'country:' + current_country

        index = search.Index(name='members')
        result = index.search(query=search.Query(query_string, options=search.QueryOptions(limit=LIMIT)))

        members = list()
        for document in result.results:
            members.append(Member.search_member_from_document(document))

        members = sorted(members, key=lambda x: x.number)

        current_status_name = current_status
        current_type_name = current_type

        total = memcache.get('member_count')
        if not total:
            total = 0

        data = {
            'countries': countries,
            'statuses': statuses,
            'types': types,
            'members': members,
            'current_status': current_status,
            'current_type': current_type,
            'current_search': current_search,
            'found': result.number_found,
            'shown': len(members),
            'total': total
        }
        self.response.write(template.render(data))
开发者ID:,项目名称:,代码行数:58,代码来源:


示例13: do_index_verification

def do_index_verification():
	member_list = Member.all().fetch(LIMIT_ALL)
	index = search.Index(name='members')
	for member in member_list:
		query =

		result = index.search(query=search.Query('number:' + member.number, options=search.QueryOptions(limit=10)))
		logging.debug('Found ' + str(len(result))) + ' members with number ' + member.number
		
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:8,代码来源:verifyindex.py


示例14: create_new_member_no

def create_new_member_no():
    """Assign new member no. Not *that* time critical but some form of
    transactions would be nice. Or required. This makes my hair stand up
    but...

    It works."""

    members = Member.all().order('-number').fetch(1)
    return str(int(members[0].number) + 1)
开发者ID:KlubbAlfaRomeoNorge,项目名称:members,代码行数:9,代码来源:dbutils.py


示例15: get

 def get(self):
     template_values = {}
     upcoming_events, past_events = Event.get_paged_events()
     template_values['past_events'] = past_events
     template_values['upcoming_events'] = upcoming_events
     template_values['is_member'] = True if 'member' in self.session else False
     if 'member' in self.session:
         template_values['member'] = Member.get_member_json(self.session['member'])
     self.render_template(template_name='events.html', template_values=template_values)
开发者ID:aiyappaganesh,项目名称:beaglesloft,代码行数:9,代码来源:events.py


示例16: post

 def post(self):
     req_user = self.request.user
     gu_obj = GoogleUser.get_or_insert(req_user.user_id())
     if gu_obj.name:
         self.redirect('/')
         return
     
     errors = []
     name = self.POST['name'].strip().lower()
     if name:
         if len(name)<20:
             if re.search('^[a-zA-Z0-9]+$', name):
                 check_obj = Member.get_by_key_name(str(name))
                 if check_obj:
                     errors.append('该用户名已被注册,请换一个吧')
                 else:
                     #get member id
                     mid_obj = Counter.get_or_insert('member_auto_increment',name = 'member_auto_increment', value = 1)
                     nuser_obj = Member(key_name=name, id = mid_obj.value, flag = 1, add = int(time()))
                     nuser_obj.put()
                     if nuser_obj.is_saved():
                         #set google user
                         gu_obj.name = name
                         db.run_in_transaction(obj_runput,gu_obj)
                         #all member num +1
                         mid_obj.value += 1
                         db.run_in_transaction(obj_runput,mid_obj)
                         self.redirect('/setavatar')
                         return
                     else:
                         errors.append('服务器出现意外错误,请稍后再试')
             else:
                 errors.append('用户名只能包含字母和数字')
         else:
             errors.append('用户名太长了')
     else:
         errors.append('用户名必填')
     
     self.echo('setname.html', {
         'title': "设置名字",
         'errors':errors,
         'name':name,
         'newest_node': Node.get_newest(),
     }, layout='_layout.html')
开发者ID:QiaoHaiZhong,项目名称:rebang,代码行数:44,代码来源:view.py


示例17: get

 def get(self):
     path = 'member_profile_image.html'
     email = self.session['member']
     member = Member.get_by_email(email)
     image_upload_url = blobstore.create_upload_url('/api/members/' + email + '/update')
     template_values = {'member': member, 'image_upload_url': image_upload_url}
     template_values['is_member'] = True if 'member' in self.session else False
     #if 'member' in self.session:
     #    template_values['member'] = Member.get_member_json(self.session['member'])
     self.write(self.get_rendered_html(path, template_values), 200)
开发者ID:aiyappaganesh,项目名称:beaglesloft,代码行数:10,代码来源:members.py


示例18: cur_user

 def cur_user(self):
     if self.request.user:
         from model import Member, GoogleUser
         req_user = self.request.user
         gu_obj = GoogleUser.get_or_insert(req_user.user_id())
         if gu_obj.name:
             return Member.get_by_key_name(gu_obj.name)
         return None
     else:
         return None
开发者ID:QiaoHaiZhong,项目名称:rebang,代码行数:10,代码来源:common.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python model.Model类代码示例发布时间:2022-05-27
下一篇:
Python model.Link类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap