Permalink
Browse files

modifications from http://github.com/davisagli/Arecibo-Clients/commits/

  • Loading branch information...
1 parent 48211f4 commit ba35e5aeba08247de3b75a4dd8056ad4a4b79b4d Andy McKay committed Jun 9, 2010
Showing with 24 additions and 16 deletions.
  1. +8 −0 CONTRIBUTORS
  2. +16 −16 clients/plone/clearwind.arecibo/clearwind/arecibo/wrapper.py
View
@@ -0,0 +1,8 @@
+Most of the code and hence blame is by:
+
+ Andy McKay (Clearwind Consulting)
+
+Contributions from:
+
+ Chris Adams (http://github.com/acdha)
+ David Glick (http://github.com/davisagli)
@@ -1,5 +1,5 @@
import sys
-import os
+import os
from lib.arecibo import post, postaddress
from App.config import getConfiguration
from AccessControl import getSecurityManager
@@ -14,14 +14,14 @@
'PATH_INFO', 'QUERY_STRING', 'REQUEST_METHOD', 'SCRIPT_NAME', \
'SERVER_NAME', 'SERVER_PORT', 'SERVER_PROTOCOL', 'SERVER_SOFTWARE']
-try:
- import site_configuation
+try:
+ import site_configuration
from site_configuration import config
- log("Arecibo configuration read from: %s" % os.path.abspath(site_configuration.__file__))
-except:
- # please don't override this here, look in site_configuration.py for a chance to
+ log.info("Arecibo configuration read from: %s" % os.path.abspath(site_configuration.__file__))
+except:
+ # please don't override this here, look in site_configuration.py for a chance to
# overload this, details are there too
- config = {
+ config = {
"account": "",
"transport": "http",
"priorities": {
@@ -51,19 +51,19 @@ def arecibo(context, **kw):
cfg = get(context)
if kw.get("error_type") in cfg["ignores"]:
return
-
- if not cfg["account"]:
+
+ if not cfg["account"]:
msg = "There is no account number configured so that the error can be sent to Arecibo"
log.error('Arecibo: %s', msg)
return
-
+
req = context.REQUEST
error = post()
mail_possible = not not context.MailHost.smtp_host
if mail_possible and cfg["transport"] == "smtp":
error.transport = "smtp"
-
+
if kw.get("error_type") == 'NotFound':
status = 404
elif kw.get("error_type") == 'Unauthorized':
@@ -81,11 +81,11 @@ def arecibo(context, **kw):
error.set("url", "%s?%s" % (req['ACTUAL_URL'], req['QUERY_STRING']))
else:
error.set("url", req['ACTUAL_URL'])
-
+
if kw.get("error_log_id"):
- error.set("uid", kw.get("error_log_id"))
+ error.set("uid", kw.get("error_log_id"))
- error.set("ip", req.get("X_FORWARDED_FOR", req.get('REMOTE_ADDR', '')))
+ error.set("ip", req.get("X_FORWARDED_FOR", req.get('REMOTE_ADDR', '')))
error.set("type", kw.get("error_type"))
error.set("status", status)
error.set("request", "\n".join([ "%s: %s" % (k, req[k]) for k in headers if req.get(k)]))
@@ -97,8 +97,8 @@ def arecibo(context, **kw):
usr = getSecurityManager().getUser()
error.set("username", "%s (%s)" % (usr.getId(), usr.getUserName()))
error.set("msg", kw.get("error_msg"))
-
- if error.transport == "http":
+
+ if error.transport == "http":
try:
error.send()
except ConflictError:

0 comments on commit ba35e5a

Please sign in to comment.