12 | NOTE: This page assumes you have a local
13 | AppEngine server running locally. Configure your arecibo install
14 | accordingly.
15 |
16 |
17 |
18 |
21 |
22 |
30 |
31 |
42 |
Check your Arecibo server - you should have an error listed
43 |
44 |
45 |
--------------------------------------------------------------------------------
/clients/php/LICENSE.txt:
--------------------------------------------------------------------------------
1 | BSD, Copyright Andy McKay and contributors
--------------------------------------------------------------------------------
/clients/php/README.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/clients/php/README.txt
--------------------------------------------------------------------------------
/clients/php/arecibo.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/clients/php/example.php:
--------------------------------------------------------------------------------
1 | "w3;5qwy45qshtqu46tdtgheq47s.ert6ew45e4i2w65",
5 | );
6 | post("http://test-areciboapp.appspot.com/v/1/", $fields)
7 | ?>
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/HISTORY.txt:
--------------------------------------------------------------------------------
1 | 0.2 > 0.3:
2 |
3 | - Removed the skins and layers
4 |
5 | - Made it catch all errors (even Zope ones) by patching SiteErrorLog
6 |
7 | - Allowed the override of configuration values by the use of site_configuration.py
8 |
9 | - Added in the ignores property
10 |
11 | - Made uninstalling remove configlet
12 |
13 | - Made install optional (just site_configuration.py will be enough)
14 |
15 | - Any errors sending to Arecibo are logged
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/README.txt:
--------------------------------------------------------------------------------
1 | This package is an interface to the Arecibo application from ClearWind. It provides an interface for Plone to report its errors. For more information see: http://areciboapp.com and specifically http://www.areciboapp.com/docs/plone/
2 |
3 |
4 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind.arecibo.egg-info/PKG-INFO:
--------------------------------------------------------------------------------
1 | Metadata-Version: 1.0
2 | Name: clearwind.arecibo
3 | Version: 0.3dev-r43
4 | Summary: Connector from Plone to Arecibo
5 | Home-page: http://clearwind.ca
6 | Author: ClearWind Consulting
7 | Author-email: andy@clearwind.ca
8 | License: BSD
9 | Description: This package is an interface to the Arecibo application from ClearWind. It provides an interface for Plone to report its errors. For more information see: http://areciboapp.com and specifically http://www.areciboapp.com/docs/plone/
10 |
11 |
12 |
13 |
14 | Platform: UNKNOWN
15 | Classifier: Framework :: Plone
16 | Classifier: Programming Language :: Python
17 | Classifier: Topic :: Software Development :: Libraries :: Python Modules
18 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind.arecibo.egg-info/dependency_links.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind.arecibo.egg-info/entry_points.txt:
--------------------------------------------------------------------------------
1 |
2 | # -*- Entry points: -*-
3 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind.arecibo.egg-info/namespace_packages.txt:
--------------------------------------------------------------------------------
1 | clearwind
2 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind.arecibo.egg-info/not-zip-safe:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind.arecibo.egg-info/requires.txt:
--------------------------------------------------------------------------------
1 | setuptools
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind.arecibo.egg-info/top_level.txt:
--------------------------------------------------------------------------------
1 | clearwind
2 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/__init__.py:
--------------------------------------------------------------------------------
1 | # See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
2 | try:
3 | __import__('pkg_resources').declare_namespace(__name__)
4 | except ImportError:
5 | from pkgutil import extend_path
6 | __path__ = extend_path(__path__, __name__)
7 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/Extensions/Install.py:
--------------------------------------------------------------------------------
1 | import transaction
2 | from Products.CMFCore.utils import getToolByName
3 | from Products.CMFCore.DirectoryView import createDirectoryView
4 | from clearwind.arecibo.interfaces import IAreciboConfiguration
5 | from clearwind.arecibo.config import AreciboConfiguration
6 |
7 | EXTENSION_PROFILES = ('clearwind.arecibo:default',)
8 |
9 | def uninstall(self):
10 | """ Uninstall """
11 | cp = getToolByName(self, 'portal_controlpanel')
12 | if "arecibo" in [ c.id for c in cp._actions ]:
13 | cp.unregisterConfiglet("arecibo")
14 |
15 |
16 | def install(self, reinstall=False):
17 | """ We still have to do this? """
18 |
19 | portal_quickinstaller = getToolByName(self, 'portal_quickinstaller')
20 | portal_setup = getToolByName(self, 'portal_setup')
21 |
22 | sm = self.getSiteManager()
23 |
24 | if not sm.queryUtility(IAreciboConfiguration,
25 | name='Arecibo_config'):
26 | sm.registerUtility(AreciboConfiguration(),
27 | IAreciboConfiguration,
28 | 'Arecibo_config')
29 |
30 | for extension_id in EXTENSION_PROFILES:
31 | portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id, purge_old=False)
32 | product_name = extension_id.split(':')[0]
33 | portal_quickinstaller.notifyInstalled(product_name)
34 | transaction.savepoint()
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/__init__.py:
--------------------------------------------------------------------------------
1 | from AccessControl import allow_module, allow_class, allow_type
2 | from AccessControl import ModuleSecurityInfo, ClassSecurityInfo
3 |
4 | ModuleSecurityInfo('clearwind.arecibo.wrapper').declarePublic('arecibo')
5 |
6 | import config
7 | import patch
8 |
9 | def initialize(context):
10 | """Initializer called when used as a Zope 2 product."""
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/browser/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/clients/plone/clearwind.arecibo/clearwind/arecibo/browser/__init__.py
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/browser/arecibo-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/clients/plone/clearwind.arecibo/clearwind/arecibo/browser/arecibo-icon.png
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/browser/config.py:
--------------------------------------------------------------------------------
1 | from zope.formlib import form
2 | from Products.Five.formlib import formbase
3 | from plone.app.controlpanel.form import ControlPanelForm
4 | from clearwind.arecibo.interfaces import IAreciboConfiguration
5 |
6 | from zope.i18nmessageid import MessageFactory
7 | _ = MessageFactory('clearwind.arecibo')
8 |
9 | class AreciboConfigurationForm(ControlPanelForm):
10 | form_fields = form.Fields(IAreciboConfiguration)
11 |
12 | description = _(u"Configure Plone to work with your Arecibo account here.")
13 | form_name = _(u"Arecibo settings")
14 | label = _(u"Arecibo settings")
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/browser/configure.zcml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
11 |
15 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/config.py:
--------------------------------------------------------------------------------
1 | from zope.interface import implements
2 | from zope.schema.fieldproperty import FieldProperty
3 | from zope.component import getUtility
4 |
5 | from interfaces import IAreciboConfiguration
6 |
7 | from OFS.SimpleItem import SimpleItem
8 |
9 | class AreciboConfiguration(SimpleItem):
10 | implements(IAreciboConfiguration)
11 | account_number = FieldProperty(IAreciboConfiguration['account_number'])
12 | transport = FieldProperty(IAreciboConfiguration['transport'])
13 |
14 | def form_adapter(context):
15 | return getUtility(IAreciboConfiguration, name='Arecibo_config', context=context)
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/configure.zcml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
13 |
14 |
15 |
22 |
23 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/interfaces.py:
--------------------------------------------------------------------------------
1 | from zope.interface import Interface
2 | from zope.schema import Choice
3 | from zope.schema import TextLine
4 | from zope.schema.vocabulary import SimpleTerm
5 | from zope.schema.vocabulary import SimpleVocabulary
6 |
7 | from zope.i18nmessageid import MessageFactory
8 | _ = MessageFactory('clearwind.arecibo')
9 |
10 | arecibo_choices = {
11 | _(u"Send via http"): "http",
12 | _(u"Send via email"): "smtp"
13 | }
14 | arecibo_choices_vocab = SimpleVocabulary(
15 | [SimpleTerm(v, v, k) for k, v in arecibo_choices.items()]
16 | )
17 |
18 | class IAreciboConfiguration(Interface):
19 | """ This interface defines the configlet."""
20 | account_number = TextLine(title=_(u"Arecibo public account number"),
21 | required=True)
22 | transport = Choice(title=_(u'Transport'),
23 | description=_(u"""How errors will be sent to Arecibo, for mail
24 | to work, your mail host must be correctly configured."""),
25 | default='http',
26 | vocabulary=arecibo_choices_vocab,
27 | required=False)
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/lib/README.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/clients/plone/clearwind.arecibo/clearwind/arecibo/lib/README.txt
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/lib/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/clients/plone/clearwind.arecibo/clearwind/arecibo/lib/__init__.py
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/lib/simplejson/tool.py:
--------------------------------------------------------------------------------
1 | r"""
2 | Using simplejson from the shell to validate and
3 | pretty-print::
4 |
5 | $ echo '{"json":"obj"}' | python -msimplejson
6 | {
7 | "json": "obj"
8 | }
9 | $ echo '{ 1.2:3.4}' | python -msimplejson
10 | Expecting property name: line 1 column 2 (char 2)
11 |
12 | Note that the JSON produced by this module's default settings
13 | is a subset of YAML, so it may be used as a serializer for that as well.
14 | """
15 | import simplejson
16 |
17 | #
18 | # Pretty printer:
19 | # curl http://mochikit.com/examples/ajax_tables/domains.json | python -msimplejson.tool
20 | #
21 |
22 | def main():
23 | import sys
24 | if len(sys.argv) == 1:
25 | infile = sys.stdin
26 | outfile = sys.stdout
27 | elif len(sys.argv) == 2:
28 | infile = open(sys.argv[1], 'rb')
29 | outfile = sys.stdout
30 | elif len(sys.argv) == 3:
31 | infile = open(sys.argv[1], 'rb')
32 | outfile = open(sys.argv[2], 'wb')
33 | else:
34 | raise SystemExit("%s [infile [outfile]]" % (sys.argv[0],))
35 | try:
36 | obj = simplejson.load(infile)
37 | except ValueError, e:
38 | raise SystemExit(e)
39 | simplejson.dump(obj, outfile, sort_keys=True, indent=4)
40 | outfile.write('\n')
41 |
42 |
43 | if __name__ == '__main__':
44 | main()
45 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/patch.py:
--------------------------------------------------------------------------------
1 | from Products.SiteErrorLog import SiteErrorLog
2 | from wrapper import arecibo
3 | import traceback
4 |
5 | old_raising = SiteErrorLog.SiteErrorLog.raising
6 | def raising(self, *args, **kw):
7 | if self.aq_parent.meta_type == "Plone Site":
8 | err = str(getattr(args[0][0], '__name__', args[0][0]))
9 | tb = "\n".join(traceback.format_tb(args[0][2]))
10 | msg = args[0][1]
11 | arecibo(self, error_type=err, error_tb=tb, error_msg=msg)
12 | return old_raising(self, *args, **kw)
13 |
14 | SiteErrorLog.SiteErrorLog.raising = raising
15 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/profiles/default/actionicons.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/profiles/default/clearwind.arecibo.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/clients/plone/clearwind.arecibo/clearwind/arecibo/profiles/default/clearwind.arecibo.txt
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/profiles/default/controlpanel.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/setuphandlers.py:
--------------------------------------------------------------------------------
1 | from Products.CMFCore.DirectoryView import createDirectoryView
2 | from Products.CMFCore.utils import getToolByName
3 | from Products.CMFPlone.interfaces import ISelectableConstrainTypes
4 | from Products.CMFEditions.setuphandlers import DEFAULT_POLICIES
5 | import string
6 |
7 | def setupSkins(portal):
8 | def add(portal, name, location):
9 | portal_skins = getToolByName(portal, "portal_skins")
10 | if name not in portal_skins.objectIds():
11 | createDirectoryView(portal_skins, location, name)
12 |
13 | skins = portal_skins.getSkinSelections()
14 | for skin in skins:
15 | path = portal_skins.getSkinPath(skin)
16 | path = [ p.strip() for p in path.split(',') ]
17 | if name not in path:
18 | if 'custom' in path:
19 | pos = path.index('custom') + 1
20 | else:
21 | pos = 0
22 | path.insert(pos, name)
23 | path = ", ".join(path)
24 | portal_skins.addSkinSelection(skin, path)
25 |
26 | add(portal, "arecibo", "clearwind.arecibo:skins")
27 |
28 | def importVarious(context):
29 | if context.readDataFile("clearwind.arecibo.txt") is None:
30 | return
31 | portal = context.getSite()
32 | setupSkins(portal)
33 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/site_configuration.py.in:
--------------------------------------------------------------------------------
1 | # some of these values can be set in the plone
2 | # control panel admin interface, any values set
3 | # there will be override these values.
4 | #
5 | # the idea here is that you can set these as
6 | # defaults en-mass through say buildout or
7 | # whatever mechanism you'd like
8 | config = {
9 | # your arecibo account number
10 | "account": "your account number",
11 | # the transport you'd like, we'd default to http
12 | "transport": "http",
13 | # a dictionary of all the priorities by status so
14 | # you can alter the priorities as you would like
15 | "priorities": {
16 | 404: 5,
17 | 500: 1,
18 | },
19 | # the default priority for everything else
20 | "default-priority": 3,
21 | # types you'd like to ignore
22 | "ignores": ["Redirect","NotFound"]
23 | }
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/tests.py:
--------------------------------------------------------------------------------
1 | import unittest
2 |
3 | from zope.testing import doctestunit
4 | from zope.component import testing
5 | from Testing import ZopeTestCase as ztc
6 |
7 | from Products.Five import zcml
8 | from Products.Five import fiveconfigure
9 | from Products.PloneTestCase import PloneTestCase as ptc
10 | from Products.PloneTestCase.layer import PloneSite
11 | ptc.setupPloneSite()
12 |
13 | import clearwind.arecibo
14 |
15 | class TestCase(ptc.PloneTestCase):
16 | class layer(PloneSite):
17 | @classmethod
18 | def setUp(cls):
19 | fiveconfigure.debug_mode = True
20 | zcml.load_config('configure.zcml',
21 | clearwind.arecibo)
22 | fiveconfigure.debug_mode = False
23 |
24 | @classmethod
25 | def tearDown(cls):
26 | pass
27 |
28 |
29 | def test_suite():
30 | return unittest.TestSuite([
31 |
32 | # Unit tests
33 | #doctestunit.DocFileSuite(
34 | # 'README.txt', package='clearwind.arecibo',
35 | # setUp=testing.setUp, tearDown=testing.tearDown),
36 |
37 | #doctestunit.DocTestSuite(
38 | # module='clearwind.arecibo.mymodule',
39 | # setUp=testing.setUp, tearDown=testing.tearDown),
40 |
41 |
42 | # Integration tests that use PloneTestCase
43 | #ztc.ZopeDocFileSuite(
44 | # 'README.txt', package='clearwind.arecibo',
45 | # test_class=TestCase),
46 |
47 | #ztc.FunctionalDocFileSuite(
48 | # 'browser.txt', package='clearwind.arecibo',
49 | # test_class=TestCase),
50 |
51 | ])
52 |
53 | if __name__ == '__main__':
54 | unittest.main(defaultTest='test_suite')
55 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/clearwind/arecibo/version.txt:
--------------------------------------------------------------------------------
1 | 0.3
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/docs/HISTORY.txt:
--------------------------------------------------------------------------------
1 | Changelog
2 | =========
3 |
4 | 1.0 - Unreleased
5 | ----------------
6 |
7 | * Initial release
8 |
9 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/docs/INSTALL.txt:
--------------------------------------------------------------------------------
1 | clearwind.arecibo Installation
2 | ==========================
3 |
4 | To install clearwind.arecibo into the global Python environment (or a workingenv),
5 | using a traditional Zope 2 instance, you can do this:
6 |
7 | * When you're reading this you have probably already run
8 | ``easy_install clearwind.arecibo``. Find out how to install setuptools
9 | (and EasyInstall) here:
10 | http://peak.telecommunity.com/DevCenter/EasyInstall
11 |
12 | * If you are using Zope 2.9 (not 2.10), get `pythonproducts`_ and install it
13 | via::
14 |
15 | python setup.py install --home /path/to/instance
16 |
17 | into your Zope instance.
18 |
19 | * Create a file called ``clearwind.arecibo-configure.zcml`` in the
20 | ``/path/to/instance/etc/package-includes`` directory. The file
21 | should only contain this::
22 |
23 |
24 |
25 | .. _pythonproducts: http://plone.org/products/pythonproducts
26 |
27 |
28 | Alternatively, if you are using zc.buildout and the plone.recipe.zope2instance
29 | recipe to manage your project, you can do this:
30 |
31 | * Add ``clearwind.arecibo`` to the list of eggs to install, e.g.:
32 |
33 | [buildout]
34 | ...
35 | eggs =
36 | ...
37 | clearwind.arecibo
38 |
39 | * Tell the plone.recipe.zope2instance recipe to install a ZCML slug:
40 |
41 | [instance]
42 | recipe = plone.recipe.zope2instance
43 | ...
44 | zcml =
45 | clearwind.arecibo
46 |
47 | * Re-run buildout, e.g. with:
48 |
49 | $ ./bin/buildout
50 |
51 | You can skip the ZCML slug if you are going to explicitly include the package
52 | from another package's configure.zcml file.
53 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/docs/LICENSE.txt:
--------------------------------------------------------------------------------
1 | clearwind.arecibo is copyright ClearWind Consulting
2 |
3 | This program is free software; you can redistribute it and/or modify
4 | it under the terms of the GNU General Public License as published by
5 | the Free Software Foundation; either version 2 of the License, or
6 | (at your option) any later version.
7 |
8 | This program is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 |
13 | You should have received a copy of the GNU General Public License
14 | along with this program; if not, write to the Free Software
15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston,
16 | MA 02111-1307 USA.
17 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/setup.cfg:
--------------------------------------------------------------------------------
1 | [egg_info]
2 | tag_build = dev
3 | tag_svn_revision = true
4 |
--------------------------------------------------------------------------------
/clients/plone/clearwind.arecibo/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup, find_packages
2 | import os
3 |
4 | version = '0.3'
5 |
6 | setup(name='clearwind.arecibo',
7 | version=version,
8 | description="Connector from Plone to Arecibo",
9 | long_description=open("README.txt").read() + "\n",
10 | # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
11 | classifiers=[
12 | "Framework :: Plone",
13 | "Programming Language :: Python",
14 | "Topic :: Software Development :: Libraries :: Python Modules",
15 | ],
16 | keywords='',
17 | author='ClearWind Consulting',
18 | author_email='andy@clearwind.ca',
19 | url='http://clearwind.ca',
20 | license='BSD',
21 | packages=find_packages(exclude=['ez_setup']),
22 | namespace_packages=['clearwind'],
23 | include_package_data=True,
24 | zip_safe=False,
25 | install_requires=[
26 | 'setuptools',
27 | # -*- Extra requirements: -*-
28 | ],
29 | entry_points="""
30 | # -*- Entry points: -*-
31 | """,
32 | )
33 |
--------------------------------------------------------------------------------
/clients/python/README.txt:
--------------------------------------------------------------------------------
1 | This is the next version of the Arecibo API which connects to the Google App Engine implementation of Arecibo.
2 |
3 | Arecibo is an open source application to provide error logging and notifications for your web sites.
4 |
5 | See http://areciboapp.com/docs/client/python.html for more information
6 |
--------------------------------------------------------------------------------
/clients/python/arecibo/__init__.py:
--------------------------------------------------------------------------------
1 | from arecibo import post
--------------------------------------------------------------------------------
/clients/python/arecibo/simplejson/tool.py:
--------------------------------------------------------------------------------
1 | r"""
2 | Using simplejson from the shell to validate and
3 | pretty-print::
4 |
5 | $ echo '{"json":"obj"}' | python -msimplejson
6 | {
7 | "json": "obj"
8 | }
9 | $ echo '{ 1.2:3.4}' | python -msimplejson
10 | Expecting property name: line 1 column 2 (char 2)
11 |
12 | Note that the JSON produced by this module's default settings
13 | is a subset of YAML, so it may be used as a serializer for that as well.
14 | """
15 | import simplejson
16 |
17 | #
18 | # Pretty printer:
19 | # curl http://mochikit.com/examples/ajax_tables/domains.json | python -msimplejson.tool
20 | #
21 |
22 | def main():
23 | import sys
24 | if len(sys.argv) == 1:
25 | infile = sys.stdin
26 | outfile = sys.stdout
27 | elif len(sys.argv) == 2:
28 | infile = open(sys.argv[1], 'rb')
29 | outfile = sys.stdout
30 | elif len(sys.argv) == 3:
31 | infile = open(sys.argv[1], 'rb')
32 | outfile = open(sys.argv[2], 'wb')
33 | else:
34 | raise SystemExit("%s [infile [outfile]]" % (sys.argv[0],))
35 | try:
36 | obj = simplejson.load(infile)
37 | except ValueError, e:
38 | raise SystemExit(e)
39 | simplejson.dump(obj, outfile, sort_keys=True, indent=4)
40 | outfile.write('\n')
41 |
42 |
43 | if __name__ == '__main__':
44 | main()
45 |
--------------------------------------------------------------------------------
/clients/python/setup.cfg:
--------------------------------------------------------------------------------
1 | [egg_info]
2 | tag_svn_revision = true
3 |
--------------------------------------------------------------------------------
/clients/python/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup, find_packages
2 | import os
3 |
4 | version = '0.1.3'
5 |
6 | setup(name='arecibo',
7 | version=version,
8 | description="Connector from Python to Arecibo",
9 | long_description=open("README.txt").read() + "\n",
10 | # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
11 | classifiers=[
12 | "Programming Language :: Python",
13 | "Topic :: Software Development :: Libraries :: Python Modules",
14 | ],
15 | keywords='',
16 | author='Clearwind Consulting',
17 | author_email='andy@clearwind.ca',
18 | url='http://clearwind.ca',
19 | license='BSD',
20 | packages=find_packages(exclude=['ez_setup']),
21 | include_package_data=True,
22 | zip_safe=False,
23 | install_requires=[
24 | 'setuptools',
25 | # -*- Extra requirements: -*-
26 | ],
27 | entry_points="""
28 | # -*- Entry points: -*-
29 | """,
30 | )
31 |
--------------------------------------------------------------------------------
/clients/rails/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rake'
2 | require 'rake/testtask'
3 | require 'rake/rdoctask'
4 |
5 | desc 'Default: run unit tests.'
6 | task :default => :test
7 |
8 | desc 'Test the arecibo plugin.'
9 | Rake::TestTask.new(:test) do |t|
10 | t.libs << 'lib'
11 | t.pattern = 'test/**/*_test.rb'
12 | t.verbose = true
13 | end
14 |
15 | desc 'Generate documentation for the arecibo plugin.'
16 | Rake::RDocTask.new(:rdoc) do |rdoc|
17 | rdoc.rdoc_dir = 'rdoc'
18 | rdoc.title = 'Arecibo'
19 | rdoc.options << '--line-numbers' << '--inline-source'
20 | rdoc.rdoc_files.include('README')
21 | rdoc.rdoc_files.include('lib/**/*.rb')
22 | end
23 |
--------------------------------------------------------------------------------
/clients/rails/assets/arecibo.rhtml:
--------------------------------------------------------------------------------
1 |
Error
2 |
3 |
An error has occurred in completing that request. This could be by
4 | design, or it might be an error. This error has been reported
5 | and your reference number is: <%= @arecibodata[:uid] %>.
6 |
Please contact your system administrator for more information.
7 |
--------------------------------------------------------------------------------
/clients/rails/init.rb:
--------------------------------------------------------------------------------
1 | # Include hook code here
2 | require 'wrapper'
3 | puts "requiring wrapper"
--------------------------------------------------------------------------------
/clients/rails/install.rb:
--------------------------------------------------------------------------------
1 | # Install hook code here
2 |
--------------------------------------------------------------------------------
/clients/rails/lib/arecibolib/LICENSE.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/clients/rails/lib/arecibolib/LICENSE.txt
--------------------------------------------------------------------------------
/clients/rails/lib/arecibolib/README.txt:
--------------------------------------------------------------------------------
1 | This is the standlone Ruby library for posting errors to Arecibo.... more to come if this works
--------------------------------------------------------------------------------
/clients/rails/lib/arecibolib/arecibo.rb:
--------------------------------------------------------------------------------
1 | require 'net/http'
2 | require 'uri'
3 |
4 | class Arecibo
5 | def initialize data
6 | @data = data
7 | # where errors are going
8 | @arecibo_url = URI.parse('http://www.areciboapp.com/v/1/')
9 | # the length of time to wait for a server to respond
10 | @timeout = 10
11 | end
12 |
13 | def send
14 | # make a post
15 | post = Net::HTTP::Post.new(@arecibo_url.path)
16 | post.set_form_data(@data)
17 | # make request
18 | req = Net::HTTP.new(@arecibo_url.host, @arecibo_url.port)
19 | req.read_timeout = @timeout
20 | # push it through
21 | res = req.start {|http| http.request(post) }
22 | case res
23 | when Net::HTTPSuccess
24 | # ok, we don't need to do anything else
25 | else
26 | # let this bubble up to the rest of the script
27 | raise res.error!
28 | end
29 | end
30 | end
31 |
32 |
--------------------------------------------------------------------------------
/clients/rails/lib/arecibolib/test.rb:
--------------------------------------------------------------------------------
1 | require 'arecibo'
2 |
3 | dict = {
4 | :account => 'yournumber',
5 | :priority => 1,
6 | :url => "http://badapp.org",
7 | :uid => "123124123123",
8 | :ip => "127.0.0.1",
9 | :type => "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει",
10 | :server => "Test Script"
11 | }
12 | p = Arecibo.new(dict)
13 | p.send
--------------------------------------------------------------------------------
/clients/rails/tasks/arecibo_tasks.rake:
--------------------------------------------------------------------------------
1 | # desc "Explaining what the task does"
2 | # task :arecibo do
3 | # # Task goes here
4 | # end
--------------------------------------------------------------------------------
/clients/rails/test/arecibo_test.rb:
--------------------------------------------------------------------------------
1 | require 'test/unit'
2 |
3 | class AreciboTest < Test::Unit::TestCase
4 | # Replace this with your real tests.
5 | def test_this_plugin
6 | flunk
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/clients/rails/uninstall.rb:
--------------------------------------------------------------------------------
1 | # Uninstall hook code here
2 |
--------------------------------------------------------------------------------
/clients/ruby/LICENSE.txt:
--------------------------------------------------------------------------------
1 | BSD, Copyright Andy McKay and contributors
--------------------------------------------------------------------------------
/clients/ruby/README.txt:
--------------------------------------------------------------------------------
1 | This is the standlone Ruby library for posting errors to Arecibo.... more to come if this works
--------------------------------------------------------------------------------
/clients/ruby/arecibo.rb:
--------------------------------------------------------------------------------
1 | require 'net/http'
2 | require 'uri'
3 |
4 | class Arecibo
5 | def initialize(url, data)
6 | @data = data
7 | # where errors are going
8 | @arecibo_url = URI.parse(url)
9 | # the length of time to wait for a server to respond
10 | @timeout = 10
11 | end
12 |
13 | def send
14 | # make a post
15 | post = Net::HTTP::Post.new(@arecibo_url.path)
16 | post.set_form_data(@data)
17 | # make request
18 | req = Net::HTTP.new(@arecibo_url.host, @arecibo_url.port)
19 | req.read_timeout = @timeout
20 | # push it through
21 | res = req.start {|http| http.request(post) }
22 | case res
23 | when Net::HTTPSuccess
24 | # ok, we don't need to do anything else
25 | else
26 | # let this bubble up to the rest of the script
27 | raise res.error!
28 | end
29 | end
30 | end
31 |
32 |
--------------------------------------------------------------------------------
/clients/ruby/test.rb:
--------------------------------------------------------------------------------
1 | require 'arecibo'
2 |
3 | dict = {
4 | :account => 'youraccount number',
5 | :priority => 1,
6 | :url => "http://badapp.org",
7 | :uid => "sefsef",
8 | :ip => "127.0.0.1",
9 | :type => "sdfs",
10 | :server => "Test Script"
11 | }
12 | p = Arecibo.new("http://yourservername/v/1/", dict)
13 | p.send
--------------------------------------------------------------------------------
/listener/LICENSE:
--------------------------------------------------------------------------------
1 | BSD, Copyright Andy McKay and Contributors
2 | (except for existing libraries as noted)
--------------------------------------------------------------------------------
/listener/app_engine/.gitignore:
--------------------------------------------------------------------------------
1 | *.pyc
2 | django
3 | app.yaml
4 | local_settings.py
5 | custom/listeners.py
6 | custom/templates
7 |
--------------------------------------------------------------------------------
/listener/app_engine/__init__.py:
--------------------------------------------------------------------------------
1 | import django
2 | version = django.VERSION
3 |
4 | if version[0] < 1 or version[1] < 2:
5 | raise ValueError("You need at least Django 1.2 to run Arecibo, "\
6 | "please see http://www.areciboapp.com/docs/server/installation.html.")
--------------------------------------------------------------------------------
/listener/app_engine/app.yaml.example:
--------------------------------------------------------------------------------
1 | application: your_application_error
2 | version: 1
3 | runtime: python
4 | api_version: 1
5 |
6 | handlers:
7 | - url: /media
8 | static_dir: media
9 |
10 | # lock down these urls
11 | # this is the task queue for errors
12 | - url: /send/created/
13 | script: main.py
14 | login: admin
15 |
16 | # the cron job for sending notifications
17 | # see cron.yaml
18 | - url: /notification/send/
19 | script: main.py
20 | login: admin
21 |
22 | # the cron job for cleaning out data from notifications
23 | # see cron.yaml
24 | - url: /notification/cleanup/
25 | script: main.py
26 | login: admin
27 |
28 | - url: /stats/generate/.*
29 | script: main.py
30 | login: admin
31 |
32 | - url: /remote_api
33 | script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
34 | login: admin
35 |
36 | - url: /.*
37 | script: main.py
38 |
39 | inbound_services:
40 | - mail
--------------------------------------------------------------------------------
/listener/app_engine/app/__init__.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/listener/app_engine/app/base.py:
--------------------------------------------------------------------------------
1 | from appengine_django.models import BaseModel
2 | from google.appengine.ext import db
3 |
4 | class Base(BaseModel):
5 | @property
6 | def id(self):
7 | try:
8 | return str(self.key())
9 | except db.NotSavedError:
10 | pass
11 |
12 | pk = id
13 |
--------------------------------------------------------------------------------
/listener/app_engine/app/context.py:
--------------------------------------------------------------------------------
1 | from urllib import urlencode
2 | from django.conf import settings
3 |
4 | def context(request):
5 | data = {}
6 | data["user"] = request.user
7 | data["public_key"] = settings.ARECIBO_PUBLIC_ACCOUNT_NUMBER
8 | data["private_key"] = settings.ARECIBO_PRIVATE_ACCOUNT_NUMBER
9 | data["site_url"] = settings.SITE_URL
10 |
11 | qs = request.GET.copy()
12 | if "page" in qs:
13 | del qs["page"]
14 |
15 | data["qs"] = ""
16 | if qs:
17 | data["qs"] = "%s" % urlencode(qs)
18 |
19 | return data
20 |
--------------------------------------------------------------------------------
/listener/app_engine/app/errors.py:
--------------------------------------------------------------------------------
1 | from exceptions import Exception
2 |
3 | class StatusDoesNotExist(Exception): pass
4 |
5 | from django.template import RequestContext, loader
6 | from django.http import HttpResponse
7 |
8 | def not_found_error(request):
9 | t = loader.get_template('404.html')
10 | c = RequestContext(request)
11 | return HttpResponse(t.render(c), status=404)
12 |
13 | def application_error(request):
14 | t = loader.get_template('500.html')
15 | c = RequestContext(request)
16 | return HttpResponse(t.render(c), status=500)
--------------------------------------------------------------------------------
/listener/app_engine/app/fields.py:
--------------------------------------------------------------------------------
1 | from django import forms
2 | from django.core.validators import EMPTY_VALUES
3 |
4 | class OurModelChoiceIterator(forms.models.ModelChoiceIterator):
5 | def __iter__(self):
6 | if self.field.empty_label is not None:
7 | yield (u"", self.field.empty_label)
8 | if self.field.cache_choices:
9 | if self.field.choice_cache is None:
10 | self.field.choice_cache = [
11 | self.choice(obj) for obj in self.queryset
12 | ]
13 | for choice in self.field.choice_cache:
14 | yield choice
15 | else:
16 | for obj in self.queryset:
17 | yield self.choice(obj)
18 |
19 | class OurModelChoiceField(forms.ModelChoiceField):
20 | """ This required a few modifications to get working on app engine it seems """
21 |
22 | def __init__(self, *args, **kwargs):
23 | self.model = kwargs.pop("model")
24 | super(OurModelChoiceField, self).__init__(*args, **kwargs)
25 |
26 | def to_python(self, value):
27 | if value in EMPTY_VALUES:
28 | return None
29 | value = self.model.get(value)
30 | return value
31 |
32 | def _get_choices(self):
33 | if hasattr(self, '_choices'):
34 | return self._choices
35 | return OurModelChoiceIterator(self)
36 |
37 | choices = property(_get_choices, forms.ModelChoiceField._set_choices)
--------------------------------------------------------------------------------
/listener/app_engine/app/forms.py:
--------------------------------------------------------------------------------
1 | from django import forms
2 | from django.utils.html import conditional_escape
3 | from django.utils.encoding import force_unicode
4 | from django.utils.safestring import mark_safe
5 |
6 | def as_blue_print(self):
7 | return self._html_output(u"""
8 |
13 | {% else %}
14 | {% if not user.is_staff %}
15 |
You have logged in, but the admin has not granted you access yet. Please be patient.
16 | {% endif %}
17 | {% endif %}
18 |
19 |
Welcome to this Arecibo installation. Arecibo is an observatory, instead of listening to the stars, this site listens for errors from your sites. We pronounce it "Ah-reh-see-bow". If you have any questions about the site, please contact it's administrator.
33 |
34 | {% endblock %}
--------------------------------------------------------------------------------
/listener/app_engine/app/test_runner.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from django.conf import settings
4 | from django.test.simple import DjangoTestSuiteRunner
5 |
6 | from django.core import mail
7 | from django.core.mail.backends import locmem
8 |
9 | from google.appengine.api import mail
10 | from django.core.mail.message import EmailMessage
11 |
12 | os.environ['SERVER_SOFTWARE'] = "Development"
13 | settings.DATABASES['default']['SUPPORTS_TRANSACTIONS'] = True
14 |
15 | # amongst other things this will suppress those annoying logs
16 | settings.DEBUG = False
17 |
18 | def send_email_dummy(sender=None, to=None, subject=None, body=None):
19 | # app engine doesn't use the backend, so that if you try to write
20 | # unit tests that check the mail api, they fail, this patches it
21 | # back in, for the purpose of unit_tests
22 | return EmailMessage(subject, body, sender, [to,], connection=None).send()
23 |
24 | class AreciboRunner(DjangoTestSuiteRunner):
25 | def setup_test_environment(self, **kwargs):
26 | super(AreciboRunner, self).setup_test_environment(**kwargs)
27 | mail.send_mail = send_email_dummy
--------------------------------------------------------------------------------
/listener/app_engine/app/tests.py:
--------------------------------------------------------------------------------
1 | # test data
2 | from django.conf import settings
3 |
4 | try:
5 | account = settings.ARECIBO_PUBLIC_ACCOUNT_NUMBER
6 | except ImportError:
7 | account = "1231241243"
8 |
9 | test_data = {
10 | "account": account,
11 | "priority": 4,
12 | "user_agent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X...",
13 | "url": "http://badapp.org/-\ufffdwe-cant-lose",
14 | "uid": "123124123123",
15 | "ip": "127.0.0.1",
16 | "type": "Test from python",
17 | "status": "403",
18 | "server": "Test Script",
19 | "request": """This is the bit that goes in the request""",
20 | "username": "Jimbob",
21 | "msg": """
22 | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
23 | labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
24 | nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
25 | esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
26 | culpa qui officia deserunt mollit anim id est laborum
27 | """,
28 | "traceback": """Traceback (most recent call last",:
29 | File "", line 1, in
30 | ZeroDivisionError: integer division or modulo by zero df
31 | """,}
--------------------------------------------------------------------------------
/listener/app_engine/app/urls.py:
--------------------------------------------------------------------------------
1 | from django.conf.urls.defaults import *
2 |
3 | urlpatterns = patterns('',
4 | url(r'^$', 'app.views.index', name="index"),
5 | url(r'^lib/error.js', 'app.views.javascript_client', name="error-javascript"),
6 | url(r'^lib/error-compress.js', 'app.views.javascript_client', name="error-javascript-compressed"),
7 | url(r'^accounts/login/$', 'app.views.login', name="login"),
8 | url(r'^accounts/logout/$', 'app.views.logout', name="logout"),
9 | url(r'^accounts/not-allowed/$', 'app.views.not_allowed', name="not-allowed"),
10 | url(r'^setup$', 'app.views.setup', name="setup")
11 | )
12 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/auth/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2008 Google Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """
16 | Authentication module that mimics the behavior of Django's authentication
17 | implementation.
18 |
19 | Limitations:
20 | - all user permissions methods are not available (requires contenttypes)
21 | """
22 |
23 | from django.template import add_to_builtins
24 |
25 | add_to_builtins('appengine_django.auth.templatetags')
26 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/auth/decorators.py:
--------------------------------------------------------------------------------
1 | # Copyright 2008 Google Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | """Decorators for the authentication framework."""
16 |
17 | from django.http import HttpResponseRedirect
18 |
19 | from google.appengine.api import users
20 |
21 |
22 | def login_required(function):
23 | """Implementation of Django's login_required decorator.
24 |
25 | The login redirect URL is always set to request.path
26 | """
27 | def login_required_wrapper(request, *args, **kw):
28 | if request.user.is_authenticated():
29 | return function(request, *args, **kw)
30 | return HttpResponseRedirect(users.create_login_url(request.path))
31 | return login_required_wrapper
32 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/auth/middleware.py:
--------------------------------------------------------------------------------
1 | # Copyright 2008 Google Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from django.contrib.auth.models import AnonymousUser
16 |
17 | from google.appengine.api import users
18 |
19 | from appengine_django.auth.models import User
20 |
21 |
22 | class LazyUser(object):
23 | def __get__(self, request, obj_type=None):
24 | if not hasattr(request, '_cached_user'):
25 | user = users.get_current_user()
26 | if user:
27 | request._cached_user = User.get_djangouser_for_user(user)
28 | else:
29 | request._cached_user = AnonymousUser()
30 | return request._cached_user
31 |
32 |
33 | class AuthenticationMiddleware(object):
34 | def process_request(self, request):
35 | request.__class__.user = LazyUser()
36 | return None
37 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/auth/signals.py:
--------------------------------------------------------------------------------
1 | # add in a user created signal
2 | import django.dispatch
3 |
4 | user_created = django.dispatch.Signal(providing_args=["instance",])
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/conf/app_template/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/app_engine/appengine_django/conf/app_template/__init__.py
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/conf/app_template/models.py:
--------------------------------------------------------------------------------
1 | from appengine_django.models import BaseModel
2 | from google.appengine.ext import db
3 |
4 | # Create your models here.
5 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/conf/app_template/views.py:
--------------------------------------------------------------------------------
1 | # Create your views here.
2 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/db/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright 2008 Google Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # Explicitly set the name of this package to "appengine".
16 | #
17 | # The rationale for this is so that Django can refer to the database as
18 | # "appengine" even though at a filesystem level it appears as the "db" package
19 | # within the appengine_django package.
20 | __name__ = "appengine"
21 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/db/creation.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python2.4
2 | #
3 | # Copyright 2008 Google Inc.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 |
18 | import logging
19 |
20 | from django.conf import settings
21 | from django.db.backends.creation import BaseDatabaseCreation
22 |
23 |
24 | class DatabaseCreation(BaseDatabaseCreation):
25 |
26 | def create_test_db(self, *args, **kw):
27 | """Destroys the test datastore. A new store will be recreated on demand"""
28 | settings.DATABASE_SUPPORTS_TRANSACTIONS = False
29 | self.destroy_test_db()
30 | self.connection.use_test_datastore = True
31 | self.connection.flush()
32 |
33 |
34 | def destroy_test_db(self, *args, **kw):
35 | """Destroys the test datastore files."""
36 | from appengine_django.db.base import destroy_datastore
37 | from appengine_django.db.base import get_test_datastore_paths
38 | destroy_datastore(*get_test_datastore_paths())
39 | logging.debug("Destroyed test datastore")
40 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/management/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/app_engine/appengine_django/management/__init__.py
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/management/commands/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/app_engine/appengine_django/management/commands/__init__.py
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/management/commands/flush.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python2.4
2 | #
3 | # Copyright 2008 Google Inc.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | import logging
18 | import os
19 | import sys
20 |
21 | from django.core.management.base import BaseCommand
22 |
23 |
24 | class Command(BaseCommand):
25 | """Overrides the default Django flush command.
26 | """
27 | help = 'Clears the current datastore and loads the initial fixture data.'
28 |
29 | def run_from_argv(self, argv):
30 | from django.db import connection
31 | connection.flush()
32 | from django.core.management import call_command
33 | call_command('loaddata', 'initial_data')
34 |
35 | def handle(self, *args, **kwargs):
36 | self.run_from_argv(None)
37 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/management/commands/reset.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python2.4
2 | #
3 | # Copyright 2008 Google Inc.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 |
18 | import logging
19 | import os
20 | import sys
21 |
22 | from django.core.management.base import BaseCommand
23 |
24 |
25 | class Command(BaseCommand):
26 | """Overrides the default Django reset command.
27 | """
28 | help = 'Clears the current datastore.'
29 |
30 | def run_from_argv(self, argv):
31 | from django.db import connection
32 | connection.flush()
33 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/management/commands/startapp.py:
--------------------------------------------------------------------------------
1 | # Copyright 2008 Google Inc.
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
16 | import os
17 |
18 | import django
19 | from django.core.management.commands import startapp
20 |
21 | import appengine_django
22 |
23 |
24 | class Command(startapp.Command):
25 | def handle_label(self, *args, **kwds):
26 | """Temporary adjust django.__path__ to load app templates from the
27 | helpers directory.
28 | """
29 | old_path = django.__path__
30 | django.__path__ = appengine_django.__path__
31 | startapp.Command.handle_label(self, *args, **kwds)
32 | django.__path__ = old_path
33 |
34 |
35 | class ProjectCommand(Command):
36 | def __init__(self, project_directory):
37 | super(ProjectCommand, self).__init__()
38 | self.project_directory = project_directory
39 |
40 | def handle_label(self, app_name, **options):
41 | super(ProjectCommand, self).handle_label(app_name, self.project_directory,
42 | **options)
43 |
44 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/replacement_imp.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python2.4
2 | #
3 | # Copyright 2008 Google Inc.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | """This file acts as a very minimal replacement for the 'imp' module.
18 |
19 | It contains only what Django expects to use and does not actually implement the
20 | same functionality as the real 'imp' module.
21 | """
22 |
23 |
24 | def find_module(name, path=None):
25 | """Django needs imp.find_module, but it works fine if nothing is found."""
26 | raise ImportError
27 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/serializer/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/app_engine/appengine_django/serializer/__init__.py
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/sessions/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/app_engine/appengine_django/sessions/__init__.py
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/sessions/backends/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/app_engine/appengine_django/sessions/backends/__init__.py
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/sessions/models.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python2.4
2 | #
3 | # Copyright 2008 Google Inc.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | from google.appengine.ext import db
18 |
19 | class Session(db.Model):
20 | """Django compatible App Engine Datastore session model."""
21 | session_data = db.BlobProperty()
22 | expire_date = db.DateTimeProperty()
23 |
--------------------------------------------------------------------------------
/listener/app_engine/appengine_django/tests/memcache_test.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python2.4
2 | #
3 | # Copyright 2008 Google Inc.
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 |
17 | """Ensures the App Engine memcache API works as Django's memcache backend."""
18 |
19 | import unittest
20 |
21 | from django.core.cache import get_cache
22 | from appengine_django import appid
23 | from appengine_django import have_appserver
24 |
25 |
26 | class AppengineMemcacheTest(unittest.TestCase):
27 | """Tests that the memcache backend works."""
28 |
29 | def setUp(self):
30 | """Get the memcache cache module so it is available to tests."""
31 | self._cache = get_cache("memcached://")
32 |
33 | def testSimpleSetGet(self):
34 | """Tests that a simple set/get operation through the cache works."""
35 | self._cache.set("test_key", "test_value")
36 | self.assertEqual(self._cache.get("test_key"), "test_value")
37 |
38 | def testDelete(self):
39 | """Tests that delete removes values from the cache."""
40 | self._cache.set("test_key", "test_value")
41 | self.assertEqual(self._cache.has_key("test_key"), True)
42 | self._cache.delete("test_key")
43 | self.assertEqual(self._cache.has_key("test_key"), False)
44 |
--------------------------------------------------------------------------------
/listener/app_engine/cron.yaml:
--------------------------------------------------------------------------------
1 | cron:
2 | - description: notification process
3 | url: /notification/send/
4 | schedule: every 5 minutes
5 |
6 | - description: notification process
7 | url: /notification/cleanup/
8 | schedule: every 24 hours
9 |
10 | - description: daily summary
11 | url: /stats/generate/
12 | schedule: every 24 hours
--------------------------------------------------------------------------------
/listener/app_engine/custom/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/app_engine/custom/__init__.py
--------------------------------------------------------------------------------
/listener/app_engine/custom/examples/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/app_engine/custom/examples/__init__.py
--------------------------------------------------------------------------------
/listener/app_engine/custom/examples/default_public.py:
--------------------------------------------------------------------------------
1 | from error.models import Error
2 |
3 | from error import signals
4 |
5 | def default_public(instance, **kw):
6 | instance.public = True
7 | instance.save()
8 |
9 | signals.error_created.connect(default_public, dispatch_uid="default_public")
10 |
--------------------------------------------------------------------------------
/listener/app_engine/custom/models.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/app_engine/custom/models.py
--------------------------------------------------------------------------------
/listener/app_engine/custom/readme.txt:
--------------------------------------------------------------------------------
1 | # this is the custom folder, add or remove any signals to alter how Arecibo works here
--------------------------------------------------------------------------------
/listener/app_engine/custom/tests.py:
--------------------------------------------------------------------------------
1 | from django.test import TestCase
2 | from django.test.client import Client
3 | from django.core.urlresolvers import reverse
4 |
5 | from app.tests import test_data as data
6 | from error.models import Error, Group
7 | from error import signals
8 |
9 | from custom.examples import default_public
10 |
11 | class ErrorTests(TestCase):
12 | # test the view for writing errors
13 | def setUp(self):
14 | for error in Error.all(): error.delete()
15 |
16 | def testNotDefaultAsPublic(self):
17 | signals.error_created.disconnect(default_public.default_public, dispatch_uid="default_public")
18 |
19 | c = Client()
20 | assert not Error.objects.all().count()
21 | c.post(reverse("error-post"), data)
22 | assert Error.objects.all().count() == 1
23 | assert Error.objects.all()[0].public == False
24 |
25 | def testDefaultAsPublic(self):
26 | signals.error_created.connect(default_public.default_public, dispatch_uid="default_public")
27 |
28 | c = Client()
29 | assert not Error.objects.all().count()
30 | c.post(reverse("error-post"), data)
31 | assert Error.objects.all().count() == 1
32 | assert Error.objects.all()[0].public == True
33 |
34 | signals.error_created.disconnect(default_public.default_public, dispatch_uid="default_public")
--------------------------------------------------------------------------------
/listener/app_engine/error/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/app_engine/error/__init__.py
--------------------------------------------------------------------------------
/listener/app_engine/error/signals.py:
--------------------------------------------------------------------------------
1 | import django.dispatch
2 |
3 | error_created = django.dispatch.Signal(providing_args=["instance",])
4 | group_created = django.dispatch.Signal(providing_args=["instance",])
5 | group_assigned = django.dispatch.Signal(providing_args=["instance",])
--------------------------------------------------------------------------------
/listener/app_engine/error/templates/filter.html:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/listener/app_engine/error/templates/group.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 | {% block subnav %}{% include "subnav.html" %}{% endblock %}
3 | {% block content %}
4 |
5 | {% if page.object_list %}
6 |
7 |
8 |
9 |
Most recent
10 |
Status
11 |
Type
12 |
Count
13 |
Path
14 |
Project
15 |
Stage
16 |
17 |
18 | {% for group in page.object_list %}
19 |
{% with notification.user_list as list %}{{ list.0.username }}{% if list.count > 1 %}...{% endif %}{% endwith %}
26 |
{{ notification.tried|yesno }}
27 |
{{ notification.completed|yesno }}
28 |
{% if notification.error_msg %}{{ notification.error_msg }}{% endif %}
29 |
30 | {% endfor %}
31 |
32 |
33 | {% else %}
34 |
No notifications found. Could be you've not sent any errors yet and generated
35 | notifications. Or we've cleaned out this list of notifications. Or your
36 | notifications are not enabled. More than likely one of those.
No users found, which is a worry, how did you get here?
30 | {% endif %}
31 |
32 | {% include "pagination.html" %}
33 | {% endblock %}
--------------------------------------------------------------------------------
/listener/app_engine/users/urls.py:
--------------------------------------------------------------------------------
1 | from django.conf.urls.defaults import *
2 |
3 | urlpatterns = patterns('',
4 | url(r'^users/$', 'users.views.user_list', name="user-list"),
5 | url(r'^users/edit/(?P[\w-]+)/$', 'users.views.user_edit', name="user-edit"),
6 | )
7 |
--------------------------------------------------------------------------------
/listener/app_engine/users/utils.py:
--------------------------------------------------------------------------------
1 | from appengine_django.auth.models import User
2 |
3 | def approved_users():
4 | return User.all().filter("is_staff = ", True)
5 |
--------------------------------------------------------------------------------
/listener/app_engine/users/views.py:
--------------------------------------------------------------------------------
1 | from django.contrib.auth.decorators import user_passes_test
2 | from django.views.generic.simple import direct_to_template
3 | from django.http import HttpResponseRedirect
4 | from django.core.urlresolvers import reverse
5 |
6 | from appengine_django.auth.models import User
7 | from app.paginator import Paginator, get_page
8 |
9 | from users.forms import UserForm, ProfileForm
10 | from profiles.utils import get_profile
11 |
12 | @user_passes_test(lambda u: u.is_staff)
13 | def user_list(request):
14 | queryset = User.all()
15 | # this number doesn't need to be high and its quite an expensive
16 | # page to generate
17 | paginated = Paginator(queryset, 10)
18 | page = get_page(request, paginated)
19 | return direct_to_template(request, "user_list.html", extra_context={
20 | "page": page,
21 | "nav": {"selected": "setup"}
22 | })
23 |
24 | @user_passes_test(lambda u: u.is_staff)
25 | def user_edit(request, pk):
26 | user = User.get(pk)
27 | form = UserForm(request.POST or None, instance=user)
28 | profile = ProfileForm(request.POST or None, instance=get_profile(user))
29 | if form.is_valid() and profile.is_valid():
30 | form.save()
31 | profile.save()
32 | return HttpResponseRedirect(reverse("user-list"))
33 | return direct_to_template(request, "user_edit.html", extra_context={
34 | "form": form,
35 | "profile": profile,
36 | "nav": {"selected": "users",},
37 | })
38 |
39 |
--------------------------------------------------------------------------------
/listener/app_engine/userstorage/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/app_engine/userstorage/__init__.py
--------------------------------------------------------------------------------
/listener/app_engine/userstorage/middleware.py:
--------------------------------------------------------------------------------
1 | from userstorage.utils import activate, deactivate
2 |
3 | class UserStorage:
4 | def process_request(self, request):
5 | activate(request)
6 |
7 | def process_exception(self, request, exception):
8 | deactivate(request)
9 |
10 | def process_response(self, request, response):
11 | deactivate(request)
12 | return response
13 |
--------------------------------------------------------------------------------
/listener/app_engine/userstorage/utils.py:
--------------------------------------------------------------------------------
1 | from threading import currentThread
2 |
3 | _active = {}
4 |
5 | def activate(request):
6 | if request and request.user:
7 | _active[currentThread()] = request.user
8 |
9 | def deactivate(request):
10 | global _active
11 | if currentThread() in _active:
12 | del _active[currentThread()]
13 |
14 | def get_user():
15 | if currentThread() not in _active:
16 | return None
17 | return _active[currentThread()]
18 |
--------------------------------------------------------------------------------
/listener/docs/source/client/index.rst:
--------------------------------------------------------------------------------
1 | Arecibo clients
2 | ============================================
3 |
4 | Clients are the parts that send information to Arecibo using one of its API's.
5 |
6 | All clients can be found in the clients directory of the Arecibo source.
--------------------------------------------------------------------------------
/listener/docs/source/client/php.rst:
--------------------------------------------------------------------------------
1 | Sample PHP Client
2 | ====================================
3 |
4 | The PHP client allows you to easily send errors via HTTP. The PHP client can be used independently, or as part of a greater implementation. Quick example.
5 |
6 | .. code-block:: php
7 |
8 | "yourpublicaccountnumber",
12 | "status" => "403",
13 | "url" => "http://badphpapp.org"
14 | );
15 | post("http://yoursevers/v/1/", $fields);
16 | ?>
17 |
18 | Requirements
19 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 |
21 | * Tested on PHP 5.2.6.
22 |
23 | * If using the http client, permission to make a HTTP post to the Arecibo server is needed.
24 |
25 | Notes
26 | ~~~~~~~~~~~~~~~~~~~~~~~~~~
27 |
28 | * No values are automatically set.
--------------------------------------------------------------------------------
/listener/docs/source/client/ruby.rst:
--------------------------------------------------------------------------------
1 | Sample Ruby Client
2 | ====================================
3 |
4 | The Ruby client allows you to easily send errors via HTTP. The Ruby client can be used independently, or as part of a greater implementation. Quick example:
5 |
6 | .. code-block:: ruby
7 |
8 | require 'arecibo'
9 | dict = {
10 | :account => 'yourpublicaccountnumber',
11 | :priority => 1,
12 | :url => "http://badapp.org",
13 | :uid => "123124123123",
14 | :ip => "127.0.0.1",
15 | :type => "An error",
16 | :server => "Test Script"
17 | }
18 | p = Arecibo.new("http://yoursite/v/1/", dict)
19 | p.send
20 |
21 | Requirements
22 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 |
24 | * If using the http client, permission to make a HTTP post to the Arecibo server is needed.
25 |
26 | Notes
27 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28 |
29 | * No values are automatically set.
30 |
31 | * There is 10 second timeout set on the HTTP post to prevent hangs.
--------------------------------------------------------------------------------
/listener/docs/source/index.rst:
--------------------------------------------------------------------------------
1 | Arecibo documentation
2 | ===================================
3 |
4 | Contents:
5 |
6 | .. toctree::
7 | :maxdepth: 1
8 |
9 | introduction.rst
10 | server/installation.rst
11 | server/installation-appengine.rst
12 | server/useraccess.rst
13 | server/remoteaccess.rst
14 | server/customisation.rst
15 | server/concepts.rst
16 | client/index.rst
17 | client/post.rst
18 | client/variables.rst
19 | client/javascript.rst
20 | client/python.rst
21 | client/ruby.rst
22 | client/php.rst
23 | client/plone.rst
24 | client/django.rst
25 | client/rails.rst
26 | release.rst
27 |
28 | Indices and tables
29 | ==================
30 |
31 | * :ref:`genindex`
32 | * :ref:`modindex`
33 | * :ref:`search`
34 |
35 |
--------------------------------------------------------------------------------
/listener/docs/source/introduction.rst:
--------------------------------------------------------------------------------
1 | Introduction to Arecibo
2 | ==============================
3 |
4 | Arecibo is an error tracker. It allows you to log errors from web sites and collect them all in one location. It then allows you to prioritise and group them. Notifications can then be sent to developers of the errors.
5 |
6 | There are two main components to Arecibo:
7 |
8 | * client, this is normally a web application on residing on a server that sends an error into Arecibo. If there isn't an existing API for your application, then there's an API you can use to build your own.
9 |
10 | * server, this is your instance of Arecibo that you can use to receive errors.
11 |
12 | The server was written to run on App Engine in 2010. In 2011 a none App Engine port was made that should run in a "standard" environment. The App Engine port is essentially frozen now with no new updates. It works, but isn't realy developed. This situation may change, but if we can recommend a version to use, don't use the App Engine one.
13 |
14 | There is also a bit of feature fork between the two. Primarily the App Engine one has an Issue tracker. The none App Engine one does not. Because of it's use at Mozilla the none App Engine one has no need of an Issue tracker.
15 |
16 | The best way to get a feel for what Arecibo does, is to give the demo server a try. The details of the demo server are at http://www.areciboapp.com/demo
17 |
--------------------------------------------------------------------------------
/listener/docs/source/server/concepts.rst:
--------------------------------------------------------------------------------
1 | Server side models
2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 |
4 | The following describes the models that exist on the server side and their relationships.
5 |
6 | Error
7 | -------------------
8 |
9 | The error that has been recorded by the incoming receiver.
10 |
11 | Group
12 | -------------------
13 |
14 | A grouping of errors. Rather than dealing with individual errors, you might like to deal with groups. This is probably more advisable for tickets or tracking. When an error is written a signal is triggered. A default group method listens to this signal to place the error in a group. An error can only be in one group.
15 |
16 | Project
17 | -------------------
18 |
19 | A website or group of websites collected into a project. A project will have one or more domains. When an error is written a signal is triggered. A default project method listens to this signal to place the error within the appropriate project. An error can only be in one project
--------------------------------------------------------------------------------
/listener/docs/source/server/remoteaccess.rst:
--------------------------------------------------------------------------------
1 | Remote access (App Engine)
2 | ==========================================
3 |
4 | The instance on Google App Engine can be accessed by using the *remote_api*[1]_. A management command has been added to allow you to do this::
5 |
6 | python manage.py remote
7 | App Engine interactive console for test-areciboapp
8 | >>>
9 |
10 | You can then execute Python commands. To view the timestamp of the first error::
11 |
12 | >>> Error.all()[0].timestamp
13 | Username:***********@googlemail.com
14 | Password:
15 | datetime.datetime(2010, 6, 14, 16, 25, 49, 835365)
16 |
17 | Note that the console is not appropriate for tasks that do a large number of datastore requests, since each is a HTTP request. For example: batch altering of records - for that you'd be better off uploading a specific script.
18 |
19 | .. [1] http://code.google.com/appengine/articles/remote_api.html
--------------------------------------------------------------------------------
/listener/docs/source/server/scripts.rst:
--------------------------------------------------------------------------------
1 | Example scripts
2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 |
4 | These are some example scripts to work with Arecibo differently.
5 |
6 | Giving all users access automatically
7 | ---------------------------------------------------------
8 |
9 | In *custom/listeners.py*, add the following:
10 |
11 | .. code-block:: python
12 |
13 | from appengine_django.auth.signals import user_created
14 |
15 | def make_staff(sender, instance, **kw):
16 | if not instance.is_staff:
17 | instance.is_staff = True
18 | instance.save()
19 |
20 | user_created.connect(make_staff, dispatch_uid="make_staff")
21 |
--------------------------------------------------------------------------------
/listener/lib/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/lib/__init__.py
--------------------------------------------------------------------------------
/listener/lib/markdown/etree_loader.py:
--------------------------------------------------------------------------------
1 |
2 | from markdown import message, CRITICAL
3 | import sys
4 |
5 | ## Import
6 | def importETree():
7 | """Import the best implementation of ElementTree, return a module object."""
8 | etree_in_c = None
9 | try: # Is it Python 2.5+ with C implemenation of ElementTree installed?
10 | import xml.etree.cElementTree as etree_in_c
11 | except ImportError:
12 | try: # Is it Python 2.5+ with Python implementation of ElementTree?
13 | import xml.etree.ElementTree as etree
14 | except ImportError:
15 | try: # An earlier version of Python with cElementTree installed?
16 | import cElementTree as etree_in_c
17 | except ImportError:
18 | try: # An earlier version of Python with Python ElementTree?
19 | import elementtree.ElementTree as etree
20 | except ImportError:
21 | message(CRITICAL, "Failed to import ElementTree")
22 | sys.exit(1)
23 | if etree_in_c and etree_in_c.VERSION < "1.0":
24 | message(CRITICAL, "For cElementTree version 1.0 or higher is required.")
25 | sys.exit(1)
26 | elif etree_in_c :
27 | return etree_in_c
28 | elif etree.VERSION < "1.1":
29 | message(CRITICAL, "For ElementTree version 1.1 or higher is required")
30 | sys.exit(1)
31 | else :
32 | return etree
33 |
34 |
--------------------------------------------------------------------------------
/listener/lib/markdown/extensions/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/lib/markdown/extensions/__init__.py
--------------------------------------------------------------------------------
/listener/lib/userstorage/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/lib/userstorage/__init__.py
--------------------------------------------------------------------------------
/listener/lib/userstorage/middleware.py:
--------------------------------------------------------------------------------
1 | from userstorage.utils import activate, deactivate
2 |
3 | class UserStorage:
4 | def process_request(self, request):
5 | activate(request)
6 |
7 | def process_exception(self, request, exception):
8 | deactivate(request)
9 |
10 | def process_response(self, request, response):
11 | deactivate(request)
12 | return response
13 |
--------------------------------------------------------------------------------
/listener/lib/userstorage/utils.py:
--------------------------------------------------------------------------------
1 | from threading import currentThread
2 |
3 | _active = {}
4 |
5 | def activate(request):
6 | if request and request.user:
7 | _active[currentThread()] = request.user
8 |
9 | def deactivate(request):
10 | global _active
11 | if currentThread() in _active:
12 | del _active[currentThread()]
13 |
14 | def get_user():
15 | if currentThread() not in _active:
16 | return None
17 | return _active[currentThread()]
18 |
--------------------------------------------------------------------------------
/listener/media/css/ie.css:
--------------------------------------------------------------------------------
1 | /* -----------------------------------------------------------------------
2 |
3 |
4 | Blueprint CSS Framework 0.8
5 | http://blueprintcss.org
6 |
7 | * Copyright (c) 2007-Present. See LICENSE for more info.
8 | * See README for instructions on how to use Blueprint.
9 | * For credits and origins, see AUTHORS.
10 | * This is a compressed file. See the sources in the 'src' directory.
11 |
12 | ----------------------------------------------------------------------- */
13 |
14 | /* ie.css */
15 | body {text-align:center;}
16 | .container {text-align:left;}
17 | * html .column, * html div.span-1, * html div.span-2, * html div.span-3, * html div.span-4, * html div.span-5, * html div.span-6, * html div.span-7, * html div.span-8, * html div.span-9, * html div.span-10, * html div.span-11, * html div.span-12, * html div.span-13, * html div.span-14, * html div.span-15, * html div.span-16, * html div.span-17, * html div.span-18, * html div.span-19, * html div.span-20, * html div.span-21, * html div.span-22, * html div.span-23, * html div.span-24 {overflow-x:hidden;}
18 | * html legend {margin:0px -8px 16px 0;padding:0;}
19 | ol {margin-left:2em;}
20 | sup {vertical-align:text-top;}
21 | sub {vertical-align:text-bottom;}
22 | html>body p code {*white-space:normal;}
23 | hr {margin:-8px auto 11px;}
24 | .clearfix, .container {display:inline-block;}
25 | * html .clearfix, * html .container {height:1%;}
26 | fieldset {padding-top:0;}
--------------------------------------------------------------------------------
/listener/media/css/print.css:
--------------------------------------------------------------------------------
1 | /* -----------------------------------------------------------------------
2 |
3 |
4 | Blueprint CSS Framework 0.8
5 | http://blueprintcss.org
6 |
7 | * Copyright (c) 2007-Present. See LICENSE for more info.
8 | * See README for instructions on how to use Blueprint.
9 | * For credits and origins, see AUTHORS.
10 | * This is a compressed file. See the sources in the 'src' directory.
11 |
12 | ----------------------------------------------------------------------- */
13 |
14 | /* print.css */
15 | body {line-height:1.5;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;color:#000;background:none;font-size:10pt;}
16 | .container {background:none;}
17 | hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;}
18 | hr.space {background:#fff;color:#fff;}
19 | h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;}
20 | code {font:.9em "Courier New", Monaco, Courier, monospace;}
21 | img {float:left;margin:1.5em 1.5em 1.5em 0;}
22 | a img {border:none;}
23 | p img.top {margin-top:0;}
24 | blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;}
25 | .small {font-size:.9em;}
26 | .large {font-size:1.1em;}
27 | .quiet {color:#999;}
28 | .hide {display:none;}
29 | a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;}
30 | a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;}
--------------------------------------------------------------------------------
/listener/media/img/alert-overlay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/alert-overlay.png
--------------------------------------------------------------------------------
/listener/media/img/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/apple-touch-icon.png
--------------------------------------------------------------------------------
/listener/media/img/arecibo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/arecibo.png
--------------------------------------------------------------------------------
/listener/media/img/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/arrow.png
--------------------------------------------------------------------------------
/listener/media/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/favicon.ico
--------------------------------------------------------------------------------
/listener/media/img/logo-opacity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/logo-opacity.png
--------------------------------------------------------------------------------
/listener/media/img/priority-1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/priority-1.jpg
--------------------------------------------------------------------------------
/listener/media/img/priority-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/priority-2.jpg
--------------------------------------------------------------------------------
/listener/media/img/priority-3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/priority-3.jpg
--------------------------------------------------------------------------------
/listener/media/img/read.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/read.png
--------------------------------------------------------------------------------
/listener/media/img/status-fixed.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/status-fixed.jpg
--------------------------------------------------------------------------------
/listener/media/img/status-not-fixed.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/media/img/status-not-fixed.jpg
--------------------------------------------------------------------------------
/listener/normal/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/normal/__init__.py
--------------------------------------------------------------------------------
/listener/normal/app/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/normal/app/__init__.py
--------------------------------------------------------------------------------
/listener/normal/app/base.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andymckay/arecibo/eb6787ea0a276047ef5add2df67a4dd051e5c961/listener/normal/app/base.py
--------------------------------------------------------------------------------
/listener/normal/app/context.py:
--------------------------------------------------------------------------------
1 | from urllib import urlencode
2 | from django.conf import settings
3 |
4 |
5 | def context(request):
6 | data = {}
7 | data["request"] = request
8 | data["user"] = request.user
9 | data["public_key"] = settings.ARECIBO_PUBLIC_ACCOUNT_NUMBER
10 | data["private_key"] = settings.ARECIBO_PRIVATE_ACCOUNT_NUMBER
11 | data["site_url"] = settings.SITE_URL.strip()
12 | data["anonymous_access"] = settings.ANONYMOUS_ACCESS
13 |
14 | qs = request.GET.copy()
15 | if "page" in qs:
16 | del qs["page"]
17 |
18 | data["qs"] = ""
19 | if qs:
20 | data["qs"] = "%s" % urlencode(qs)
21 |
22 | return data
23 |
--------------------------------------------------------------------------------
/listener/normal/app/decorators.py:
--------------------------------------------------------------------------------
1 | from django.contrib.auth.decorators import user_passes_test
2 | from django.conf import settings
3 |
4 |
5 | def arecibo_login_required(func):
6 | return user_passes_test(lambda u: settings.ANONYMOUS_ACCESS or u.is_staff)(func)
--------------------------------------------------------------------------------
/listener/normal/app/errors.py:
--------------------------------------------------------------------------------
1 | from exceptions import Exception
2 |
3 | from django.template import RequestContext, loader
4 | from django.http import HttpResponse
5 |
6 |
7 | class StatusDoesNotExist(Exception): pass
8 |
9 |
10 | def not_found_error(request):
11 | t = loader.get_template('404.html')
12 | c = RequestContext(request)
13 | return HttpResponse(t.render(c), status=404)
14 |
15 |
16 | def application_error(request):
17 | t = loader.get_template('500.html')
18 | c = RequestContext(request)
19 | return HttpResponse(t.render(c), status=500)
--------------------------------------------------------------------------------
/listener/normal/app/fixtures/users.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "pk": 1,
4 | "model": "auth.user",
5 | "fields": {
6 | "username": "admin",
7 | "first_name": "",
8 | "last_name": "",
9 | "is_active": true,
10 | "is_superuser": true,
11 | "is_staff": true,
12 | "last_login": "2011-03-21 03:26:13",
13 | "groups": [],
14 | "user_permissions": [],
15 | "password": "sha1$5fb4a$f37fe533d025ec1f3d65504d4c26b3dedace29db",
16 | "email": "andy@clearwind.ca",
17 | "date_joined": "2011-03-15 17:02:45"
18 | }
19 | }
20 | ]
--------------------------------------------------------------------------------
/listener/normal/app/forms.py:
--------------------------------------------------------------------------------
1 | from django import forms
2 | from django.utils.html import conditional_escape
3 | from django.utils.encoding import force_unicode
4 | from django.utils.safestring import mark_safe
5 |
6 |
7 | def as_blue_print(self):
8 | return self._html_output(u"""
9 |
Create a new account, the administrator of this site will have to approve your access to the site.
12 | {% if not anonymous_access %}
An account is required to access any errors not open to the public.
{% endif %}
13 |
14 | {% else %}
15 | {% if not user.is_staff %}
16 |
You have logged in, but the admin has not granted you access yet. Please be patient.
17 | {% endif %}
18 | {% endif %}
19 |
20 |
Welcome to this Arecibo installation. Arecibo is an observatory, instead of listening to the stars, this site listens for errors from your sites. We pronounce it "Ah-reh-see-bow". If you have any questions about the site, please contact it's administrator.
{% with notification.user.all as list %}{{ list.0.username }}{% if list.count > 1 %}...{% endif %}{% endwith %}
26 |
{{ notification.tried|yesno }}
27 |
{{ notification.completed|yesno }}
28 |
{% if notification.error_msg %}{{ notification.error_msg }}{% endif %}
29 |
30 | {% endfor %}
31 |
32 |
33 | {% else %}
34 |
No notifications found. Could be you've not sent any errors yet and generated
35 | notifications. Or we've cleaned out this list of notifications. Or your
36 | notifications are not enabled. More than likely one of those.
It's possible to lock yourself out of this site.
28 | Full user administration, such as deleting users or fixing account passwords
29 | is available via the Django admin interface.
30 |