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


Python dataplus.dictGetVal函数代码示例

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


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

示例1: inviteToChatByEmail

def inviteToChatByEmail(request, session_id):
    try:
        chat_id = dataplus.dictGetVal(request.REQUEST, 'chatId', '')
        if not chat_id:
            return ajaxian.getFailureResp('error:invalid_chatId')
        username = dataplus.dictGetVal(request.REQUEST, 'username', '')
        name = dataplus.dictGetVal(request.REQUEST, 'name', '')
        invited_name = dataplus.dictGetVal(request.REQUEST, 'invitedName', '', lambda x: x.strip())
        invited_email = dataplus.dictGetVal(request.REQUEST, 'invitedEmail', '', lambda x: x.strip())
        text = dataplus.dictGetSafeVal(request.REQUEST, 'text', '')
        
        subject = 'Chat Invitation to Socialray'
        sender = name + '<' + username + '[email protected]>'
        html_message = '<p>Hello ' + invited_name + '</p><p>' + name + ' wants to have a chat with you and has sent you the following message ' + \
            'inviting you to a chat session in Socialray.</p><p>"' + text + '"</p>' + \
            '<p>You can <a href="' + config.server_base_url + '/chat/startchat.htm?chatId=' + chat_id + '">join ' + name + '</a> in chat now.</p>' + \
            '<p>Regards,<br />from Socialray</p>'
        text_message = 'Hello ' + invited_name + '\r\n' + name + ' wants to have a chat with you and has sent you the following message ' + \
            'inviting you to a chat session in Socialray.\r\n"' + text + '"\r\n' + \
            'Please visit ' + config.server_base_url + '/chat/startchat.htm?chatId=' + chat_id + ' to join ' + name + ' in chat now.\r\n' + \
            'regards,\r\nfrom Socialray\r\n\r\n'
        mailman.sendOneWayMail(sender, [invited_name + '<' + invited_email + '>'], subject, html_message, None, None, text_message)
        livewire_client.command('inviteByEmail', [session_id, chat_id, invited_name, invited_email])
        return ajaxian.getSuccessResp('')
    except:
        return ajaxian.getFailureResp('error:unknown')
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:26,代码来源:chat.py

示例2: handle

def handle(request):
    logged_in_type = siteaction.getLoggedInAccountType(request)
    
    if logged_in_type == 'U':
        myself = siteaction.getLoggedInUser(request)
        html_file = 'me/sentitems.htm'
    elif logged_in_type == 'R':
        myself = siteaction.getLoggedInRecruiter(request)
        html_file = 'recruiters/sentitems.htm'
    else:
        return HttpResponseRedirect('/login.htm')
        
    if request.method == 'POST':
        if dataplus.dictGetVal(request.REQUEST, 'action', '') == 'delete':
            deleteMessages(request, myself)
            return HttpResponseRedirect('/mailbox/sentitems.htm?flashId=msg_del');
        
    action_result = ''
    if dataplus.dictGetVal(request.REQUEST, 'flashId'):
        action_result = dataplus.dictGetVal(statix.action_messages, dataplus.dictGetVal(request.REQUEST, 'flashId'), '')
        
    return siteaction.render_to_response(html_file,
                              { 'message_box_html': getMessageBoxHtml(request, myself),
                                'action_result':action_result,
                                'myself': myself    })
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:25,代码来源:mailbox_sentitems.py

示例3: handle

def handle(request):
    myself = siteaction.getLoggedInUser(request)
    if not myself:
        return HttpResponseRedirect('/login.htm')

    if request.method == 'GET':      
        action_result = ''
        if dataplus.dictGetVal(request.REQUEST, 'flashId'):
            action_result = dataplus.dictGetVal(statix.action_messages, dataplus.dictGetVal(request.REQUEST, 'flashId'), '')
            
        myself.image_url = dataplus.getStaticUrl(myself.image_size3_file_path)
        return siteaction.render_to_response('me/changephoto.htm', { 'action_result':action_result, 'myself':myself})
    elif request.method == 'POST':
        success, error_code, img1, img2, img3, img4 = studio.saveImage_x4_ByDate(request, 'user_' + myself.username, 'photograph')
        if success:
            if myself.image_file_path != img1:
                iolib.deleteFiles([myself.image_file_path, myself.image_size1_file_path, \
                        myself.image_size2_file_path, myself.image_size3_file_path])
                myself.image_file_path = img1
                myself.image_size1_file_path = img2
                myself.image_size2_file_path = img3
                myself.image_size3_file_path = img4
                myself.save()
                
                chat_settings = models.ChatSettings.objects.get(account=myself.account)
                chat_settings.image_size1_file_path = img2
                chat_settings.image_size2_file_path = img3
                chat_settings.image_size3_file_path = img4
                chat_settings.save()
                session_id = request.COOKIES['session_id']
                siteaction.updateLivewireData(session_id, myself.account)
        else:
            return HttpResponseRedirect('/me/changephoto.htm?flashId=' + error_code)
        
        return HttpResponseRedirect('/me/?flashId=usrpic_chnged')
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:35,代码来源:me_changephoto.py

示例4: handle

def handle(request):
    last_id = dataplus.dictGetVal(request.REQUEST, "last_id", 0, string.atoi)
    first_id = dataplus.dictGetVal(request.REQUEST, "first_id", 0, string.atoi)

    has_prev_page = False
    has_next_page = False

    if last_id:
        has_prev_page = True
        communities, has_next_page = getCommunities("next", last_id)
    elif first_id:
        has_next_page = True
        communities, has_prev_page = getCommunities("prev", first_id)
    else:
        communities, has_next_page = getCommunities()

    prev_btn = ""
    next_btn = ""
    if communities:
        total_communities = models.Community.objects.count()

        if has_prev_page:
            prev_btn = '<a href="communitylist.htm?first_id=' + str(communities[0].id) + '">PREV</a>'
        if has_next_page:
            next_btn = '<a href="communitylist.htm?last_id=' + str(communities[len(communities) - 1].id) + '">NEXT</a>'

    buttons = prev_btn + "&nbsp;&nbsp;" + next_btn

    return siteaction.render_to_response(
        "communitylist.htm", {"communities": communities, "showing_howmany": "", "buttons": buttons}  # showing_howmany,
    )
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:31,代码来源:communitylist.py

示例5: handle

def handle(request):
    logged_in_type = siteaction.getLoggedInAccountType(request)
    if logged_in_type == 'U':
        myself = siteaction.getLoggedInUser(request)
        mru_data = models.UserMRUData.objects.get(user__id=myself.id)
        html_file = 'me/inbox.htm'
    elif logged_in_type == 'R':
        myself = siteaction.getLoggedInRecruiter(request)
        mru_data = models.RecruiterMRUData.objects.get(recruiter__id=myself.id)
        html_file = 'recruiters/inbox.htm'
    else:
        return HttpResponseRedirect('/login.htm')
    
    if request.method == 'POST':
        if dataplus.dictGetVal(request.REQUEST, 'action', '') == 'delete':
            deleteMessages(request, myself)
            return HttpResponseRedirect('/mailbox/?flashId=msg_del');
        
    new_msgs_count = models.Message.objects.filter(account__id=myself.account.id, folder='inbox', 
            sent_at__gte=mru_data.last_accessed_time).count()
        
    action_result = ''
    if dataplus.dictGetVal(request.REQUEST, 'flashId'):
        action_result = dataplus.dictGetVal(statix.action_messages, dataplus.dictGetVal(request.REQUEST, 'flashId'), '')
    
    return siteaction.render_to_response(html_file,
                              { 'message_box_html': getMessageBoxHtml(request, myself),
                                'new_msgs_count': new_msgs_count,
                                'action_result':action_result,
                                'myself': myself    })
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:30,代码来源:mailbox_index.py

示例6: handle

def handle(request):
    myself = siteaction.getLoggedInUser(request)
    if not myself:
        return HttpResponseRedirect('/login.htm')
    
    settings = models.UserSettings.objects.get(user=myself)
    
    if request.method == 'GET':
        resume_visibility = hotmetal.elemSelect([('Everyone', 'everyone'), ('Friends only', 'friends'), ('Nobody', 'nobody')], [],
            None, None, settings.resume_visibility, 'name="resume_visibility" id="resume_visibility" style="width:120px"')
            
        hide_phone_numbers_checked = ('', 'checked="checked"')[settings.phone_num_visibility != 'everyone']
            
        action_result = ''
        if dataplus.dictGetVal(request.REQUEST, 'flashId'):
            action_result = dataplus.dictGetVal(statix.action_messages, dataplus.dictGetVal(request.REQUEST, 'flashId'), '')
        
        return siteaction.render_to_response('me/editprivacy.htm',
                    {'resume_visibility':resume_visibility, 
                     'hide_phone_numbers_checked':hide_phone_numbers_checked, 
                     'action_result':action_result,
                     'myself': myself
                    })
            
    elif request.method == 'POST':
        settings.resume_visibility = dataplus.dictGetVal(request.REQUEST,'resume_visibility')
        settings.phone_num_visibility = dataplus.dictGetVal(request.REQUEST, 'hide_phone_numbers', 'everyone', lambda x:'friends')
        settings.save()
        
        return HttpResponseRedirect('/me/editprivacy.htm?flashId=privacy_saved')
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:30,代码来源:me_editprivacy.py

示例7: handle

def handle(request, comm_id):
    myself = siteaction.getLoggedInUser(request)
    if not myself:
        return HttpResponseRedirect('/login.htm')
    
    community = models.Community.objects.select_related().get(id=comm_id)
    if myself.username != community.owner_username:
        return siteaction.render_to_response('me/showmessage.htm', {'msg_heading':'Error', 'msg_html':'Unauthorized access.'})

    if request.method == 'GET':
        action_result = ''
        if dataplus.dictGetVal(request.REQUEST, 'flashId'):
            action_result = dataplus.dictGetVal(statix.action_messages, dataplus.dictGetVal(request.REQUEST, 'flashId'), '')
        
        community.image_url = dataplus.getStaticUrl(community.image_size3_file_path)
        return siteaction.render_to_response('communities/changephoto.htm', \
                                    {'community':community,
                                     'action_result':action_result,
                                     'myself':myself})
    elif request.method == 'POST':
        success, error_code, img1, img2, img3, img4 = studio.saveImage_x4_ByDate(request, 'comm_' + str(community.id), 'commIcon')
        if success:
            if community.image_file_path != img1:
                iolib.deleteFiles([community.image_file_path, community.image_size1_file_path, \
                    community.image_size2_file_path, community.image_size3_file_path])
                community.image_file_path = img1
                community.image_size1_file_path = img2
                community.image_size2_file_path = img3
                community.image_size3_file_path = img4
                community.save()            
        else:
            return HttpResponseRedirect('/communities/' + str(comm_id) + '/changephoto.htm?flashId=' + error_code)
            
        return HttpResponseRedirect('./?flashId=commpic_chnged')
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:34,代码来源:communities_changephoto.py

示例8: handle

def handle(request):
    last_id = dataplus.dictGetVal(request.REQUEST, 'last_id', 0, string.atoi)
    first_id = dataplus.dictGetVal(request.REQUEST, 'first_id', 0, string.atoi)
    
    has_prev_page = False
    has_next_page = False
    
    if last_id:
        has_prev_page = True
        members, has_next_page = getMembers("usr.id < " + str(last_id))
    elif first_id:
        has_next_page = True
        members, has_prev_page = getMembers("usr.id > " + str(first_id), False)
        members.reverse()
    else:
        members, has_next_page = getMembers()
    
    prev_btn = ''
    next_btn = ''
    if members:
        total_members = models.User.objects.count()
    
        if has_prev_page:
            prev_btn = '<a href="memberlist.htm?first_id=' + str(members[0].id) + '">PREV</a>'
        if has_next_page:
            next_btn = '<a href="memberlist.htm?last_id=' + str(members[len(members)-1].id) + '">NEXT</a>'
    
    buttons = prev_btn + '&nbsp;&nbsp;' + next_btn
  
    return siteaction.render_to_response('memberlist.htm',
                              { 'members': members,
                                'showing_howmany': '',#showing_howmany,
                                'buttons': buttons })
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:33,代码来源:memberlist.py

示例9: handle

def handle(request): 
    try:
        logged_in_type = siteaction.getLoggedInAccountType(request)
        rcvr_usrname = dataplus.dictGetVal(request.REQUEST,'sendTo')
        
        if logged_in_type == 'U':
            myself = siteaction.getLoggedInUser(request)
        elif logged_in_type == 'R':
            myself = siteaction.getLoggedInRecruiter(request)
        else:
            return ajaxian.getFailureResp('not_logged_in')
        
        rcvr_account = models.Account.objects.get(username=dataplus.dictGetVal(request.REQUEST,'sendTo'))
        text_message = dataplus.dictGetSafeVal(request.REQUEST,'text')
        html_message = dataplus.replaceHtmlLineBreaks(text_message)
        subject = dataplus.dictGetSafeVal(request.REQUEST,'subject')
        
        def internalSender(rcvr_accounts):
            mailman.sendMessage(myself.username, [rcvr.username for rcvr in rcvr_accounts], subject, html_message)
        
        def externalSender(rcvr_accounts):
            sender = '"' + myself.name + '" <' + myself.username + '[email protected]>'
            receivers = ['"' + rcvr.name + '" <' + rcvr.email + '>'  for rcvr in rcvr_accounts]
            mailman.sendMail(sender, receivers, subject, html_message, None, None, text_message, reply_to=myself.email)
            
        mailman.sendBySettings([rcvr_account], internalSender, externalSender, 'TextMessage')
                
        return ajaxian.getSuccessResp('')
    except:
        return ajaxian.getFailureResp('unknown')
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:30,代码来源:sendmessage.py

示例10: handle

def handle(request):   
    if request.method == 'GET':
        return siteaction.render_to_response('idxcaptcha.htm')
    elif request.method == 'POST':
        captchatextin = request.session['signup_captcha_text']
        if dataplus.dictGetVal(request.REQUEST,'captcha_text') != captchatextin:
            return siteaction.render_to_response('idxcaptcha.htm',
                    {'error_html':'The captcha text entered is incorrect.'})
                
        params = request.session['signup-params']
        if params['username'].lower() in config.reserved_words or models.Account.objects.filter(username=params['username']).count() > 0:
            countries = models.Country.objects.all().order_by('name')
            country_select_html = hotmetal.elemSelect([('Select', '')], countries,
                lambda x:x.name, lambda x:x.code, dataplus.dictGetVal(request.REQUEST,'country'), 'name="country" id="country" style="width:160px"')
            
            industry_cats = models.IndustryCategory.objects.all()
            industry_cats_html = hotmetal.elemSelect([('Select', '')], industry_cats,
                lambda x:x.name, lambda x:x.name, dataplus.dictGetVal(request.REQUEST,'industry_category'), 'name="industry_category" id="industry_category" style="width:160px"')
            
            experience_select_html = hotmetal.elemSelect([('Select', '-1')], range(0,51),
                lambda x:x, lambda x:x, dataplus.dictGetVal(request.REQUEST,'experience'), 'name="experience" id="experience" style="width:90px"')
                    
            error_message = 'Username already exists. Please choose another'
            return siteaction.render_to_response('index.htm', 
                {'error_html': '<p class="error-note">' + error_message + '</p>',
                'name':params['name'],
                'username':params['username'],
                'email':params['email'],
                'country_select_html':country_select_html,
                'industry_categories_html':industry_cats_html,
                'experience_select_html':experience_select_html})
        else:           
            req_username = params['username'].lower()
            user = siteaction.createUser(req_username, params['name'], params['password'], params['email'], 
                    params['country'], params['industry_category'].replace('&amp;','&'), params['experience'])                 
           
            request.session['signup-params'] = None
            
            useraccount = user.account
        
            #none if these users would have posted their resume, or setup preferences....
            todoResumeMail_subject = '<span style="color:#FF9900">Next step: Update your Resume</span>'
            todoResumeMail_body_html = '<p>To effectively use socialray for Professional Networking and Jobs, you need to update your resume. You can do so by opening the <a href="http://www.socialray.org/me/editresume.htm">Resume Editor</a>.</p>' + \
                '<p>Regards,<br />Socialray Team</p>'
            mailman.sendToInbox(None, req_username, todoResumeMail_subject, todoResumeMail_body_html, 'SA')
            
            session_id = sessions_client.query('addNewSession', [useraccount.username])
            if session_id:
                chat_settings = models.ChatSettings.objects.get(account=useraccount)
                livewire_client.command('updateUserSession', [session_id, useraccount.username, useraccount.name, chat_settings.online_status, 
                    chat_settings.custom_message, chat_settings.invite_preference, chat_settings.ignore_list, 
                    dataplus.getStaticUrl(chat_settings.image_size1_file_path), dataplus.getStaticUrl(chat_settings.image_size2_file_path), 
                    dataplus.getStaticUrl(chat_settings.image_size3_file_path)])

                return siteaction.redirectWithCookie('/me', 'session_id', session_id)
            else:
                return HttpResponseRedirect('500.html')
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:57,代码来源:idxcaptcha.py

示例11: handle

def handle(request):
    myself = siteaction.getLoggedInUser(request)
    if not myself:
        return HttpResponseRedirect('/login.htm')

    username = dataplus.dictGetVal(request.REQUEST, 'user')
    if username and username != myself.username:
        user = dataplus.returnIfExists(models.User.objects.filter(username=username))
        if not user:
            return siteaction.render_to_response('me/showmessage.htm', 
                        {'myself':myself,
                        'msg_heading':'Error',
                        'msg_html':'Invalid Request'})
        heading = user.name + '\'s Friends'
    else:
        user = myself
        heading = ''

    page = dataplus.dictGetVal(request.REQUEST, 'page', 0, string.atoi)
    start_friend_num = page * config.friends_per_page
    last_friend_num = start_friend_num + config.friends_per_page
    
    total_friends = user.friends.count()
    friends = user.friends.all().order_by('-last_access_time')[start_friend_num:last_friend_num]

    html = ''
    if user == myself:
        friends_usernames = [user.username for user in friends]
        online_status = chat.getOnlineStatus(request, friends_usernames, 'friend')
        for friend in friends:
            html += codejar_network.getDescriptiveThumb(friend, True, online_status[friend.username])
    else:
        for friend in friends:
            html += codejar_network.getDescriptiveThumb(friend)
    
    if total_friends == 0:
        showing_howmany = '0 of 0 friends'
    else:
        showing_howmany = str(page*config.friends_per_page + 1) + '-' +  str(page*config.friends_per_page + friends.count()) + ' of ' + str(total_friends)
    
    prev_btn = ''
    next_btn = ''
    page_url = 'friends.htm?'
    if username:    page_url = 'friends.htm?user=' + username + '&'
    if page != 0:
        prev_btn = '<input class="medium-btn" type="button" name="prev-button" value="PREV" onclick="javascript:window.location.href=\'' + page_url + 'page=' + str(page-1) + '\'" />'
    if last_friend_num < total_friends:
        next_btn = '<input class="medium-btn" type="button" name="next-button" value="NEXT" onclick="javascript:window.location.href=\'' + page_url + 'page=' + str(page+1) + '\'" />'

    buttons = prev_btn + next_btn
  
    return siteaction.render_to_response('me/friends.htm',
                              { 'friends_html': html,
                                'showing_howmany': showing_howmany,
                                'heading': heading,
                                'buttons': buttons,
                                'myself' : myself })
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:57,代码来源:me_friends.py

示例12: handle

def handle(request, job_id):
    myself = siteaction.getLoggedInUser(request)
    if not myself:
        return HttpResponseRedirect('/login.htm')
    
    if not job_id:
        return siteaction.render_to_response('showmessage.htm', { 
                'msg_heading':'Error',
                'msg_html':'Access denied.'})
                
    job = dataplus.returnIfExists(models.JobPosition.objects.filter(id=job_id))
    if not job:
        return siteaction.render_to_response('showmessage.htm', { 
                'msg_heading':'Error',
                'msg_html':'Access denied.'})
    
    if job.posted_by:
        job.posted_by_name = job.posted_by.name
    elif job.tag:
        match = re.match('^.*name\=(?P<name>.*?);',job.tag)
        if match:
            job.posted_by_name = match.group('name')
        
    if request.method == 'GET':
        action_result = ''
        if dataplus.dictGetVal(request.REQUEST, 'flashId'):
            action_result = dataplus.dictGetVal(statix.action_messages, dataplus.dictGetVal(request.REQUEST, 'flashId'), '')
            
        if job.min_compensation == job.max_compensation:
            job.salary = str(job.min_compensation)
        else:
            job.salary = str(job.min_compensation) + ' - ' + str(job.max_compensation)
        return siteaction.render_to_response('jobs/viewjobposition.htm',
                            { 'myself': myself,
                              'job':job,
                              'action_result':action_result,
                            })
    elif request.method == 'POST':
        html_message = '<p>Hello ' + job.posted_by_name + ',</p><p>This is in reference to the job you posted titled "' + job.title + '" for ' + job.company_name + '. ' + \
                    'I would like to apply for this position and you can find my resume as an attachment.</p><p>You can always download my latest resume from ' + \
                    '<a href="' + config.server_base_url + config.profiles_url + '/' + myself.username + '">my profile</a>.</p>' + \
                    '<p>Regards,<br />' + myself.name + '</p><br /><br /><br /><br /><br /><br />'+ \
                    'Don\'t want to receive email alerts? Just change your <a href="' + config.server_base_url +  \
                    '/me/editsettings.htm">Email Forwarding Settings</a>'
                    
        text_message = 'Hello ' + job.posted_by_name + ',\r\nThis is in reference to the job you posted titled "' + job.title + '" for ' + job.company_name + '. ' + \
                    'I would like to apply for this position and you can find my resume as an attachment.\r\nYou can always download my latest resume from my profile at ' + \
                    config.server_base_url + config.profiles_url + '/' + myself.username + '.\r\n' + \
                    'Regards,\r\n' + myself.name + '\r\n\r\n\r\n\r\n\r\n\r\n' + + \
                    'Don\'t want to receive email alerts? Just change your Email Forwarding Settings, visit - "' +  \
                    config.server_base_url + '/me/editsettings.htm"'
                    
        resume_file = codejar_resume.getResumeFilePath(myself)
        mailman.sendMail('"' + myself.name + '" <' + myself.username + '[email protected]>', [job.contact_email], 'Re: Job Posting - ' + job.title, html_message, [resume_file], None, text_message, reply_to=myself.email)

        return HttpResponseRedirect('/jobs/' + str(job.id) + '/?flashId=resume_fwd')
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:56,代码来源:jobs_viewjobposition.py

示例13: handle

def handle(request):
    if request.method == 'GET':
        if (dataplus.dictGetVal(request.REQUEST, 'action') == 'logout'):
            siteaction.doLogout(request)
        return siteaction.render_to_response('alt-index.htm')
        
    elif request.method == 'POST':
        return {
            'login':siteaction.doLogin
        }[dataplus.dictGetVal(request.REQUEST,'action')](request)
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:10,代码来源:alt_index.py

示例14: handle

def handle(request):
    myself = siteaction.getLoggedInUser(request)
    if not myself:
        return HttpResponseRedirect('/login.htm')
    
    if request.method == 'GET':
        return siteaction.render_to_response('me/searchcommunities.htm', 
            {'showing_search_results': False,
             'myself': myself,
             'interesting': searchcomm.getInterestingComms(myself)})
    
    elif request.method == 'POST':
        keywords = dataplus.dictGetVal(request.REQUEST,'keywords')
        
        if dataplus.dictGetVal(request.REQUEST,'action') == 'display':
            page = dataplus.dictGetVal(request.REQUEST,'page',0,string.atoi)
            
            pickled_match_list = dataplus.dictGetVal(request.REQUEST,'matches')
            match_list = cPickle.loads(str(pickled_match_list))
        else:
            keywords = keywords.strip()
            if keywords != '':
                match_list = searchcomm.getMatches(keywords)
                pickled_match_list = cPickle.dumps(match_list)
                page = 0
            else:
                return siteaction.render_to_response('me/searchcommunities.htm', 
                    {'showing_search_results': True,
                     'myself': myself,
                     'message':'Please enter a valid search query.'})                
        
        start_num = page * config.community_matches_per_page
        end_num = ((page + 1) * config.community_matches_per_page)
        display_list = match_list[start_num:end_num]
        comms_bulk_dict = models.Community.objects.in_bulk(display_list)
        num_pages = ((len(match_list)-1)/config.community_matches_per_page) + 1
            
        matching_communities = dataplus.getOrderedList(comms_bulk_dict, display_list)
        for comm in matching_communities:
            comm.image_url = dataplus.getStaticUrl(comm.image_size2_file_path)
        
        if match_list:
            message = 'Showing ' + str(start_num + 1) + ' - ' + str(start_num + len(matching_communities)) + ' of ' + str(len(match_list)) + ' matches.'
        else:
            message = 'Your search did not return any results.'
            
        return siteaction.render_to_response('me/searchcommunities.htm', 
            {   'matching_communities': matching_communities,
                'matches': cgi.escape(pickled_match_list),
                'message': message,
                'page_links_html': getPageLinksHtml(num_pages, page),
                'keywords': cgi.escape(keywords, True),
                'myself': myself,
                'showing_search_results': True})
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:54,代码来源:me_searchcommunities.py

示例15: extractQueryFromRequest

def extractQueryFromRequest(rec, request):
    post_field = dataplus.dictGetVal(request.REQUEST, 'post_field', '')
    query = models.RecruiterRecentSearchQuery(recruiter=rec.account)
    if post_field != '':
        pickled_query = dataplus.dictGetVal(request.REQUEST,post_field)
        query_dic = cPickle.loads(pickled_query)
        
        if query_dic['industry_category'] != '':
            query.industry_category = models.IndustryCategory.objects.get(name=query_dic['industry_category'])
        query.designation = query_dic['designation']
        query.mandatory_skills = query_dic['mandatory_skills']
        query.desired_skills = query_dic['desired_skills']
        query.location = query_dic['location']
        query.min_exp_years = query_dic['min_exp_years']
        query.max_exp_years = query_dic['max_exp_years']
        query.qualifications = query_dic['educational_qualifications']
    else:
        if dataplus.dictGetVal(request.REQUEST, 'industry_category', '') != '':
            query.industry_category = models.IndustryCategory.objects.get(name=request.REQUEST['industry_category'])
        query.designation = dataplus.dictGetVal(request.REQUEST, 'designation', escapeHtml=True)
        query.mandatory_skills = dataplus.dictGetVal(request.REQUEST, 'mandatory_skills', escapeHtml=True)
        query.desired_skills = dataplus.dictGetVal(request.REQUEST, 'desired_skills', escapeHtml=True)
        query.location = dataplus.dictGetVal(request.REQUEST, 'location', escapeHtml=True)
        exp = string.split(request.REQUEST['experience'],'-')
        query.min_exp_years = string.atoi(exp[0])
        query.max_exp_years = string.atoi(exp[1])
        query.educational_qualifications = dataplus.dictGetVal(request.REQUEST, 'educational_qualifications', escapeHtml=True)
    return query
开发者ID:TayebJa3ba,项目名称:socialray,代码行数:28,代码来源:recruiters_searchresults.py


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