To show only bot edits go to: /recentchanges?bot=only
To hide bot edits go to: /recentchanges?bot=hide
Below is a patch to infogami. In this implementation a user is considered to be a bot if the username ends in 'Bot'. This could be changed to check a usergroup or a bot flag in /type/user.
@public
-def get_recent_changes(key=None, author=None, ip=None, type=None, limit=None, offset=None):
+def get_recent_changes(key=None, author=None, ip=None, type=None, bot=None, limit=None, offset=None):
q = {'sort': '-created'}
if key is not None:
q['key'] = key
@@ -68,6 +68,8 @@ def get_recent_changes(key=None, author=None, ip=None, type=None, limit=None, of
q['limit'] = limit or 100
q['offset'] = offset or 0
+ if bot:
+ q['bot'] = bot
result = web.ctx.site.versions(q)
for r in result:
r.thing = web.ctx.site.get(r.key, r.revision, lazy=True)
diff --git a/infogami/infobase/dbstore.py b/infogami/infobase/dbstore.py
index f21a054..86b4543 100644
--- a/infogami/infobase/dbstore.py
+++ b/infogami/infobase/dbstore.py
@@ -568,6 +568,15 @@ class DBSiteStore(common.SiteStore): key = 'transaction.' + key
where += web.reparam(' AND %s=$value' % key, locals())
+
+ if query.bot:
+ iter = self.db.query("select id from thing where key like '/user/%%Bot'")
+ bots = '(' + ','.join(str(i.id) for i in iter) + ')'
+ if query.bot == 'only':
+ where += ' AND author_id in ' + bots
+ else:
+ assert query.bot == 'hide'
+ where += ' AND author_id not in ' + bots
Here is my implementation of this feature. These two lines need to be in /macros/ RecentChanges:
$ bot = query_param('bot', None) changes( author= author, ip=ip, type=type, bot=bot, limit=limit, offset=page * limit)
$ changes = get_recent_
To show only bot edits go to: /recentchanges? bot=only bot=hide
To hide bot edits go to: /recentchanges?
Below is a patch to infogami. In this implementation a user is considered to be a bot if the username ends in 'Bot'. This could be changed to check a usergroup or a bot flag in /type/user.
diff --git a/infogami/ core/db. py b/infogami/ core/db. py core/db. py core/db. py preferences( user): user.key + '/preferences')
index 7d9bf73..b6d98c2 100644
--- a/infogami/
+++ b/infogami/
@@ -52,7 +52,7 @@ def get_user_
return get_version(
@public changes( key=None, author=None, ip=None, type=None, limit=None, offset=None): changes( key=None, author=None, ip=None, type=None, bot=None, limit=None, offset=None): changes( key=None, author=None, ip=None, type=None, limit=None, of
-def get_recent_
+def get_recent_
q = {'sort': '-created'}
if key is not None:
q['key'] = key
@@ -68,6 +68,8 @@ def get_recent_
q['limit'] = limit or 100 site.versions( q) site.get( r.key, r.revision, lazy=True) infobase/ dbstore. py b/infogami/ infobase/ dbstore. py infobase/ dbstore. py infobase/ dbstore. py common. SiteStore) :
key = 'transaction.' + key
q['offset'] = offset or 0
+ if bot:
+ q['bot'] = bot
result = web.ctx.
for r in result:
r.thing = web.ctx.
diff --git a/infogami/
index f21a054..86b4543 100644
--- a/infogami/
+++ b/infogami/
@@ -568,6 +568,15 @@ class DBSiteStore(
where += web.reparam(' AND %s=$value' % key, locals()) query(" select id from thing where key like '/user/%%Bot'")
+
+ if query.bot:
+ iter = self.db.
+ bots = '(' + ','.join(str(i.id) for i in iter) + ')'
+ if query.bot == 'only':
+ where += ' AND author_id in ' + bots
+ else:
+ assert query.bot == 'hide'
+ where += ' AND author_id not in ' + bots
sort = query.sort ('-'): infobase/ readquery. py b/infogami/ infobase/ readquery. py infobase/ readquery. py infobase/ readquery. py query(store, query):
if sort and sort.startswith
diff --git a/infogami/
index 1a9c679..58c0828 100644
--- a/infogami/
+++ b/infogami/
@@ -233,6 +233,7 @@ def make_versions_
if q.limit > 1000:
q.limit = 1000
q.sort = query.pop('sort', '-created')
+ q.bot = query.pop('bot', None)
columns = ['key', 'type', 'revision', 'author', 'comment', 'machine_comment', 'ip', 'created']