本文整理汇总了Python中tg.lurl函数的典型用法代码示例。如果您正苦于以下问题:Python lurl函数的具体用法?Python lurl怎么用?Python lurl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lurl函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: deleteProject
def deleteProject(self, came_from=lurl('/'), *args, **kw):
reload(sys).setdefaultencoding("utf-8");
self.success = True;
self.message = "success";
self.df = json.loads(request.body, encoding=request.charset);
self.idProject = self.df.get('id_question_project');
self.listQuestion = model.Question.getByProjectId(self.idProject);
self.listQuestionGroup = model.QuestionGroup.getByProject(self.idProject);
for questionGroup in self.listQuestionGroup:
#remove sur_map_question_group
model.MapQuestionGroup.deleteByQuestionGroup(questionGroup.id_question_group)
#remove question_group
model.QuestionGroup.delete(questionGroup)
del questionGroup
for self.question in self.listQuestion:
if(self.question):
self.idQuestion = self.question.id_question;
model.Question.deleteQuestoin(self.idQuestion);
model.QuestionProject.deleteById(self.idProject);
return dict(success=self.success, message = self.message);
开发者ID:tongpa,项目名称:PollSurveyWeb,代码行数:28,代码来源:surveycontroller.py
示例2: post_login
def post_login(self, came_from=lurl('/')):
"""
Redirect the user to the initially requested page on successful
authentication or redirect her back to the login page if login failed.
"""
if not request.identity:
login_counter = request.environ.get('repoze.who.logins', 0) + 1
redirect('/login',
params=dict(came_from=came_from, __logins=login_counter))
userid = request.identity['repoze.who.userid']
flash(_('Welcome back, %s!') % userid)
if predicates.has_permission('manage'):
redirect(came_from)
else:
redirect(lurl('/graphs/'))
开发者ID:csmall,项目名称:rnms,代码行数:16,代码来源:root.py
示例3: index
def index(self, id=0, ready="no", came_from=lurl("/")):
reload(sys).setdefaultencoding("utf8")
if not request.identity:
login_counter = request.environ.get("repoze.who.logins", 0) + 1
redirect("/login", params=dict(came_from=came_from, __logins=login_counter))
userid = request.identity["repoze.who.userid"]
log.info("preview id : " + str(id))
log.info("ready : " + str(ready))
self.header = ""
self.footer = ""
self.nextQuestion = ""
self.template = ""
self.questionOption = model.QuestionOption.getId(id)
if self.questionOption:
log.info("expire date : " + str(self.questionOption.expire_date))
log.info("current : " + str(datetime.now()))
if datetime.now() <= self.questionOption.expire_date:
log.info("not expire")
else:
log.info("expire")
if str(ready).lower() == "no":
# check have welcome page
if not self.utility.isEmpty(self.questionOption.welcome_message):
redirect(request.path_info + "/welcome?id=" + str(self.questionOption.id_question_option))
else:
self.template = self.questionOption.theme.template
override_template(PreviewController.index, self.template)
elif str(ready).lower() == "yes":
self.header = self.questionOption.header_message
self.footer = self.questionOption.footer_message
self.urlName = self.utility.spritValue(request.path_info, "/")
self.template = self.questionOption.theme.template
if len(self.urlName) >= 1:
self.nextQuestion = (
"/" + self.urlName[0] + "/saveQuestion" + "?id=" + str(self.questionOption.id_question_option)
)
if self.template is not None and len(self.template) > 0:
log.info("template used : %s", self.template)
override_template(PreviewController.index, self.template)
# print 'idproject : ', id;
return dict(
page="view",
header=self.header,
footer=self.footer,
action=self.nextQuestion,
template=self.template,
urldata=self.URL_GETDATAQUESTION.format(id),
idproject=id,
shownavigator=bool(self.questionOption.show_navigator),
idresp="",
)
开发者ID:tongpa,项目名称:PollSurveyWeb,代码行数:60,代码来源:previewcontroller1.py
示例4: post_logout
def post_logout(self, came_from=lurl('/')):
"""
Redirect the user to the initially requested page on logout and say
goodbye as well.
"""
flash(_('Successfully logged out. We hope to see you soon!'))
redirect(came_from)
开发者ID:lebouquetin,项目名称:tracim,代码行数:7,代码来源:root.py
示例5: index_old
def index_old(self, came_from=lurl('/')):
#print request.scheme + '://';
#hooks.notify('tgext.pylogservice.startup' )
#hooks.notify('tgext.pyutilservice.startup')
return dict(page='metronic')
开发者ID:tongpa,项目名称:PollSurveyWeb,代码行数:7,代码来源:root.py
示例6: post_logout
def post_logout(self, came_from=lurl('/'), *args, **kwargs):
"""
Redirect the user to the initially requested page on logout and say
goodbye as well.
"""
flash(_('We hope to see you soon!'))
return HTTPFound(location=str(came_from))
开发者ID:Ayutac,项目名称:SAUCE,代码行数:7,代码来源:root.py
示例7: _default
def _default(self, came_from=lurl('/')):
id = came_from
station_details = self._s.getDetails(id)
#print "ID::" + str(station_details)
return dict(page='station',
d = station_details)
开发者ID:preinh,项目名称:tg2teste,代码行数:6,代码来源:stations.py
示例8: welcome
def welcome(self, id=0, came_from=lurl("/")):
reload(sys).setdefaultencoding("utf8")
if not request.identity:
login_counter = request.environ.get("repoze.who.logins", 0) + 1
redirect("/login", params=dict(came_from=came_from, __logins=login_counter))
userid = request.identity["repoze.who.userid"]
log.info("preview id : " + str(id))
self.welcome_message = ""
self.questionOption = model.QuestionOption.getId(id)
if self.questionOption:
if datetime.now() <= self.questionOption.expire_date:
log.info("not expire")
else:
log.info("expire")
self.welcome_message = self.questionOption.welcome_message
self.nextQuestion = ""
self.urlName = self.utility.spritValue(request.path_info, "/")
if len(self.urlName) >= 1:
self.nextQuestion = "/" + self.urlName[0] + "?id=" + str(self.questionOption.id_question_option)
return dict(page="view", ready="yes", welcome_message=self.welcome_message, nextQuestion=self.nextQuestion)
开发者ID:tongpa,项目名称:PollSurveyWeb,代码行数:27,代码来源:previewcontroller1.py
示例9: saveQuestion
def saveQuestion(self, id=0, came_from=lurl("/"), *args, **kw):
reload(sys).setdefaultencoding("utf-8")
if not request.identity:
login_counter = request.environ.get("repoze.who.logins", 0) + 1
redirect("/login", params=dict(came_from=came_from, __logins=login_counter))
userid = request.identity["repoze.who.userid"]
self.success = True
self.message = "success"
self.goodbye_message = ""
self.nextQuestion = ""
self.questionOption = model.QuestionOption.getId(id)
if self.questionOption:
self.goodbye_message = self.questionOption.end_message
self.urlRedirect = self.questionOption.redirect_url
return dict(
page="goodbye",
success=self.success,
message=self.message,
goodbye=self.goodbye_message,
nextQuestion=self.nextQuestion,
urlRedirect=self.urlRedirect,
)
开发者ID:tongpa,项目名称:PollSurveyWeb,代码行数:26,代码来源:previewcontroller1.py
示例10: put
def put(self, current_password, new_password1, new_password2):
if not tg.config.get('auth_is_internal'):
raise HTTPForbidden()
# FIXME - Allow only self password or operation for managers
current_user = tmpl_context.current_user
redirect_url = tg.lurl('/home')
if not current_password or not new_password1 or not new_password2:
tg.flash(_('Empty password is not allowed.'))
tg.redirect(redirect_url)
if current_user.validate_password(current_password) is False:
tg.flash(_('The current password you typed is wrong'))
tg.redirect(redirect_url)
if new_password1!=new_password2:
tg.flash(_('New passwords do not match.'))
tg.redirect(redirect_url)
current_user.password = new_password1
pm.DBSession.flush()
tg.flash(_('Your password has been changed'))
tg.redirect(redirect_url)
开发者ID:lebouquetin,项目名称:tracim,代码行数:26,代码来源:user.py
示例11: login
def login(self, came_from=lurl('/')):
"""Start the user login."""
login_counter = request.environ['repoze.who.logins']
if login_counter > 0:
flash(_('Wrong credentials'), 'warning')
return dict(page='login', login_counter=str(login_counter),
came_from=came_from)
开发者ID:Rabenvald,项目名称:WebBot,代码行数:7,代码来源:root.py
示例12: index
def index(self, came_from=lurl('/'), **kw):
validation_status = request.validation
from formencode import validators
errors = validation_status['errors']
print errors
return dict(page='support', login_counter=str(1),came_from=came_from)
开发者ID:tongpa,项目名称:PollSurveyWeb,代码行数:7,代码来源:examplecontroller.py
示例13: thankyou
def thankyou(self,key=0,came_from=lurl('/')):
reload(sys).setdefaultencoding("utf-8");
log.info('thankyou preview id : %s' %str(key));
self.isRedirect = True
self.goodbye = '';
self.nextQuestion = '';
self.urlRedirect = '';
self.showScore = False
self.respondents = model.Respondents.getByKey(keyGen=key);
if(self.respondents):
self.urlName = self.utility.spritValue(request.path_info,'/');
log.info( "path %s" %self.urlName)
self.questionOption = self.respondents.question_option
if self.questionOption :
self.goodbye= self.questionOption.end_message
self.showScore = self.utility.convertToBool(self.questionOption.show_score)
self.urlRedirect = self.questionOption.redirect_url
if self.utility.convertToBool(self.respondents.redirect_other_url):
self.urlRedirect = self.questionOption.redirect_other_url
self.isRedirect = False
self.projectType = self.respondents.question_project.id_question_project_type
del self.questionOption
if self.isRedirect :
log.error("find not found respondent with key %s " % str(key));
redirect(self.urlUtility.URL_EXPIRED) ;
return dict(page='goodbye', ready = 'yes',goodbye = Markdown(self.goodbye).convert(),nextQuestion = self.nextQuestion ,urlRedirect= self.urlRedirect,
showScore = self.showScore ,projectType = self.projectType,imageId = self.respondents.id_respondents);
开发者ID:tongpa,项目名称:PollSurveyWeb,代码行数:33,代码来源:answerquestioncontroller.py
示例14: welcome
def welcome(self,key=0,came_from=lurl('/')):
reload(sys).setdefaultencoding("utf-8");
log.info('preview id : ' + str(key));
self.respondents = model.Respondents.getByKey(key);
#self.idProject,self.idPublic,self.idVoter,self.redirect = self.__checkExpire(id);
if (self.respondents):
self.welcome_message = '';
self.questionOption,self.redirect = self.__checkOptionExpired(self.respondents.id_question_option);
self.welcome_message= self.questionOption.welcome_message;
self.nextQuestion = '';
self.urlName = self.utility.spritValue(request.path_info,'/');
if(len(self.urlName) >= 1 ) :
#self.nextQuestion = '/' + self.urlName[0]+ '?id='+ str(self.questionOption.id_question_option);
#self.nextQuestion = '/' + 'ans/reply/'+ str(self.questionOption.id_question_option);
#self.nextQuestion = self.URL_REPLY.format(id)
self.nextQuestion = self.urlUtility.URL_REPLY_QUESTIONNAIRE.format(key=str(key));
else:
log.error("find not found respondent with key %s ", str(key));
redirect(self.urlUtility.URL_EXPIRED) ;
#self.welcome_message
return dict(page='view', ready = 'yes',welcome_message = Markdown(self.welcome_message).convert(), nextQuestion= self.nextQuestion);
开发者ID:tongpa,项目名称:PollSurveyWeb,代码行数:32,代码来源:answerquestioncontroller.py
示例15: welcome
def welcome(self,id=0,came_from=lurl('/')):
reload(sys).setdefaultencoding('utf8')
if not request.identity:
login_counter = request.environ.get('repoze.who.logins', 0) + 1
redirect('/login', params=dict(came_from=came_from, __logins=login_counter))
userid = request.identity['repoze.who.userid']
log.info('preview id : ' + str(id));
self.welcome_message = '';
self.questionOption = model.QuestionOption.getId(id);
if self.questionOption :
if datetime.now() <= self.questionOption.expire_date:
log.info('not expire');
else :
log.info('expire');
self.welcome_message= self.questionOption.welcome_message;
self.nextQuestion = '';
self.urlName = self.utility.spritValue(request.path_info,'/');
if(len(self.urlName) >= 1 ) :
self.nextQuestion = '/' + self.urlName[0]+ '?id='+ str(self.questionOption.id_question_option);
return dict(page='view', ready = 'yes',welcome_message = self.welcome_message, nextQuestion= self.nextQuestion);
开发者ID:tongpa,项目名称:PollSurveyWeb,代码行数:33,代码来源:previewcontroller.py
示例16: __init__
def __init__(self):
self.DATA_UPDATE_ALLOWED_DURATION = int(tg.config.get('content.update.allowed.duration', 0))
self.WEBSITE_TITLE = tg.config.get('website.title', 'TRACIM')
self.WEBSITE_HOME_TITLE_COLOR = tg.config.get('website.title.color', '#555')
self.WEBSITE_HOME_IMAGE_URL = tg.lurl('/assets/img/home_illustration.jpg')
self.WEBSITE_HOME_BACKGROUND_IMAGE_URL = tg.lurl('/assets/img/bg.jpg')
self.WEBSITE_BASE_URL = tg.config.get('website.base_url', '')
self.WEBSITE_HOME_TAG_LINE = tg.config.get('website.home.tag_line', '')
self.WEBSITE_SUBTITLE = tg.config.get('website.home.subtitle', '')
self.WEBSITE_HOME_BELOW_LOGIN_FORM = tg.config.get('website.home.below_login_form', '')
self.EMAIL_NOTIFICATION_FROM = tg.config.get('email.notification.from')
self.EMAIL_NOTIFICATION_CONTENT_UPDATE_TEMPLATE_HTML = tg.config.get('email.notification.content_update.template.html')
self.EMAIL_NOTIFICATION_CONTENT_UPDATE_TEMPLATE_TEXT = tg.config.get('email.notification.content_update.template.text')
self.EMAIL_NOTIFICATION_CONTENT_UPDATE_SUBJECT = tg.config.get('email.notification.content_update.subject')
self.EMAIL_NOTIFICATION_PROCESSING_MODE = tg.config.get('email.notification.processing_mode')
self.EMAIL_NOTIFICATION_ACTIVATED = asbool(tg.config.get('email.notification.activated'))
self.EMAIL_NOTIFICATION_SMTP_SERVER = tg.config.get('email.notification.smtp.server')
self.EMAIL_NOTIFICATION_SMTP_PORT = tg.config.get('email.notification.smtp.port')
self.EMAIL_NOTIFICATION_SMTP_USER = tg.config.get('email.notification.smtp.user')
self.EMAIL_NOTIFICATION_SMTP_PASSWORD = tg.config.get('email.notification.smtp.password')
self.TRACKER_JS_PATH = tg.config.get('js_tracker_path')
self.TRACKER_JS_CONTENT = self.get_tracker_js_content(self.TRACKER_JS_PATH)
self.WEBSITE_TREEVIEW_CONTENT = tg.config.get('website.treeview.content')
self.EMAIL_NOTIFICATION_NOTIFIED_EVENTS = [
ActionDescription.COMMENT,
ActionDescription.CREATION,
ActionDescription.EDITION,
ActionDescription.REVISION
]
self.EMAIL_NOTIFICATION_NOTIFIED_CONTENTS = [
ContentType.Page,
ContentType.Thread,
ContentType.File,
ContentType.Comment,
# ContentType.Folder -- Folder is skipped
]
开发者ID:DarkDare,项目名称:tracim,代码行数:47,代码来源:app_cfg.py
示例17: plug_url
def plug_url(pluggable_name, path, params=None, lazy=False):
if not params:
params = {}
if lazy:
return tg.lurl(DeferredMountPointPath(pluggable_name, path), params=params)
else:
return tg.url(DeferredMountPointPath(pluggable_name, path), params=params)
开发者ID:mbbui,项目名称:Jminee,代码行数:8,代码来源:utils.py
示例18: __call__
def __call__(self, environ, start_response):
"""Invoke the Controller"""
# TGController.__call__ dispatches to the Controller method
# the request is routed to. This routing information is
# available in environ['pylons.routes_dict']
# Fill tmpl_context with user data for convenience
request.identity = c.identity = environ.get('repoze.who.identity')
try:
request.user = request.identity.get('user')
except:
request.user = None
finally:
try:
request.permissions = request.identity.get('permissions')
except AttributeError:
request.permissions = []
request.student = request.user
request.teacher = request.user
c.user = request.user
c.student = request.user
c.teacher = request.user
request.referer = request.environ.get('HTTP_REFERER', None)
request.allowance = _allowance
# Initialize other tmpl_context variables
c.sub_menu = []
c.side_menu = []
doc_list = list([('About', lurl('/about'), 'info-sign'), None] +
list((label, lurl('/docs/' + url), 'book') for label, url in (
('Changelog', 'Changelog'),
('Roadmap', 'Roadmap'),
('Deutsche Dokumentation', 'deutsch'),
('Tips and Tricks', 'tips'),
('Test configuration', 'tests'),
)) + [None, ('Language information', '/languages', 'list-alt')])
c.doc_menu = menu_docs(doc_list)
c.event_menu = menu_events(Event.current_events(), Event.future_events(), Event.previous_events())
return super(BaseController, self).__call__(environ, start_response)
开发者ID:Ayutac,项目名称:SAUCE,代码行数:46,代码来源:base.py
示例19: login
def login(self, came_from=lurl('/courses')):
if request.environ.get('repoze.who.identity', None):
redirect("/course")
login_counter = request.environ.get('repoze.who.logins', 0)
if login_counter > 0:
flash(_('Error! Invalid username or password.'), 'warning')
return dict(page='index', login_counter=str(login_counter),
came_from=came_from)
开发者ID:zakird,项目名称:revsub,代码行数:8,代码来源:root.py
示例20: index
def index(self, came_from=lurl("/"), **kw):
validation_status = request.validation
from formencode import validators
errors = validation_status["errors"]
print errors
return dict(page="howitwork", login_counter=str(1), came_from=came_from)
开发者ID:tongpa,项目名称:PollSurveyWeb,代码行数:8,代码来源:howitworkcontroller.py
注:本文中的tg.lurl函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论