本文整理汇总了Python中webapp.views.messages.errorscreen函数的典型用法代码示例。如果您正苦于以下问题:Python errorscreen函数的具体用法?Python errorscreen怎么用?Python errorscreen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了errorscreen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: view
def view(request):
try :
thereturn = HttpResponse('You are not authorized to view this area of the website')
loggedin, data = ttagServiceAuth(request)
if loggedin :
usertemplate = 'base_marketing.html'
follow = -1
hidebadges = True
hidefooter = True
hideproinfo = True
user_id = data["_id"]
angularapp = "ttagitMarketing"
paypal_dict = {
"business":settings.PAYPAL_RECEIVER_EMAIL,
"custom":user_id,
"item_number": request.COOKIES['access_token'],
"item_name":"Ttagit Ad Credits",
"notify_url": paths.HTTPS+request.get_host() + "/3f2cf0fe3d994fb8dfe6d8f9g2h5",
"return_url": paths.HTTPS+request.get_host() + reverse('marketing-thankyou'),
"cancel_return": paths.HTTPS+request.get_host()+ reverse('marketing'),
}
form = PayPalPaymentsForm(initial=paypal_dict)
formaction = conf.POSTBACK_ENDPOINT if not debug.DEBUG else conf.SANDBOX_POSTBACK_ENDPOINT
thereturn = render_to_response('marketing_details.html',locals(),context_instance=RequestContext(request))
return thereturn
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:28,代码来源:marketing.py
示例2: join
def join(request):
try :
thereturn = HttpResponse(mark_safe('<p>Sorry, we were not able to handle your request</p>'))
showPopup = True
if request.method == 'GET' :
loggedin, data = ttagServiceAuth(request)
if request.is_ajax() :
thereturn = render_to_response('partial_newsletter_joinform.html',locals(),context_instance=RequestContext(request))
else :
thereturn = render_to_response('newsletter_joinform.html',locals(),context_instance=RequestContext(request))
else :
form = Newsletter(request.POST)
if form.is_valid() :
news = ttagPost('/socialnetwork/save-email',{'email':form.clean_Email(),'ip_address':request.META['REMOTE_ADDR']})
# send email notification
from webapp.views.email import notifyOfNewsletterSuscribe
notifyOfNewsletterSuscribe(request, form.clean_Email())
if request.is_ajax() :
thereturn = render_to_response('partial_newsletter_joinform.html',locals(),context_instance=RequestContext(request))
else :
thereturn = render_to_response('newsletter_joinform.html',locals(),context_instance=RequestContext(request))
elif request.is_ajax() :
thereturn = render_to_response('partial_newsletter_joinform.html',locals(),context_instance=RequestContext(request))
else :
thereturn = render_to_response('newsletter_joinform.html',locals(),context_instance=RequestContext(request))
return thereturn
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:29,代码来源:newsletter.py
示例3: privacyView
def privacyView(request):
try :
loggedin, data = ttagServiceAuth(request)
return render_to_response('privacy.html', locals(), context_instance=RequestContext(request))
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:7,代码来源:signup.py
示例4: signupActivate
def signupActivate(request):
try :
showPopup = True
return render_to_response('activate.html' if not request.is_ajax() else 'partial_activate.html', locals(), context_instance=RequestContext(request))
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:7,代码来源:signup.py
示例5: userWallView
def userWallView(request, user_name, to_time=INFINITE_TIME):
try :
from webapp.views.spraycan import url
hideMiniSpraycan = True
loggedin, user, loggedin_user, follow, data = getUserVariables(request, user_name)
if '_id' in data :
partial = 'partial_spraycan_ttags.html' if request.is_ajax() and to_time != INFINITE_TIME else 'partial_user_profile_wall.html'
spraycanURL = '/'.join(['','user',data['_id'],'wall'])
request.wall_owner_id = data['_id']
request.is_wallowner = ( loggedin_user == data['_id'] )
userdetails = mark_safe(url(request=request, location=spraycanURL, location_type='wall', partial=partial, thetemplate='base_ajax.html', user_name=user_name, to_time=to_time).content)
else :
userdetails = mark_safe(render_to_response('partial_user_notfound.html',locals(),context_instance=RequestContext(request)).content)
if request.is_ajax() :
if userdetails[0:1] == '{' or to_time != INFINITE_TIME :
thereturn = HttpResponse(userdetails)
else :
usercontext = mark_safe(render_to_response('partial_user_details.html',locals(),context_instance=RequestContext(request)).content)
trueJsonReturn = simplejson.dumps({'context':usercontext,'results':userdetails})
thereturn = render_to_response('ajax_ttag_create.html',{'jsonReturn':trueJsonReturn})
else :
thereturn = userProfileView(request=request, view_type='tags', user_name=user_name, userdetails=userdetails, hideMiniSpraycan=True)
return thereturn
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:26,代码来源:user.py
示例6: hubWallView
def hubWallView(request, data_type, data_value, to_time=INFINITE_TIME):
try :
logged_in_user, hub, details = getHubDetails(request, data_type, data_value, to_time)
return assembleHubResponse(request, logged_in_user, hub, details, hideMiniSpraycan=True)
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:7,代码来源:hub.py
示例7: toggleSignin
def toggleSignin(request, data_type, data_value, user_state="USER"):
try :
thereturn = HttpResponse(mark_safe('<p>You are not authorized to access this area</p>'))
logged_in_user = get_logged_in_user(request)
if data_type == "id" :
hubid = data_value
hub = get_hub_by_id(request, hubid, logged_in_user)
if hub == None:
thereturn = assembleHubErrorResponse(request, "Sorry that Hub was not found")
elif hub.creater_id != logged_in_user.user_id :
thereturn = assembleHubErrorResponse(request, "Sorry, you don't have permission to edit this Hub's settings")
else :
updated = logged_in_user.updateState(request, user_state, hubid if user_state == 'HUB' else logged_in_user.user_id)
if updated == True and not request.is_ajax() :
thereturn = HttpResponseRedirect(request.META['HTTP_REFERER'])
elif updated == True :
loggedin = logged_in_user.is_logged_in
request.logged_in_user = logged_in_user
data = logged_in_user
jsonReturn = simplejson.dumps({
'headerOuter': mark_safe(render_to_response('partial_user_dashboard.html',locals(),context_instance=RequestContext(request)).content),
'spraycanForm': mark_safe(render_to_response('partial_spraycan_form.html',locals(),context_instance=RequestContext(request)).content)
})
thereturn = render_to_response('ajax_ttag_create.html',locals(),context_instance=RequestContext(request))
else :
thereturn = assembleHubErrorResponse(request, updated)
return thereturn
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:30,代码来源:hub.py
示例8: hubMembersView
def hubMembersView(request, data_type, data_value):
try :
logged_in_user = get_current_user(request)
if data_type == "id" :
hubid = data_value
hub = get_hub_by_id(request, hubid, logged_in_user)
if hub == None:
return assembleHubErrorResponse(request, "Sorry that Hub was not found")
memberNames = hub.get_hub_member_names(request)
members = [get_user_by_name(request, userName) for userName in memberNames]
members = [username for username in members if username != False]
details = render_to_response("partial_hub_profile_members.html",
{
"current_user": logged_in_user,
"members": members,
"request": request,
"payload": {"hub": hub},
"logged_in_user": logged_in_user.user_id
},
context_instance=RequestContext(request))
return assembleHubResponse(request, logged_in_user, hub, details,
hideMiniSpraycan = (not logged_in_user.is_logged_in))
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:25,代码来源:hub.py
示例9: delete
def delete(request, data_type, data_value):
try :
thereturn = loginscreen(request)
loggedin, user, loggedin_user, follow, data = getUserVariables(request, '')
if loggedin :
user_name = user['user_name']
if data_type == 'id' :
hub_id = data_value
respHub = ttagGetHubByHubId(hub_id)
#print respHub
if respHub['result'] == 'OK' and respHub['data']['hub']['user']['user_id'] == loggedin_user :
if not request.POST :
hub = respHub['data']['hub']
thereturn = render_to_response('partial_userhub_confirmdelete.html',locals(),context_instance=RequestContext(request))
else :
if 'hub_id' in locals() :
response = ttagDeleteHub(loggedin_user, request.COOKIES['access_token'], hub_id)
if request.is_ajax() :
thereturn = HttpResponse(mark_safe('<article class="deleted">Hub deleted</article>'))
else :
thereturn = HttpResponseRedirect(request.META['HTTP_REFERER'])
return thereturn
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:25,代码来源:userhub.py
示例10: actionJoin
def actionJoin(request, data_type, data_value, quit=False):
try :
thereturn = loginscreen(request)
user = get_logged_in_user(request)
loggedin = user and user.is_current_user
thereturn = loginscreen(request)
if loggedin:
user_id = user["_id"]
hub_id = data_value
hub = get_hub_by_id(request, hub_id, user)
access_token= request.COOKIES['access_token']
if data_type == "id":
if quit:
response = ttagQuitJoinedHub(user_id, access_token, hub_id)
else:
response = ttagJoinHub(user_id, access_token, hub_id)
else:
return custompopup(request,'<p>Hub not found</p>')
if response["result"] == "OK":
if not request.is_ajax() :
return HttpResponseRedirect(request.META['HTTP_REFERER'])
else :
hub.joined = True if not quit else False
return render_to_response('partial_hub_join.html',locals(),context_instance=RequestContext(request))
else:
return HttpResponse(response["msg"])
else:
return thereturn
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:31,代码来源:userhub.py
示例11: settingsView
def settingsView(request, popup=False):
"""Show the user settings dashboard page"""
try :
thereturn = loginscreen(request)
from webapp.views.user import getUserVariables
loggedin, user, loggedin_user, follow, data = getUserVariables(request, '')
if loggedin:
if request.method != "POST":
formdata = {'gender':'','google_map_address':'','pro_description':''}
for key in data :
formdata[key] = data[key]
else :
formdata = request.POST
form = SettingsForm(formdata)
response = ttagRequestCount(data['_id'])
if popup != False :
showPopup = True
popupPartial = "partial_"+popup+"_popup.html"
pagetitle = "ttagit - User Settings Page"
location = "Settings"
if request.is_ajax() :
from website.localsettings.paths import S3TATIC_URL
userpanel = render_to_response("partial_home_settings.html",locals(),context_instance=RequestContext(request))
userdetails = render_to_response("partial_user_details.html",locals(),context_instance=RequestContext(request))
head = render_to_response("djview_head_resources.html",{'headScripts':mark_safe('<script type="text/javascript" src="'+S3TATIC_URL+'scripts/passwordstrength.js"></script><script type="text/javascript" src="'+S3TATIC_URL+'scripts/settings.js"></script>')},context_instance=RequestContext(request))
jsonReturn = simplejson.dumps({"context":mark_safe(userdetails.content),"results":mark_safe(userpanel.content),'head':mark_safe(head.content)})
thereturn = HttpResponse(mark_safe(jsonReturn))
else :
thereturn = render_to_response('home_settings.html', locals(), context_instance=RequestContext(request))
return thereturn
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:34,代码来源:home.py
示例12: googleAuthCallback
def googleAuthCallback(request):
try :
state = request.GET.get('state')
localprint(request, state)
code= str(request.GET.get('code'))
exchangeToken_url = 'https://accounts.google.com/o/oauth2/token'
data = {'code':code, 'client_id':GOOGLE_CLIENT_ID, 'client_secret':GOOGLE_CLIENT_SECRET, 'redirect_uri':GOOGLE_CALLBACK_URL, 'grant_type':'authorization_code'}
headers = {'Content-Type':'application/x-www-form-urlencoded'}
h = httplib2.Http(ca_certs=certifi.where())
resp, content = h.request(exchangeToken_url, 'POST', headers=headers, body=urlencode(data))
exchange_token_obj = simplejson.loads(content)
localprint(request, exchange_token_obj)
response = None
if(exchange_token_obj.has_key('access_token')):
access_token = exchange_token_obj['access_token']
request.session['google_access_token'] = access_token
profile_url = 'https://www.googleapis.com/oauth2/v1/userinfo?access_token=' + access_token
h2 = httplib2.Http(ca_certs=certifi.where())
user_info_resp, user_info_content = h2.request(profile_url, 'GET')
user_info_obj = simplejson.loads(user_info_content)
localprint(request, user_info_obj)
if user_info_resp.status == 200:
if state == 'userpage':
response = genericSocialActivate('googleplus', user_info_obj['id'], request.COOKIES['access_token'], request, state) #access token has to be change to the right access_token
elif state == 'homepage' or state == 'signin':
response = genericSocialLogin('googleplus', user_info_obj['id'], user_info_obj['email'], request, access_token, state)
else:
response = signinError(request,'password', u"Sorry, the Google sign-in failed.")
return response
#return response
else:
return HttpResponse("<script>window.close();</script>")
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:35,代码来源:signin.py
示例13: forgotPasswordForm
def forgotPasswordForm(request):
try :
form = PasswordForgotForm()
captcha_error = ''
email_error = ''
RECAPTCHA_PUB_KEY = keys.RECAPTCHA_PUB_KEY
RECAPTCHA_PRIVATE_KEY = keys.RECAPTCHA_PRIVATE_KEY
if request.method == 'POST' :
form = PasswordForgotForm(request.POST)
response = captcha.submit(
request.POST.get('recaptcha_challenge_field'),
request.POST.get('recaptcha_response_field'),
RECAPTCHA_PRIVATE_KEY,
request.META['REMOTE_ADDR'],)
captcha_error = response.error_code
if ( form.is_valid() and response.is_valid ) :
service_response = ttagServiceFPValidate(form.getEmail())
if service_response['result'] == 'OK' :
request.session['reset_token'] = service_response['reset_password_token']
request.session['reset_email'] = form.getEmail()
request.session.modified = True
if request.is_ajax() :
return forgotPasswordMail(request)
return HttpResponseRedirect(paths.HTTPS+request.get_host()+'/fpmail/')
else :
email_error = "Sorry, that email wasn't found"
showPopup = True
return render_to_response('partial_forgotform.html' if request.is_ajax() else 'forgotform.html', locals(), context_instance=RequestContext(request))
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:31,代码来源:password.py
示例14: userFavorite
def userFavorite(request):
try :
authed, user = ttagServiceAuth(request)
thereturn = loginscreen(request)
if authed and 'favorite_id' in request.POST :
thereturn = custompopup(request,'<p>Could not complete request</p>')
form = Favorite(request.POST)
if form.is_valid() :
access_token = request.COOKIES['access_token']
faves = ttagRequestLists(user['_id'])
id = ''
if faves['data']['favorites'] :
for item in faves['data']['favorites'] :
if 'favorite_id' in item and item['favorite_id'] == form.getFavorite_Id() and item['favorite_type'] == form.getFavorite_Type() :
id = item['_id']
break;
postData = {'access_token': access_token, 'user_id': user['_id'], 'type': form.getFavorite_Type()}
postURL = "/action/favorite"
if len(id) == 0 :
postData['favorite_id'] = form.getFavorite_Id()
postData['values'] = {'title': form.getFavorite_Title(), 'category': form.getFavorite_Category(), 'description': form.getFavorite_Description()}
else :
postData['id'] = id
postURL = "/action/unfavorite"
response = ttagPost(postURL,postData)
if request.is_ajax() :
thereturn = render_to_response("follow_ajax.html",{'request': request, 'response': response, 'id': id}, context_instance=RequestContext(request))
else :
thereturn = HttpResponseRedirect(request.META['HTTP_REFERER'])
else :
thereturn = custompopup(request,'<p>'+str(form.errors)+'</p>')
return thereturn
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:35,代码来源:user.py
示例15: listCreated
def listCreated(request, user_name):
try :
thereturn = custompopup(request,'<p>Sorry, we were unable to display this page.</p>')
loggedin, user, loggedin_user, follow, data = getUserVariables(request, user_name)
logged_in_user = get_logged_in_user(request)
request_user = get_user_by_name(request, user_name)
if request_user != False :
hubs = get_hubs_by_user(request, request_user)
if len(hubs) == 0 :
if loggedin and user_name == user['user_name'] :
thereturn = render_to_response('partial_user_nocreatedhubsmyself.html',locals(),context_instance=RequestContext(request))
else :
thereturn = render_to_response('partial_user_nocreatedhubs.html',locals(),context_instance=RequestContext(request))
else :
response = {'data': {'hubs': hubs }}
if loggedin :
from webapp.views.user import getUserHubs
response['data']['joinedhubs'] = getUserHubs(user['user_name'])
if user_name == user['user_name'] :
response['data']['createdhubs'] = [hub.hub_id for hub in response['data']['hubs']]
thereturn = render_to_response('partial_user_createdhubs.html',locals(),context_instance=RequestContext(request))
return thereturn
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:25,代码来源:userhub.py
示例16: userSettingsView
def userSettingsView(request):
try :
authed, data = ttagServiceAuth(request)
if authed:
if request.method != "POST":
formdata = {'gender':'','google_map_address':'','pro_description':''}
for key in data :
formdata[key] = data[key]
else :
formdata = request.POST
form = SettingsForm(formdata)
context = dict()
context['form'] = form
context['data'] = data
#localprint(request, data)
context['loggedin'] = True
context['loggedin_user'] = data['_id']
context['request'] = request
context['pagetitle'] = "ttagit - User Settings Page"
return render_to_response('user_settings_details.html', context, context_instance=RequestContext(request))
else:
## user is not logged in
return HttpResponseRedirect(paths.HTTPS+request.get_host()+'/index/')
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:26,代码来源:usersettings.py
示例17: ttagRemove
def ttagRemove(request, ttag_id):
try:
thereturn = loginscreen(request)
authed, user = ttagServiceAuth(request)
if authed:
if request.method == "POST":
response = ttagPost(
"/user-data/remove-ttag",
{"ttag_id": ttag_id, "user_id": user["_id"], "access_token": request.COOKIES["access_token"]},
)
location = request.POST["location"]
if request.is_ajax():
thereturn = HttpResponse(mark_safe('<article class="deleted">Ttag deleted</article>'))
else:
thereturn = HttpResponseRedirect(location)
else:
location = request.META["HTTP_REFERER"] if "location" not in request.GET else request.GET["location"]
user_name = user["user_name"]
thereturn = render_to_response(
"partial_ttag_confirmdelete.html", locals(), context_instance=RequestContext(request)
)
return thereturn
except:
logger = logging.getLogger(__name__)
return errorscreen(request, logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:25,代码来源:ttag.py
示例18: ttagLink
def ttagLink(request, ttag_id):
try:
response = ttagPost("/find/ttag", {"ttag_id": ttag_id})
theReturn = custompopup(request, "<p>Sorry, we failed to find that ttag!</p>")
if "result" in response and response["result"] == "OK":
ttag = response["data"]["ttag"]
if ttag["location_type"] == "wall":
theReturn = HttpResponseRedirect(ttag["location"])
elif ttag["location_type"] == "URL":
theReturn = HttpResponseRedirect(
paths.HTTPS
+ request.get_host()
+ reverse("spraycan-url")
+ "?location="
+ urlquote_plus(ttag["location"])
)
elif ttag["location_type"] == "HUB":
hubid = ttag["location"].split("#")[0]
theReturn = HttpResponseRedirect(
paths.HTTPS + request.get_host() + reverse("hub-wall", args=("id/", hubid))
)
return theReturn
except:
logger = logging.getLogger(__name__)
return errorscreen(request, logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:25,代码来源:ttag.py
示例19: urlOlder
def urlOlder(request, to_time):
try :
partial = 'partial_spraycan_ttags.html' if request.is_ajax() else 'spraycan.html'
return url(request=request, partial=partial, to_time=to_time)
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:7,代码来源:spraycan.py
示例20: userDelete
def userDelete(request):
try :
response = loginscreen(request)
loggedin, data = ttagServiceAuth(request)
if loggedin :
access_token = request.COOKIES['access_token']
if request.method == 'GET' :
pagetitle = 'TTAGIT - User Account Delete Request Confirmation'
showPopup = True
response = render_to_response('user_confirmdelete.html' if not request.is_ajax() else 'partial_user_confirmdelete.html', locals(), context_instance=RequestContext(request))
else :
json_obj = ttagServiceAccountDelete(access_token)
if json_obj['result'] == 'OK' :
response = custompopup(request,'<p>Your Acccount was deleted</p>', reverse('index-page'))
request.COOKIES['access_token'] = ''
else :
response = custompopup(request,'<p>Your Account was not deleted</p>')
return response
# only during development!!!
# elif 'user_name' in request.GET :
# ttagPost('/delete-user',{'user_name':request.GET['user_name']})
# response = HttpResponse('Your Account was deleted')
# elif 'email' in request.GET :
# ttagPost('/delete-user',{'email':request.GET['email']})
# response = HttpResponse('Your Account was deleted')
return response
except :
logger=logging.getLogger(__name__)
return errorscreen(request,logger, sys)
开发者ID:ttagit,项目名称:website,代码行数:29,代码来源:user.py
注:本文中的webapp.views.messages.errorscreen函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论