envoi de rapports de bug...
darcs-hash:20061202214729-f46e9-87e28633677416742ceee22abab710b20dba7537.gz
This commit is contained in:
parent
1c05521bd2
commit
122619c021
3 changed files with 62 additions and 34 deletions
|
@ -65,7 +65,7 @@ cherrypy.config.update({'global':{'crans_ldap':crans_ldap()}})
|
||||||
from plugins.domfilter import DOMFilter
|
from plugins.domfilter import DOMFilter
|
||||||
from plugins.templatesfilter import TemplatesFilter
|
from plugins.templatesfilter import TemplatesFilter
|
||||||
from plugins.verifdroitsfilter import VerifDroitsFilter
|
from plugins.verifdroitsfilter import VerifDroitsFilter
|
||||||
|
from crans.mail import quickSend
|
||||||
# ######################################################## #
|
# ######################################################## #
|
||||||
# SERVER #
|
# SERVER #
|
||||||
# ######################################################## #
|
# ######################################################## #
|
||||||
|
@ -106,9 +106,31 @@ class Intranet:
|
||||||
}
|
}
|
||||||
info.exposed = True
|
info.exposed = True
|
||||||
|
|
||||||
|
def send_error_repport(self, **kw):
|
||||||
|
exp = "intranet"
|
||||||
|
dest = cherrypy.config.get("mail.bugreport", "nounous@crans.org")
|
||||||
|
subject = "Rapport de Bug"
|
||||||
|
text = """
|
||||||
|
Bonsoir,
|
||||||
|
|
||||||
|
Ceci est un rapport de bug envoye depuis l'intranet.
|
||||||
|
|
||||||
|
%s
|
||||||
|
""" % "\n".join( [ "%s: %s" % (str(a), str(kw[a])) for a in kw] )
|
||||||
|
quickSend(exp, dest, subject, text)
|
||||||
|
return self.index()
|
||||||
|
|
||||||
|
send_error_repport.exposed = True
|
||||||
|
|
||||||
|
def testErreur(self):
|
||||||
|
raise Exception, "sdlfkjqmsdklj"
|
||||||
|
|
||||||
|
testErreur.exposed = True
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
return cherrypy.request.remote_addr
|
return cherrypy.request.remote_addr
|
||||||
test.exposed = True
|
test.exposed = True
|
||||||
|
|
||||||
def _cp_on_http_error(self, status, message):
|
def _cp_on_http_error(self, status, message):
|
||||||
if status==403:
|
if status==403:
|
||||||
cherrypy.response.body = {
|
cherrypy.response.body = {
|
||||||
|
@ -122,6 +144,9 @@ class Intranet:
|
||||||
'values':{'status':status, 'message':message },
|
'values':{'status':status, 'message':message },
|
||||||
'standalone':False,
|
'standalone':False,
|
||||||
}
|
}
|
||||||
|
elif status==500:
|
||||||
|
from plugins.templatesfilter import TemplatesFilter
|
||||||
|
TemplatesFilter().goWithThisDict({'template':'error', 'values':{'status':status, 'message':message }})
|
||||||
else:
|
else:
|
||||||
cherrypy._cputil._cp_on_http_error(status, message)
|
cherrypy._cputil._cp_on_http_error(status, message)
|
||||||
|
|
||||||
|
|
|
@ -62,22 +62,23 @@ class TemplatesFilter(BaseFilter):
|
||||||
|
|
||||||
return str(t)
|
return str(t)
|
||||||
|
|
||||||
|
def goWithThisDict(self, aDict):
|
||||||
|
body = aDict
|
||||||
|
bodyTemplate = self._getBodyTemplate(body)
|
||||||
|
if bodyTemplate:
|
||||||
|
templatevalues = self._getBodyNameSpace(body)
|
||||||
|
t = Template(file=bodyTemplate, searchList=[templatevalues])
|
||||||
|
body['page'] = str(t)
|
||||||
|
|
||||||
|
if not self._isStandaloneBody(body):
|
||||||
|
body = self._useMainTemplate(body)
|
||||||
|
else:
|
||||||
|
body = body["page"]
|
||||||
|
cherrypy.response.body = body
|
||||||
|
|
||||||
|
|
||||||
def beforeFinalize(self):
|
def beforeFinalize(self):
|
||||||
|
|
||||||
body = cherrypy.response.body
|
body = cherrypy.response.body
|
||||||
if isinstance(body, dict):
|
if isinstance(body, dict):
|
||||||
bodyTemplate = self._getBodyTemplate(body)
|
self.goWithThisDict(body)
|
||||||
if bodyTemplate:
|
|
||||||
templatevalues = self._getBodyNameSpace(body)
|
|
||||||
t = Template(file=bodyTemplate, searchList=[templatevalues])
|
|
||||||
body['page'] = str(t)
|
|
||||||
|
|
||||||
if not self._isStandaloneBody(body):
|
|
||||||
body = self._useMainTemplate(body)
|
|
||||||
else:
|
|
||||||
body = body["page"]
|
|
||||||
|
|
||||||
cherrypy.response.body = body
|
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,26 @@
|
||||||
<!-- img src="/static/images/petitCr@ns.png" alt="logocr@ns" / -->
|
<!-- img src="/static/images/petitCr@ns.png" alt="logocr@ns" / -->
|
||||||
<img style="float:left;clear:left;" src="/static/images/traveaux.png" alt="Traveaux" />
|
<img style="float:left;clear:left;" src="/static/images/traveaux.png" alt="Traveaux" />
|
||||||
<div style="margin-left:200px;">
|
<div style="margin-left:200px;">
|
||||||
<h1 style="clear:right; background:#ddd; width:50%; padding:10px 20px 10px 10px">Erreur $status</h1>
|
<h1 style="clear:right; background:#ddd; width:50%; padding:10px 20px 10px 10px">Erreur $status</h1>
|
||||||
<div>
|
<div style="float:left;">
|
||||||
<pre style="border:thin black dashed; padding:10px; margin:20px; float:left; color:gray;">$message</pre>
|
<form action="/send_error_repport" method="POST">
|
||||||
|
<fieldset style=""><legend>Envoyer un rapport de bug</legend>
|
||||||
|
<input type="hidden" name="status" value="$status">
|
||||||
|
<input type="hidden" name="error_message" value="$message">
|
||||||
|
<label for="user_message">Aidez-nous à améliorer l'intranet en nous indiquant comment l'erreur est apparue:</label><br />
|
||||||
|
<textarea style="width:40em;height:10em;" name="user_message"></textarea>
|
||||||
|
<div style="text-align:right;width:100%;">
|
||||||
|
<button name="send" value="oui">Envoyer le rapport et retourner à la page d'accueil</button>
|
||||||
|
<a href="/" style="display:block;clear:both;padding:.6em;">Retour à la page d'accueil</a>
|
||||||
|
</div>
|
||||||
|
#if $message
|
||||||
|
<div style="border:thin black dashed;margin:5px;">
|
||||||
|
<h3 style="margin:0;border-bottom:thin black dashed;padding:.3em;">Message d'erreur</h3>
|
||||||
|
<pre style="padding:.3em;color:gray;">$message</pre>
|
||||||
|
</div>
|
||||||
|
#end if
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form action="send_error_repport" method="POST">
|
|
||||||
<fieldset style="float:left;"><legend>Envoyer un rapport</legend>
|
|
||||||
<input type="hidden" name="status" value="$status">
|
|
||||||
<input type="hidden" name="error_message" value="$message">
|
|
||||||
<label for="user_message">Aidez-nous à améliorer l'intranet en nous indiquant comment l'erreur est apparue:</label><br />
|
|
||||||
<textarea style="width:40em;height:10em;" name="user_message"></textarea>
|
|
||||||
<div style="text-align:right;width:100%;">
|
|
||||||
<button name="send" value="oui">Envoyer le rapport et retourner à la page d'accueil</button>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
|
|
||||||
<a href="/" style="display:block;clear:both;">Retour à la page d'accueil</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="clear:both;"></div>
|
<div style="clear:both;"></div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue