forked from ScoDoc/DocScoDoc
enhance request compat
This commit is contained in:
parent
f177e777a9
commit
7c1263060e
@ -48,6 +48,7 @@ class ZRequest(object):
|
||||
self.QUERY_STRING = request.query_string.encode("utf-8")
|
||||
self.REQUEST_METHOD = request.method.encode("utf-8")
|
||||
self.AUTHENTICATED_USER = current_user
|
||||
self.REMOTE_ADDR = request.remote_addr
|
||||
if request.method == "POST":
|
||||
self.form = request.form # xxx encode en utf-8 !
|
||||
# Encode en utf-8 pour ScoDoc8 #sco8
|
||||
|
@ -129,7 +129,6 @@ class DummyRequest:
|
||||
self.URL = "http://scodoc/"
|
||||
self.URL0 = self.URL
|
||||
self.BASE0 = "localhost"
|
||||
self.REMOTE_HOST = "localhost"
|
||||
self.REMOTE_ADDR = "127.0.0.1"
|
||||
self.HTTP_REFERER = ""
|
||||
self.REQUEST_METHOD = "get"
|
||||
|
@ -1148,7 +1148,8 @@ def evaluation_create_form(
|
||||
+ "Modification évaluation impossible pour %s"
|
||||
% scu.get_current_user_name(REQUEST)
|
||||
+ "</p>"
|
||||
+ '<p><a href="%s">Revenir</a></p>' % (str(REQUEST.HTTP_REFERER),)
|
||||
+ '<p><a href="moduleimpl_status?moduleimpl_id=%s">Revenir</a></p>'
|
||||
% (moduleimpl_id,)
|
||||
+ html_sco_header.sco_footer(context, REQUEST)
|
||||
)
|
||||
if readonly:
|
||||
|
@ -42,18 +42,17 @@ def logdb(REQUEST=None, cnx=None, method=None, etudid=None, msg=None, commit=Tru
|
||||
args = {
|
||||
"authenticated_user": str(REQUEST.AUTHENTICATED_USER),
|
||||
"remote_addr": REQUEST.REMOTE_ADDR,
|
||||
"remote_host": REQUEST.REMOTE_HOST,
|
||||
}
|
||||
else:
|
||||
args = {"authenticated_user": None, "remote_addr": None, "remote_host": None}
|
||||
args = {"authenticated_user": None, "remote_addr": None}
|
||||
args.update({"method": method, "etudid": etudid, "msg": msg})
|
||||
ndb.quote_dict(args)
|
||||
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
||||
cursor.execute(
|
||||
"""INSERT INTO scolog
|
||||
(authenticated_user,remote_addr,remote_host,method,etudid,msg)
|
||||
(authenticated_user,remote_addr,method,etudid,msg)
|
||||
VALUES
|
||||
(%(authenticated_user)s,%(remote_addr)s,%(remote_host)s,%(method)s,%(etudid)s,%(msg)s)""",
|
||||
(%(authenticated_user)s,%(remote_addr)s,%(method)s,%(etudid)s,%(msg)s)""",
|
||||
args,
|
||||
)
|
||||
if commit:
|
||||
|
@ -959,8 +959,7 @@ def EtatAbsencesDate(
|
||||
else:
|
||||
H.append(
|
||||
"""<h2>Erreur: vous n'avez pas choisi de date !</h2>
|
||||
<a class="stdlink" href="%s">Continuer</a>"""
|
||||
% REQUEST.HTTP_REFERER
|
||||
"""
|
||||
)
|
||||
|
||||
return "\n".join(H) + html_sco_header.sco_footer(REQUEST)
|
||||
|
Loading…
Reference in New Issue
Block a user