def handle(request): rec = codejar.auth.getLoggedInRecruiter(request) if not rec: return HttpResponseRedirect('/login.htm') if request.method == 'GET': return codejar.actions.render(request, 'recruiters/settings.htm', {'telephone': rec.telephone}) elif request.method == 'POST': telephone = dataplus.dictGetSafeVal(request.REQUEST, 'telephone', '').strip() password = dataplus.dictGetSafeVal(request.REQUEST, 'password', '').strip() password2 = dataplus.dictGetSafeVal(request.REQUEST, 'password2', '').strip() errors = validateSignup(telephone, password, password2) if errors: flash_message = '<ul>\n' + string.join( ['<li>' + x + '</li>' for x in errors], '\n') + '</ul>\n' return codejar.actions.render(request, 'recruiters/settings.htm', { 'telephone': telephone, 'flash_message': flash_message }) else: if password != '' and password2 != '': rec.password = password rec.telephone = telephone rec.save() return HttpResponseRedirect('dashboard.htm')
def handle(request): try: name = dataplus.dictGetSafeVal(request.REQUEST, 'name', '').strip() email = dataplus.dictGetSafeVal(request.REQUEST, 'email', '').strip() password = dataplus.dictGetSafeVal(request.REQUEST, 'password', '').strip() password2 = dataplus.dictGetSafeVal(request.REQUEST, 'password2', '').strip() telephone = dataplus.dictGetSafeVal(request.REQUEST, 'telephone', '').strip() errors = validateSignup(name, email, password, password2, telephone) if not errors and dataplus.returnIfExists( models.Account.objects.filter(username=email)): errors.append('You already have an account with the same email.') if errors: return codejar.ajaxian.getFailureResp(errors) else: user = codejar.user.addPremiumUser(name, email, password, telephone) pymt = models.Payment( account=user.account, amount=200, payment_mode='CCAvenue', description='Premium User account subscription') pymt.order_id = dataplus.getNewOrderId() pymt.save() request.session['Order_Id'] = pymt.order_id return codejar.ajaxian.getSuccessResp(pymt.order_id) except: return codejar.ajaxian.getFailureResp('')
def handle(request): if not request.user.is_authenticated(): return HttpResponseRedirect('/admin/') if request.method == 'GET': return codejar.actions.render(request, 'sys/recinvite.htm') elif request.method == 'POST': rec_emails = dataplus.dictGetSafeVal(request.REQUEST, 'emails', '') keywords = dataplus.dictGetSafeVal(request.REQUEST, 'keywords', '') experience = dataplus.dictGetVal(request.REQUEST, 'experience', 0, string.atoi) location = dataplus.dictGetSafeVal(request.REQUEST, 'location', '') key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') if rec_emails: min_datetime = datetime.datetime(1980, 10, 3) #min_date response = search_helper.matchResumes(keywords, experience, location, 99999999, min_datetime) usr_list = response.results usr_list.sort(lambda x,y: x['rating']-y['rating']) usr_list = addFormatting(usr_list[:50]) for email in rec_emails.split(','): token_value = models.Token.getNew('system', email, 'Invites') sel_users = getRandomUsers(usr_list) for usr in sel_users: notifications.addNotification(usr['id'], 'ProfEmailed', data={'recruiter_email':email}) mailer.sendAdminRecruiterInvites(email, {'token':token_value, 'key':key, 'matching_users':sel_users}) return HttpResponseRedirect('/sys/recinvite.htm?flashId=recruiters_invited')
def handle(request): rec, redirect = codejar.actions.handleSecurity(request, 'recruiter') if not rec: return redirect email_list = dataplus.dictGetSafeVal(request.REQUEST, 'email_list', '') email_query = dataplus.dictGetSafeVal(request.REQUEST, 'email_query', '') if email_query: search_keywords, experience, location, max_salary = cPickle.loads(base64.b64decode(email_query)) response = search_helper.matchResumes(search_keywords, experience, location, max_salary, datetime.datetime(1981, 1, 9)) email_list = dataplus.decode(string.join([usr['email'] for usr in response.results], '; ')) action = dataplus.dictGetSafeVal(request.REQUEST, 'action', '') if action == 'show_form': return codejar.actions.render(request, 'recruiters/emailusers.htm', {'to_list':email_list, 'recruiter': rec}) elif action == 'email_users': subject = dataplus.dictGetSafeVal(request.REQUEST, 'subject', '') message = dataplus.dictGetSafeVal(request.REQUEST, 'message', '') message += '<p> </p><div style="border-bottom: 1px solid rgb(153, 153, 153);"></div><p>This email has been sent by %s(%s) of %s using <a href="http://www.jobhunt.in">www.jobhunt.in</a> services.</p>' % (rec.name, rec.email, rec.organization) mailman.sendMail(rec.name + '<*****@*****.**>', email_list.split(';'), subject, message, reply_to=rec.email) eventnotifier.sendEventNotification("New Recruiter Mass Mail: " + subject + " - " + rec.name + "(" + rec.email + ")" + " message:\n" + message) return HttpResponseRedirect('dashboard.htm?flashId=email_sent')
def handle(request): if request.method == 'GET': return codejar.actions.render(request, 'signup.htm') elif request.method == 'POST': name = dataplus.dictGetSafeVal(request.REQUEST, 'name', '').strip() email = dataplus.dictGetSafeVal(request.REQUEST, 'email', '').strip() password = dataplus.dictGetSafeVal(request.REQUEST, 'password', '').strip() password2 = dataplus.dictGetSafeVal(request.REQUEST, 'password2', '').strip() telephone = dataplus.dictGetSafeVal(request.REQUEST, 'telephone', '').strip() errors = validateSignup(name, email, password, password2, telephone) if not errors and dataplus.returnIfExists( models.Account.objects.filter(username=email)): errors.append('You already have an account with the same email.') if errors: return codejar.actions.render( request, 'signup.htm', { 'name': name, 'email': email, 'telephone': telephone, 'flash_alerts': errors }) else: user = codejar.user.addPremiumUser(name, email, password, telephone) return codejar.auth.login(request, email, password)
def handle(request): user_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') from_email = dataplus.dictGetVal(request.REQUEST, 'source', False, lambda x: x == 'email') user = dataplus.returnIfExists(models.User.objects.filter(key=user_key)) if not user: return codejar.actions.render( request, 'info.htm', { 'info_header': 'Resume not found', 'info_text': 'This resume does not exist,<br /> or may have been deleted.' }) if request.method == 'GET': return codejar.actions.render(request, 'resumeactive.htm', { 'user_key': user_key, 'from_email': from_email }) elif request.method == 'POST': user.min_salary = dataplus.dictGetVal(request.REQUEST, 'minSalary', 0, string.atoi) user.pref_employer = dataplus.dictGetSafeVal(request.REQUEST, 'preferredEmployer', '') user.pref_location = dataplus.dictGetSafeVal(request.REQUEST, 'preferredLocations', '') user.save() return HttpResponseRedirect('done.html')
def handle(request): account, redirect = codejar.actions.handleSecurity(request, 'account') if request.method == 'GET': msg_type = dataplus.dictGetSafeVal(request.REQUEST, 'type','contactus') msg_hdr = {'contactus': 'Contact us', 'bug': 'Bug Report', 'feedback': 'Feedback', 'suggestion': 'Suggestion', 'reportabuse': 'Report Abuse'}[msg_type] email = '' name = '' if account: email = account.username account_detail = models.User.objects.filter(account=account) if not account_detail: account_detail = models.Recruiter.objects.filter(account=account) name = account_detail[0].name return codejar.actions.render(request, 'msg.htm', {'msg_hdr':msg_hdr, 'email':email, 'name':name }) elif request.method == 'POST': name = dataplus.dictGetSafeVal(request.REQUEST, 'name', '') email = dataplus.dictGetSafeVal(request.REQUEST, 'email', '') msg_hdr = dataplus.dictGetSafeVal(request.REQUEST, 'messageHeader', '') message = dataplus.dictGetSafeVal(request.REQUEST, 'message', '') eventnotifier.sendEventNotification("New Message: " + msg_hdr + " " + name + "(" + email + ")" + " says:\n" + message) return HttpResponseRedirect('thanks.html')
def handle(request, account_type='user'): account, redirect = codejar.actions.handleSecurity(request, 'account') token_value = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') url_prefix = '' if account_type == 'recruiters': url_prefix = 'recruiters/' if request.method == 'GET': return codejar.actions.render( request, url_prefix + 'changepassword.htm', { 'key': token_value, 'is_loggedin': ('true', '')[account is None] }) elif request.method == 'POST': password = dataplus.dictGetSafeVal(request.REQUEST, 'password', '') password2 = dataplus.dictGetSafeVal(request.REQUEST, 'password2', '') errors = [] if len(password) < 6: errors.append('Passwords should have minimum 6 characters.') elif not password == password2: errors.append('Passwords do not match.') if errors: flash_alerts = errors return codejar.actions.render(request, url_prefix + 'changepassword.htm', {'flash_alerts': flash_alerts}) if not account: acct_id = string.atoi(models.Token.getOwner(token_value)) account = dataplus.returnIfExists( models.Account.objects.filter(id=acct_id)) if not account: return HttpResponseRedirect('/?flashId=malformed_url') account.setPassword(password) #Propaganda special if dataplus.dictGetVal(request.session, 'prop_login', False): request.session['prop_login'] = None prop_token = dataplus.returnIfExists( models.Token.objects.filter(owner=account.username, type='RecPropaganda')) if prop_token: prop_token.delete() if token_value: models.Token.remove(token_value) response = codejar.auth.login( request, account.username, password, 'dashboard.htm?flashId=password_changed') return codejar.actions.addCookieToResponse(response, 'last_login', account.username) else: return HttpResponseRedirect( 'dashboard.htm?flashId=password_changed')
def fillFormData(subs): subs.recruiter = rec subs.keywords = dataplus.dictGetSafeVal(request.REQUEST, 'keywords') subs.experience = dataplus.dictGetVal(request.REQUEST, 'experience', '0', string.atoi) subs.location = dataplus.dictGetSafeVal(request.REQUEST, 'location') subs.max_salary = dataplus.dictGetVal(request.REQUEST, 'maxSalary', '0', string.atoi) subs.job_title = dataplus.dictGetSafeVal(request.REQUEST, 'job_title') subs.job_company = dataplus.dictGetSafeVal(request.REQUEST, 'job_company') subs.job_description = dataplus.dictGetSafeVal(request.REQUEST, 'job_desc')
def handle(request): user = codejar.auth.getLoggedInUser(request) if not user: return codejar.ajaxian.getFailureResp('not_logged_in') section = dataplus.dictGetSafeVal(request.REQUEST, 'section', '') if section == 'jobInterest': user.is_job_hunting = dataplus.dictGetSafeVal(request.REQUEST, 'is_job_hunting', '') elif section == 'personalPref': user.curr_designation = dataplus.dictGetSafeVal(request.REQUEST, 'curr_designation', '') user.curr_employer = dataplus.dictGetSafeVal(request.REQUEST, 'curr_employer', '') user.experience = dataplus.dictGetVal(request.REQUEST, 'experience', 0, string.atoi) user.tags = dataplus.dictGetSafeVal(request.REQUEST, 'tags', '') elif section == 'jobPref': user.min_salary = dataplus.dictGetVal(request.REQUEST, 'min_salary', 0, string.atoi) user.pref_designation = dataplus.dictGetSafeVal(request.REQUEST, 'pref_designation', '') user.pref_employment = dataplus.dictGetSafeVal(request.REQUEST, 'pref_employment', '') user.pref_location = dataplus.dictGetSafeVal(request.REQUEST, 'pref_location', '') elif section == 'summary': user.summary = dataplus.dictGetSafeVal(request.REQUEST, 'summary', '') user.settings_edited = True if user.name and user.email and user.tags and user.pref_location: user.tagged = True user.save() return codejar.ajaxian.getSuccessResp(getUpdateHtml(user))
def handle(request, account_type="user"): account, redirect = codejar.actions.handleSecurity(request, "account") token_value = dataplus.dictGetSafeVal(request.REQUEST, "key", "") url_prefix = "" if account_type == "recruiters": url_prefix = "recruiters/" if request.method == "GET": return codejar.actions.render( request, url_prefix + "changepassword.htm", {"key": token_value, "is_loggedin": ("true", "")[account is None]}, ) elif request.method == "POST": password = dataplus.dictGetSafeVal(request.REQUEST, "password", "") password2 = dataplus.dictGetSafeVal(request.REQUEST, "password2", "") errors = [] if len(password) < 6: errors.append("Passwords should have minimum 6 characters.") elif not password == password2: errors.append("Passwords do not match.") if errors: flash_alerts = errors return codejar.actions.render(request, url_prefix + "changepassword.htm", {"flash_alerts": flash_alerts}) if not account: acct_id = string.atoi(models.Token.getOwner(token_value)) account = dataplus.returnIfExists(models.Account.objects.filter(id=acct_id)) if not account: return HttpResponseRedirect("/?flashId=malformed_url") account.setPassword(password) # Propaganda special if dataplus.dictGetVal(request.session, "prop_login", False): request.session["prop_login"] = None prop_token = dataplus.returnIfExists( models.Token.objects.filter(owner=account.username, type="RecPropaganda") ) if prop_token: prop_token.delete() if token_value: models.Token.remove(token_value) response = codejar.auth.login(request, account.username, password, "dashboard.htm?flashId=password_changed") return codejar.actions.addCookieToResponse(response, "last_login", account.username) else: return HttpResponseRedirect("dashboard.htm?flashId=password_changed")
def handle(request): rec, redirect = codejar.actions.handleSecurity(request, 'recruiter') if not rec: return redirect subscription_id = dataplus.dictGetSafeVal(request.REQUEST, 'subscriptionId') if request.method == 'GET': subscription = dataplus.returnIfExists(rec.subscriptions.filter(id=subscription_id)) if (subscription): return codejar.actions.render(request, 'recruiters/subscribe.htm', {'subscription': subscription, 'experience_html':experienceHTML(subscription.experience), 'salary_html': salaryHTML(subscription.max_salary), 'location_html': locationHTML(subscription.location), 'subscriptionId': subscription_id}) else: keywords = dataplus.dictGetSafeVal(request.REQUEST, 'keywords', '') experience = dataplus.dictGetVal(request.REQUEST, 'experience', '0', string.atoi) location = dataplus.dictGetSafeVal(request.REQUEST, 'location', '') max_salary = dataplus.dictGetVal(request.REQUEST, 'maxSalary', '0', string.atoi) return codejar.actions.render(request, 'recruiters/subscribe.htm', {'keywords':keywords, 'experience_html':experienceHTML(experience), 'salary_html': salaryHTML(max_salary), 'location_html': locationHTML(location)}) elif request.method == 'POST': #Save the filter. def fillFormData(subs): subs.recruiter = rec subs.keywords = dataplus.dictGetSafeVal(request.REQUEST, 'keywords') subs.experience = dataplus.dictGetVal(request.REQUEST, 'experience', '0', string.atoi) subs.location = dataplus.dictGetSafeVal(request.REQUEST, 'location') subs.max_salary = dataplus.dictGetVal(request.REQUEST, 'maxSalary', '0', string.atoi) subs.job_title = dataplus.dictGetSafeVal(request.REQUEST, 'job_title') subs.job_company = dataplus.dictGetSafeVal(request.REQUEST, 'job_company') subs.job_description = dataplus.dictGetSafeVal(request.REQUEST, 'job_desc') if subscription_id: subscription = models.RecruiterSubscription.objects.get(id=subscription_id) else: #means new subscription subscription = models.RecruiterSubscription() subscription.min_count = 5 subscription.industry = '' subscription.results_last_sent_on = datetime.datetime(1981, 1, 9) #Jes' bday - default min datetime fillFormData(subscription) subscription.save() return HttpResponseRedirect('/recruiters/dashboard.htm')
def handle(request): filter_id = dataplus.dictGetSafeVal(request.REQUEST, 'filterId', '') if filter_id: resume_filter = get_object_or_404(models.RecruiterSubscription, id=filter_id) results = search_helper.matchResumes(resume_filter.keywords, resume_filter.experience, resume_filter.location, resume_filter.max_salary, resume_filter.added_on, datetime.datetime.utcnow()) return HttpResponse( str(resume_filter) + ': Results(' + str(results) + ')') else: html = '' filters = models.RecruiterSubscription.objects.all() for resume_filter in filters: response = search_helper.matchResumes( resume_filter.keywords, resume_filter.experience, resume_filter.location, resume_filter.max_salary, resume_filter.added_on, datetime.datetime(1980, 10, 3)) html += 'Results(' + str( [result[id] for result in response.results]) + ')<br />' return HttpResponse(html)
def handle(request): if request.method == 'GET': return codejar.actions.render(request, 'forgotpassword.htm') elif request.method == 'POST': username = dataplus.dictGetSafeVal(request.REQUEST, 'email', '') account = dataplus.returnIfExists( models.Account.objects.filter(username=username)) if account: account_detail = dataplus.returnIfExists( models.Recruiter.objects.filter(account=account)) if not account_detail: account_detail = dataplus.returnIfExists( models.User.objects.filter(account=account)) token = models.Token.getNew(str(account.id), account.username, 'ForgotPassword') params = { 'account_key': token, 'path': { 'FR': '/recruiters', 'PU': '' }[account.account_type] } mailer.sendPasswordResetLink(username, params) return HttpResponseRedirect('?flashId=pwd_change_emailed') else: errors = [] errors.append( 'Please provide the email that you used to register with us.') return codejar.actions.render(request, 'forgotpassword.htm', {'flash_alerts': errors})
def handle(request): user_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') user = dataplus.returnIfExists( models.User.objects.filter(key=user_key, account__account_type='FU')) if not user: return codejar.actions.render( request, 'info.htm', { 'info_header': 'Resume not found', 'info_text': 'This resume does not exist,<br /> or may have been deleted.' }) if request.method == 'GET': return codejar.actions.render(request, 'removeresume.htm', {'user_key': user_key}) elif request.method == 'POST': user.delete() return codejar.actions.render( request, 'info.htm', { 'info_header': 'Your resume has been removed', 'info_text': """<p>To make your resume active again, just <a href="/">upload it</a><br /> or send it as an attachment to <a href="mailto:[email protected]">[email protected]</a>.</p> <p>Thank you.</p>""" })
def handle(request): user_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') from_email = dataplus.dictGetVal(request.REQUEST, 'source', False, lambda x: x == 'email') user = dataplus.returnIfExists(models.User.objects.filter(key=user_key)) if not user: return codejar.actions.render(request, 'info.htm', {'info_header':'Resume not found', 'info_text':'This resume does not exist,<br /> or may have been deleted.'}) if request.method == 'GET': return codejar.actions.render(request, 'resumeactive.htm', {'user_key':user_key,'from_email':from_email}) elif request.method == 'POST': user.min_salary = dataplus.dictGetVal(request.REQUEST, 'minSalary', 0, string.atoi) user.pref_employer = dataplus.dictGetSafeVal(request.REQUEST, 'preferredEmployer', '') user.pref_location = dataplus.dictGetSafeVal(request.REQUEST, 'preferredLocations', '') user.save() return HttpResponseRedirect('done.html')
def handle(request): if codejar.auth.getLoggedInAccount(request): codejar.auth.logout(request) if request.method == 'GET': redirect = codejar.actions.redirectIfLoggedIn(request) if redirect: return redirect last_login = dataplus.dictGetSafeVal(request.COOKIES, 'last_login', '') return codejar.actions.render(request, 'login.htm', {'last_login':last_login}) elif request.method == 'POST': email = dataplus.dictGetSafeVal(request.REQUEST, 'email', '') password = dataplus.dictGetSafeVal(request.REQUEST, 'password', '') response = codejar.auth.login(request, email, password) return codejar.actions.addCookieToResponse(response, 'last_login', email)
def handle(request): rec, redirect = codejar.actions.handleSecurity(request, 'recruiter') if not rec: return redirect page = dataplus.dictGetVal(request.REQUEST, 'page', 0, string.atoi) subscr_id = dataplus.dictGetVal(request.REQUEST, 'sub_id', 0, string.atoi) keywords = dataplus.dictGetSafeVal(request.REQUEST, 'keywords', '') search_tuple = dataplus.dictGetSafeVal(request.REQUEST, 'searchTuple', '') search_dict = {} min_datetime = datetime.datetime(1981, 1, 9) #Jes B'day response = None search_desc = '' if subscr_id: subscr = dataplus.returnIfExists(models.RecruiterSubscription.objects.filter( id=subscr_id)) if not (subscr and subscr.recruiter == rec): raise Http404 search_dict = {'keywords':subscr.keywords, 'experience':subscr.experience, 'location':subscr.location, 'max_salary':subscr.max_salary, 'limit_time':subscr.results_last_sent_on} elif keywords: experience = dataplus.dictGetVal(request.REQUEST, 'experience', 0, string.atoi) location = dataplus.dictGetSafeVal(request.REQUEST, 'location', 'Any') max_salary = dataplus.dictGetVal(request.REQUEST, 'maxSalary', 0, string.atoi) search_tuple = base64.b64encode(cPickle.dumps((keywords, experience, location, max_salary))) search_dict = {'keywords':keywords.strip('\r'), 'experience':experience, 'location':location.strip('\r'), 'max_salary':max_salary, 'limit_time':min_datetime} models.RecruiterData.addToRecentSearches(rec, search_dict) elif search_tuple: search_keywords, experience, location, max_salary = cPickle.loads(base64.b64decode(search_tuple)) search_dict = {'keywords':search_keywords, 'experience':experience, 'location':location, 'max_salary':max_salary, 'limit_time':min_datetime} else: raise Http404 response = search_helper.matchResumes(search_dict['keywords'], search_dict['experience'], search_dict['location'], search_dict['max_salary'], search_dict['limit_time'], start=page * page_size, rows=page_size) user_list = response.results num_pages = 0 if (len(user_list) > 0): num_pages = ((string.atoi(response.numFound )-1) / page_size) + 1 return codejar.actions.render(request, 'recruiters/searchresults.htm', {'subscription_id':subscr_id, 'search_tuple': search_tuple, 'search_url': urllib.urlencode(search_dict), 'users': addFormatting(user_list, page), 'search_desc': getSearchDisplay(search_dict), 'links_html': getLinksHtml(num_pages, page, user_list), 'num_results':response.numFound, 'date':datetime.datetime.utcnow().strftime('%B %e, %Y') })
def handle(request): user, redirect = codejar.actions.handleSecurity(request, 'user') if not user: return redirect format = dataplus.dictGetSafeVal(request.REQUEST, 'format', '') if not format in ('doc', 'html'): raise Http404 return codejar.user.downloadResume(user, format)
def handle(request): if codejar.auth.getLoggedInAccount(request): codejar.auth.logout(request) if request.method == 'GET': redirect = codejar.actions.redirectIfLoggedIn(request) if redirect: return redirect last_login = dataplus.dictGetSafeVal(request.COOKIES, 'last_login', '') return codejar.actions.render(request, 'login.htm', {'last_login': last_login}) elif request.method == 'POST': email = dataplus.dictGetSafeVal(request.REQUEST, 'email', '') password = dataplus.dictGetSafeVal(request.REQUEST, 'password', '') response = codejar.auth.login(request, email, password) return codejar.actions.addCookieToResponse(response, 'last_login', email)
def handle(request): rec, redirect = codejar.actions.handleSecurity(request, 'recruiter') if not rec: return redirect recruiter_data = models.RecruiterData.objects.filter(recruiter=rec)[0] remaining_invites = recruiter_data.num_invites if request.method == 'GET': if remaining_invites == 0: eventnotifier.sendEventNotification('Recruiter %s with Id %s, has exhausted his invites' % (rec.name, rec.id)) html, msg = getHTML(remaining_invites) return codejar.actions.render(request, 'recruiters/invites.htm', {'invite_message': msg, 'email_boxes_html': html}) elif request.method == 'POST': emails = [] if dataplus.dictGetSafeVal(request.REQUEST, 'email1'): emails.append(dataplus.dictGetSafeVal(request.REQUEST, 'email1').strip()) if dataplus.dictGetSafeVal(request.REQUEST, 'email2'): emails.append(dataplus.dictGetSafeVal(request.REQUEST, 'email2').strip()) if dataplus.dictGetSafeVal(request.REQUEST, 'email3'): emails.append(dataplus.dictGetSafeVal(request.REQUEST, 'email3').strip()) if dataplus.dictGetSafeVal(request.REQUEST, 'email4'): emails.append(dataplus.dictGetSafeVal(request.REQUEST, 'email4').strip()) if dataplus.dictGetSafeVal(request.REQUEST, 'email5'): emails.append(dataplus.dictGetSafeVal(request.REQUEST, 'email5').strip()) if remaining_invites < 5: emails = emails[:remaining_invites] for email in emails: parameters = {'from': rec.name, 'token':models.Token.getNew(rec.account.id, email, 'Invites')} mailer.sendRecruiterInvites(email, parameters) eventnotifier.sendEventNotification('Recruiter %s(%s) has invited "%s"' % (rec.name, rec.email, email)) remaining_invites = remaining_invites - len(emails) recruiter_data.num_invites = remaining_invites recruiter_data.save() if remaining_invites <= 0: eventnotifier.sendEventNotification('Recruiter %s with Id %s, has exhausted his invites' % (rec.name, rec.id)) html, msg = getHTML(remaining_invites) return codejar.actions.render(request, 'recruiters/invites.htm', {'flash_alerts':['Invites have been sent. ' + msg], 'email_boxes_html': html})
def handle(request): if request.method == 'GET': return codejar.actions.render(request, 'tellfriends.htm') elif request.method == 'POST': sender_name = dataplus.dictGetSafeVal(request.REQUEST, 'name') emails = [] emails[len(emails):] = dataplus.dictGetSafeVal(request.REQUEST, 'email1', '').split(',') emails[len(emails):] = dataplus.dictGetSafeVal(request.REQUEST, 'email2', '').split(',') emails[len(emails):] = dataplus.dictGetSafeVal(request.REQUEST, 'email3', '').split(',') message = dataplus.dictGetSafeVal(request.REQUEST, 'messageBox') valid_emails = [eml for eml in emails if eml != ''] if sender_name and valid_emails and message: ip_address = request.META['REMOTE_ADDR'] sent_count = getSentRequestCount(ip_address) send_max = 6 - sent_count if send_max < 0: send_max = 0 requests = [] for email_id in valid_emails: fr = models.TellFriend(sender_name=sender_name, receiver_email=email_id, message=message, ip_address=ip_address) fr.save() requests.append(fr) subject = 'New Tell Friends Request' if send_max < len(valid_emails): subject += ": Require verification" event_desc = "Sender: %s\nReceiver(s): %s\nMessage: %s" % (sender_name, string.join(valid_emails, ','), message) eventnotifier.sendEventNotification(subject, event_desc) for req in requests[:send_max]: mailer.sendInviteFriend(req) req.sent = True req.save() return HttpResponseRedirect('toldfriends.html') else: return HttpResponse('Gimme some valid data :(')
def handle(request): if request.method == 'GET': return codejar.actions.render(request, 'signup.htm') elif request.method == 'POST': name = dataplus.dictGetSafeVal(request.REQUEST, 'name', '').strip() email = dataplus.dictGetSafeVal(request.REQUEST, 'email', '').strip() password = dataplus.dictGetSafeVal(request.REQUEST, 'password', '').strip() password2 = dataplus.dictGetSafeVal(request.REQUEST, 'password2', '').strip() telephone = dataplus.dictGetSafeVal(request.REQUEST, 'telephone', '').strip() errors = validateSignup(name, email, password, password2, telephone) if not errors and dataplus.returnIfExists(models.Account.objects.filter(username=email)): errors.append('You already have an account with the same email.') if errors: return codejar.actions.render(request, 'signup.htm', {'name':name, 'email':email, 'telephone':telephone, 'flash_alerts':errors}) else: user = codejar.user.addPremiumUser(name, email, password, telephone) return codejar.auth.login(request, email, password)
def handle(request): rec, redirect = codejar.actions.handleSecurity(request, 'recruiter') if not rec: return redirect email_list = dataplus.dictGetSafeVal(request.REQUEST, 'email_list', '') email_query = dataplus.dictGetSafeVal(request.REQUEST, 'email_query', '') if email_query: search_keywords, experience, location, max_salary = cPickle.loads( base64.b64decode(email_query)) response = search_helper.matchResumes(search_keywords, experience, location, max_salary, datetime.datetime(1981, 1, 9)) email_list = dataplus.decode( string.join([usr['email'] for usr in response.results], '; ')) action = dataplus.dictGetSafeVal(request.REQUEST, 'action', '') if action == 'show_form': return codejar.actions.render(request, 'recruiters/emailusers.htm', { 'to_list': email_list, 'recruiter': rec }) elif action == 'email_users': subject = dataplus.dictGetSafeVal(request.REQUEST, 'subject', '') message = dataplus.dictGetSafeVal(request.REQUEST, 'message', '') message += '<p> </p><div style="border-bottom: 1px solid rgb(153, 153, 153);"></div><p>This email has been sent by %s(%s) of %s using <a href="http://www.jobhunt.in">www.jobhunt.in</a> services.</p>' % ( rec.name, rec.email, rec.organization) mailman.sendMail(rec.name + '<*****@*****.**>', email_list.split(';'), subject, message, reply_to=rec.email) eventnotifier.sendEventNotification("New Recruiter Mass Mail: " + subject + " - " + rec.name + "(" + rec.email + ")" + " message:\n" + message) return HttpResponseRedirect('dashboard.htm?flashId=email_sent')
def handle(request): try: rec = codejar.auth.getLoggedInRecruiter(request) if rec: user_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') user = dataplus.returnIfExists(models.User.objects.filter(key=user_key)) notifications.addNotification(user.id, 'ResumeRequest', data={'recruiter_id':rec.id}) return codejar.ajaxian.getSuccessResp('') else: return codejar.ajaxian.getFailureResp('not_logged_in') except: return codejar.ajaxian.getFailureResp('')
def handle(request): token_value = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') if token_value: token = dataplus.returnIfExists( models.Token.objects.filter(value=token_value)) if not token: return HttpResponseRedirect('/?flashId=malformed_url') if request.method == 'GET': return codejar.actions.render(request, 'recruiters/signup.htm', {'token': token}) elif request.method == 'POST': name = dataplus.dictGetSafeVal(request.REQUEST, 'name', '').strip() email = dataplus.dictGetSafeVal(request.REQUEST, 'email', '').strip() password = dataplus.dictGetSafeVal(request.REQUEST, 'password', '').strip() password2 = dataplus.dictGetSafeVal(request.REQUEST, 'password2', '').strip() organization = dataplus.dictGetSafeVal(request.REQUEST, 'organization', '').strip() telephone = dataplus.dictGetSafeVal(request.REQUEST, 'telephone', '').strip() errors = validateSignup(name, email, password, password2, telephone, organization) if not errors and dataplus.returnIfExists( models.Account.objects.filter(username=email)): errors.append('You already have an account with the same email.') if errors: return codejar.actions.render( request, 'recruiters/signup.htm', { 'name': name, 'email': email, 'organization': organization, 'telephone': telephone, 'flash_alerts': errors }) email_verified = (email == token.tag) rec = addRecruiter(email, password, name, organization, telephone, token, email_verified) subs = addDefaultSubscriptions(rec) #send activation email if sign up is not through an invite if not (email_verified): verify_token = models.Token.getNew(str(rec.account.id), email, 'VerifyEmail') params = {'recruiter_key': verify_token} mailer.sendActivationLink(email, params) return codejar.auth.login(request, email, password)
def handle(request, account_type='user'): rec = None if account_type == 'user': user, redirect = codejar.actions.handleSecurity(request, 'user') if not user: return redirect elif account_type == 'recruiter': rec, redirect = codejar.actions.handleSecurity(request, 'recruiter') if not rec: return redirect user_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') user = dataplus.returnIfExists( models.User.objects.filter(key=user_key)) if not user: return codejar.actions.render( request, 'error.htm', { 'error_message': 'You have entered an invalid Url. Please check and try again.' }) if request.method == 'GET': pref_summary = '' #12 Lakhs, Large Companies only, in Bangalore. if user.pref_designation and user.min_salary and user.pref_location and user.pref_employment: pref_summary = '%s in %s' % (user.pref_designation, html_options.getVerboseEmploymentType( user.pref_employment)) if not user.pref_location == 'Anywhere': pref_summary += ', in ' + user.pref_location user.job_preferences = pref_summary if user.summary: user.summary_display = '<ul>\n' + reduce( lambda x, y: x + '<li>' + y + '</li>\n', user.summary.split('\n'), '') + '</ul>\n' user.min_salary_in_lakhs = user.min_salary / 100000 if rec: sub_id = dataplus.dictGetVal(request.REQUEST, 'sub_id', 0, string.atoi) notifications.addNotification(str(user.id), 'ProfViewed', data={ 'recruiter_id': rec.id, 'subscription_id': sub_id }) return codejar.actions.render(request, 'viewsummary.htm', { 'user': user, 'rec': rec }) elif request.method == 'POST': pass
def handle(request): filter_id = dataplus.dictGetSafeVal(request.REQUEST, 'filterId', '') if filter_id: resume_filter = get_object_or_404(models.RecruiterSubscription, id=filter_id) results = search_helper.matchResumes(resume_filter.keywords, resume_filter.experience, resume_filter.location, resume_filter.max_salary, resume_filter.added_on, datetime.datetime.utcnow()) return HttpResponse(str(resume_filter) + ': Results(' + str(results) + ')') else: html = '' filters = models.RecruiterSubscription.objects.all() for resume_filter in filters: response = search_helper.matchResumes(resume_filter.keywords, resume_filter.experience, resume_filter.location, resume_filter.max_salary, resume_filter.added_on, datetime.datetime(1980,10,3)) html += 'Results(' + str([result[id] for result in response.results]) + ')<br />' return HttpResponse(html)
def handle(request, format, user_key): rec, redirect = codejar.actions.handleSecurity(request, 'recruiter') if not rec: rec_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') if rec_key: rec = dataplus.returnIfExists(models.Recruiter.object.filter(key=rec_key)) if not rec: return redirect user = get_object_or_404(models.User, key=user_key) if not format in ('doc', 'html'): format = 'doc' sub_id = dataplus.dictGetVal(request.REQUEST, 'sub_id', 0) notifications.addNotification(str(user.id), 'ProfViewed', data={'recruiter_id': rec.id, 'subscription_id':sub_id}) return codejar.user.downloadResume(user, format)
def handle(request): rec = codejar.auth.getLoggedInRecruiter(request) if not rec: return HttpResponseRedirect('/login.htm') if request.method == 'GET': return codejar.actions.render(request, 'recruiters/settings.htm', {'telephone':rec.telephone}) elif request.method == 'POST': telephone = dataplus.dictGetSafeVal(request.REQUEST, 'telephone', '').strip() password = dataplus.dictGetSafeVal(request.REQUEST, 'password', '').strip() password2 = dataplus.dictGetSafeVal(request.REQUEST, 'password2', '').strip() errors = validateSignup(telephone, password, password2) if errors: flash_message = '<ul>\n' + string.join(['<li>' + x + '</li>' for x in errors], '\n') + '</ul>\n' return codejar.actions.render(request, 'recruiters/settings.htm', {'telephone':telephone, 'flash_message':flash_message}) else: if password != '' and password2 != '': rec.password = password rec.telephone = telephone rec.save() return HttpResponseRedirect('dashboard.htm')
def handle(request): if request.method in ['GET','HEAD']: role = dataplus.dictGetSafeVal(request.REQUEST, 'role', '') if role and role.find('_') > 0: role_parts = role.split('_') role_list = findSubFromList(industries, role_parts[0]) if role_list: industries['default'] = role_parts[0] if findSubFromList(role_list, role_parts[1]): role_list['default'] = role_parts[1] context=RequestContext(request) context.autoescape = False return codejar.actions.render(request, 'gallery/index.htm', {'categorization': simplejson.dumps(industries)}, context)
def handle(request): user_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') user = dataplus.returnIfExists(models.User.objects.filter(key=user_key, account__account_type='FU')) if not user: return codejar.actions.render(request, 'info.htm', {'info_header':'Resume not found', 'info_text':'This resume does not exist,<br /> or may have been deleted.'}) if request.method == 'GET': return codejar.actions.render(request, 'removeresume.htm', {'user_key':user_key}) elif request.method == 'POST': user.delete() return codejar.actions.render(request, 'info.htm', {'info_header':'Your resume has been removed', 'info_text':"""<p>To make your resume active again, just <a href="/">upload it</a><br /> or send it as an attachment to <a href="mailto:[email protected]">[email protected]</a>.</p> <p>Thank you.</p>"""})
def handle(request): if request.method == 'GET': key = dataplus.dictGetSafeVal(request.REQUEST, 'key', 'NotFound') rec_acct_id = models.Token.getOwner(key) rec = dataplus.returnIfExists(models.Recruiter.objects.filter(account__id=rec_acct_id)) if not rec: return HttpResponseRedirect('/?flashId=malformed_url') rec.account.email_verified = True rec.account.save() models.Token.remove(key) return codejar.actions.render(request, 'recruiters/emailverified.htm') elif request.method == 'POST': pass
def handle(request): try: rec = codejar.auth.getLoggedInRecruiter(request) if rec: user_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') user = dataplus.returnIfExists( models.User.objects.filter(key=user_key)) notifications.addNotification(user.id, 'ResumeRequest', data={'recruiter_id': rec.id}) return codejar.ajaxian.getSuccessResp('') else: return codejar.ajaxian.getFailureResp('not_logged_in') except: return codejar.ajaxian.getFailureResp('')
def handle(request): user = codejar.auth.getLoggedInUser(request) if not user: return codejar.ajaxian.getFailureResp('not_logged_in') section = dataplus.dictGetSafeVal(request.REQUEST, 'section', '') if section == 'jobInterest': user.is_job_hunting = dataplus.dictGetSafeVal(request.REQUEST, 'is_job_hunting', '') elif section == 'personalPref': user.curr_designation = dataplus.dictGetSafeVal( request.REQUEST, 'curr_designation', '') user.curr_employer = dataplus.dictGetSafeVal(request.REQUEST, 'curr_employer', '') user.experience = dataplus.dictGetVal(request.REQUEST, 'experience', 0, string.atoi) user.tags = dataplus.dictGetSafeVal(request.REQUEST, 'tags', '') elif section == 'jobPref': user.min_salary = dataplus.dictGetVal(request.REQUEST, 'min_salary', 0, string.atoi) user.pref_designation = dataplus.dictGetSafeVal( request.REQUEST, 'pref_designation', '') user.pref_employment = dataplus.dictGetSafeVal(request.REQUEST, 'pref_employment', '') user.pref_location = dataplus.dictGetSafeVal(request.REQUEST, 'pref_location', '') elif section == 'summary': user.summary = dataplus.dictGetSafeVal(request.REQUEST, 'summary', '') user.settings_edited = True if user.name and user.email and user.tags and user.pref_location: user.tagged = True user.save() return codejar.ajaxian.getSuccessResp(getUpdateHtml(user))
def getLoggedInAccount(request): username = dataplus.dictGetVal(request.session, 'username', '') if username: return dataplus.returnIfExists(models.Account.objects.filter(username=username)) ##Propaganda Special - if request has a valid 'rec_token' in querysting, we can login them. token_str = dataplus.dictGetSafeVal(request.REQUEST, 'rec_token', '') if token_str: rec_username = models.Token.getOwner(token_str) if rec_username: account = dataplus.returnIfExists(models.Account.objects.filter(username=rec_username, account_type='FR')) if account: request.session['username'] = account.username request.session['account_type'] = account.account_type request.session['account_state'] = account.account_state request.session['prop_login'] = True return account
def handle(request): if request.method == 'GET': key = dataplus.dictGetSafeVal(request.REQUEST, 'key', 'NotFound') rec_acct_id = models.Token.getOwner(key) rec = dataplus.returnIfExists( models.Recruiter.objects.filter(account__id=rec_acct_id)) if not rec: return HttpResponseRedirect('/?flashId=malformed_url') rec.account.email_verified = True rec.account.save() models.Token.remove(key) return codejar.actions.render(request, 'recruiters/emailverified.htm') elif request.method == 'POST': pass
def handle(request, account_type="user"): rec = None if account_type == "user": user, redirect = codejar.actions.handleSecurity(request, "user") if not user: return redirect elif account_type == "recruiter": rec, redirect = codejar.actions.handleSecurity(request, "recruiter") if not rec: return redirect user_key = dataplus.dictGetSafeVal(request.REQUEST, "key", "") user = dataplus.returnIfExists(models.User.objects.filter(key=user_key)) if not user: return codejar.actions.render( request, "error.htm", {"error_message": "You have entered an invalid Url. Please check and try again."} ) if request.method == "GET": pref_summary = "" # 12 Lakhs, Large Companies only, in Bangalore. if user.pref_designation and user.min_salary and user.pref_location and user.pref_employment: pref_summary = "%s in %s" % ( user.pref_designation, html_options.getVerboseEmploymentType(user.pref_employment), ) if not user.pref_location == "Anywhere": pref_summary += ", in " + user.pref_location user.job_preferences = pref_summary if user.summary: user.summary_display = ( "<ul>\n" + reduce(lambda x, y: x + "<li>" + y + "</li>\n", user.summary.split("\n"), "") + "</ul>\n" ) user.min_salary_in_lakhs = user.min_salary / 100000 if rec: sub_id = dataplus.dictGetVal(request.REQUEST, "sub_id", 0, string.atoi) notifications.addNotification( str(user.id), "ProfViewed", data={"recruiter_id": rec.id, "subscription_id": sub_id} ) return codejar.actions.render(request, "viewsummary.htm", {"user": user, "rec": rec}) elif request.method == "POST": pass
def handle(request, user_key): if request.method == 'GET': rec, redirect = codejar.actions.handleSecurity(request, 'recruiter') if not rec: rec_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') if rec_key: rec = dataplus.returnIfExists(models.Recruiter.object.filter(key=rec_key)) if not rec: return redirect user = get_object_or_404(models.User, key=user_key) sub_id = dataplus.dictGetVal(request.REQUEST, 'sub_id', 0) notifications.addNotification(str(user.id), 'ProfViewed', data={'recruiter_id': rec.id, 'subscription_id':sub_id}) return codejar.user.downloadResume(user, 'doc') else: #this shouldnt be happening return HttpResponseRedirect('/')
def render(request, html_file, dict=None, context=None): if not dict: dict = {} account = auth.getLoggedInAccount(request) if account: dict['login_status'] = '<div id="loginStatus">\r\n<a href="/logout.htm">logout</a><br /> <span class="small">' + account.username + '</span>\r\n</div>' else: dict['login_status'] = '<div id="loginStatus">\r\n<a href="/login.htm">login</a>\r\n</div>' alerts = [] if dict.has_key('flash_alerts'): alerts = dict['flash_alerts'] else: flash_id = dataplus.dictGetSafeVal(request.REQUEST, 'flashId','') if flash_id: alerts = [sysmessages.getFlashMessage(flash_id)] if alerts: dict['py_scripts'] = '<script type="text/javascript">\n' + string.join(map(lambda x: 'alerts.register("' + x + '");', alerts), '\n') + '\n</script>\n' if context: return render_to_response(html_file, dict, context) else: return render_to_response(html_file, dict)
def getLoggedInAccount(request): username = dataplus.dictGetVal(request.session, 'username', '') if username: return dataplus.returnIfExists( models.Account.objects.filter(username=username)) ##Propaganda Special - if request has a valid 'rec_token' in querysting, we can login them. token_str = dataplus.dictGetSafeVal(request.REQUEST, 'rec_token', '') if token_str: rec_username = models.Token.getOwner(token_str) if rec_username: account = dataplus.returnIfExists( models.Account.objects.filter(username=rec_username, account_type='FR')) if account: request.session['username'] = account.username request.session['account_type'] = account.account_type request.session['account_state'] = account.account_state request.session['prop_login'] = True return account
def handle(request): if request.method == 'GET': return codejar.actions.render(request, 'forgotpassword.htm') elif request.method == 'POST': username = dataplus.dictGetSafeVal(request.REQUEST, 'email', '') account = dataplus.returnIfExists(models.Account.objects.filter(username=username)) if account: account_detail = dataplus.returnIfExists(models.Recruiter.objects.filter(account=account)) if not account_detail: account_detail = dataplus.returnIfExists(models.User.objects.filter(account=account)) token = models.Token.getNew(str(account.id), account.username, 'ForgotPassword') params = {'account_key': token, 'path': {'FR':'/recruiters', 'PU':''}[account.account_type]} mailer.sendPasswordResetLink(username, params) return HttpResponseRedirect('?flashId=pwd_change_emailed') else: errors = [] errors.append('Please provide the email that you used to register with us.') return codejar.actions.render(request, 'forgotpassword.htm',{'flash_alerts': errors})
def render(request, html_file, dict=None, context=None): if not dict: dict = {} account = auth.getLoggedInAccount(request) if account: dict[ 'login_status'] = '<div id="loginStatus">\r\n<a href="/logout.htm">logout</a><br /> <span class="small">' + account.username + '</span>\r\n</div>' else: dict[ 'login_status'] = '<div id="loginStatus">\r\n<a href="/login.htm">login</a>\r\n</div>' alerts = [] if dict.has_key('flash_alerts'): alerts = dict['flash_alerts'] else: flash_id = dataplus.dictGetSafeVal(request.REQUEST, 'flashId', '') if flash_id: alerts = [sysmessages.getFlashMessage(flash_id)] if alerts: dict['py_scripts'] = '<script type="text/javascript">\n' + string.join( map(lambda x: 'alerts.register("' + x + '");', alerts), '\n') + '\n</script>\n' if context: return render_to_response(html_file, dict, context) else: return render_to_response(html_file, dict)
def handle(request): token_value = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') if token_value: token = dataplus.returnIfExists(models.Token.objects.filter(value=token_value)) if not token: return HttpResponseRedirect('/?flashId=malformed_url') if request.method == 'GET': return codejar.actions.render(request, 'recruiters/signup.htm' , {'token': token}) elif request.method == 'POST': name = dataplus.dictGetSafeVal(request.REQUEST, 'name', '').strip() email = dataplus.dictGetSafeVal(request.REQUEST, 'email', '').strip() password = dataplus.dictGetSafeVal(request.REQUEST, 'password', '').strip() password2 = dataplus.dictGetSafeVal(request.REQUEST, 'password2', '').strip() organization = dataplus.dictGetSafeVal(request.REQUEST, 'organization', '').strip() telephone = dataplus.dictGetSafeVal(request.REQUEST, 'telephone', '').strip() errors = validateSignup(name, email, password, password2, telephone, organization) if not errors and dataplus.returnIfExists(models.Account.objects.filter(username=email)): errors.append('You already have an account with the same email.') if errors: return codejar.actions.render(request, 'recruiters/signup.htm', {'name':name, 'email':email, 'organization':organization, 'telephone':telephone, 'flash_alerts':errors}) email_verified = (email == token.tag) rec = addRecruiter(email, password, name, organization, telephone, token, email_verified) subs = addDefaultSubscriptions(rec) #send activation email if sign up is not through an invite if not (email_verified): verify_token = models.Token.getNew(str(rec.account.id), email, 'VerifyEmail') params = {'recruiter_key':verify_token} mailer.sendActivationLink(email, params) return codejar.auth.login(request, email, password)
def handle(request): resume_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') return HttpResponseRedirect('resumeactive.htm?key='+resume_key+'&source=email')
def handle(request): resume_key = dataplus.dictGetSafeVal(request.REQUEST, 'key', '') return HttpResponseRedirect('resumeactive.htm?key=' + resume_key + '&source=email')
def handle(request): rec, redirect = codejar.actions.handleSecurity(request, 'recruiter') if not rec: return redirect recruiter_data = models.RecruiterData.objects.filter(recruiter=rec)[0] remaining_invites = recruiter_data.num_invites if request.method == 'GET': if remaining_invites == 0: eventnotifier.sendEventNotification( 'Recruiter %s with Id %s, has exhausted his invites' % (rec.name, rec.id)) html, msg = getHTML(remaining_invites) return codejar.actions.render(request, 'recruiters/invites.htm', { 'invite_message': msg, 'email_boxes_html': html }) elif request.method == 'POST': emails = [] if dataplus.dictGetSafeVal(request.REQUEST, 'email1'): emails.append( dataplus.dictGetSafeVal(request.REQUEST, 'email1').strip()) if dataplus.dictGetSafeVal(request.REQUEST, 'email2'): emails.append( dataplus.dictGetSafeVal(request.REQUEST, 'email2').strip()) if dataplus.dictGetSafeVal(request.REQUEST, 'email3'): emails.append( dataplus.dictGetSafeVal(request.REQUEST, 'email3').strip()) if dataplus.dictGetSafeVal(request.REQUEST, 'email4'): emails.append( dataplus.dictGetSafeVal(request.REQUEST, 'email4').strip()) if dataplus.dictGetSafeVal(request.REQUEST, 'email5'): emails.append( dataplus.dictGetSafeVal(request.REQUEST, 'email5').strip()) if remaining_invites < 5: emails = emails[:remaining_invites] for email in emails: parameters = { 'from': rec.name, 'token': models.Token.getNew(rec.account.id, email, 'Invites') } mailer.sendRecruiterInvites(email, parameters) eventnotifier.sendEventNotification( 'Recruiter %s(%s) has invited "%s"' % (rec.name, rec.email, email)) remaining_invites = remaining_invites - len(emails) recruiter_data.num_invites = remaining_invites recruiter_data.save() if remaining_invites <= 0: eventnotifier.sendEventNotification( 'Recruiter %s with Id %s, has exhausted his invites' % (rec.name, rec.id)) html, msg = getHTML(remaining_invites) return codejar.actions.render( request, 'recruiters/invites.htm', { 'flash_alerts': ['Invites have been sent. ' + msg], 'email_boxes_html': html })