amon demo
Former-commit-id: 61cd4ae40c9e55260f37d323872a339d29f243f0
--- a/couchdb/settee/src/classes/SetteeDatabase.class.php
+++ b/couchdb/settee/src/classes/SetteeDatabase.class.php
@@ -267,12 +267,11 @@
if ($startdocid != null) {
$data .= "&startkey_docid='$startdocid'";
}
- if ($reduce != null) {
- if ($reduce == true) {
+ if ($reduce === true) {
$data .= "&reduce=true";
- } else {
+ } else if ($reduce === false){
+
$data .= "&reduce=false";
- }
}
if ($limit) {
$data .= "&limit=" . $limit;
@@ -314,3 +313,4 @@
}
}
+
--- a/couchdb/settee/src/classes/SetteeRestClient.class.php
+++ b/couchdb/settee/src/classes/SetteeRestClient.class.php
@@ -244,3 +244,4 @@
}
class SetteeRestClientException extends Exception {}
+
--- a/documents/scrapers/0049d35216493c545ef5f7f000e6b252.py
+++ b/documents/scrapers/0049d35216493c545ef5f7f000e6b252.py
@@ -2,7 +2,14 @@
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__) or '.', '../'))
import genericScrapers
-
+import traceback
+try:
+ import amonpy
+ amonpy.config.address = 'http://amon_instance:port'
+ amonpy.config.secret_key = 'the secret key from /etc/amon.conf'
+ amon_available = True
+except ImportError:
+ amon_available = False
class ScraperImplementation(genericScrapers.GenericPDFDisclogScraper):
@@ -15,5 +22,27 @@
genericScrapers.GenericPDFDisclogScraper)
print 'Instance:', isinstance(ScraperImplementation(),
genericScrapers.GenericPDFDisclogScraper)
- ScraperImplementation().doScrape()
+ try:
+ ScraperImplementation().doScrape()
+ except Exception, err:
+ sys.stderr.write('ERROR: %s\n' % str(err))
+ print ‘Error Reason: ‘, err.__doc__
+ print ‘Exception: ‘, err.__class__
+ print traceback.format_exc()
+ if amon_available:
+ data = {
+ 'exception_class': '',
+ 'url': '',
+ 'backtrace': ['exception line ', 'another exception line'],
+ 'enviroment': '',
+
+ # In 'data' you can add request information, session variables - it's a recursive
+ # dictionary, so you can literally add everything important for your specific case
+ # The dictionary doesn't have a specified structure, the keys below are only example
+ 'data': {'request': '', 'session': '', 'more': ''}
+ }
+
+ amonpy.exception(data)
+ pass
+
--- a/documents/template.inc.php
+++ b/documents/template.inc.php
@@ -157,8 +157,8 @@
function displayLogEntry($row, $idtoname) {
$result = "";
$result .= '<div itemscope itemtype="http://schema.org/Article">';
- $result .= '<h2> <span itemprop="datePublished">' . $row->value->date . "</span>: <span itemprop='name headline'>" . truncate($row->value->title, 120) . "</span>";
- $result .= ' (<span itemprop="author publisher creator">' . $idtoname[$row->value->agencyID] . '</span>)</h2>';
+ $result .= '<h2><a href="http://disclosurelo.gs/view.php?id='.$row->value->_id.'"> <span itemprop="datePublished">' . $row->value->date . "</span>: <span itemprop='name headline'>" . truncate($row->value->title, 120) . "</span>";
+ $result .= ' (<span itemprop="author publisher creator">' . $idtoname[$row->value->agencyID] . '</span>)</a></h2>';
$result .= "<p itemprop='description articleBody text'> Title: " . $row->value->title . "<br/>";
if (isset($row->value->description)) {
$result .= str_replace("\n", "<br>", preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "",trim($row->value->description)));
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -9,6 +9,7 @@
|| strstr($_SERVER['PHP_SELF'], "include/")
|| strstr($_SERVER['PHP_SELF'], "documents/")
|| $_SERVER['SERVER_NAME'] == "disclosurelo.gs"
+ || $_SERVER['SERVER_NAME'] == "www.disclosurelo.gs"
)
$basePath = "../";