Commit 1de86b6c authored by Arthur Lutz's avatar Arthur Lutz
Browse files

skip unknown eid and pretty print

parent 2495e993f1cf
......@@ -9,7 +9,7 @@ This command will generate webstats objects for all linked document types.
from datetime import datetime
from import first_day, last_day
from cubicweb import cwconfig
from cubicweb import cwconfig, UnknownEid
from cubicweb import AuthenticationError
from cubicweb.dbapi import in_memory_repo_cnx
......@@ -89,7 +89,11 @@ class UpdateWebstatsCommand(Command):
for eid, values in count_dict.items():
visit_count = visit_count_rdf = 0
total_hits = sum([item[0] for item in values])
entity = session.entity_from_eid(eid)
entity = session.entity_from_eid(eid)
except UnknownEid:
update_stats['skipped'] += 1
if not entity.__regid__ in allowed_types:
update_stats['skipped'] += 1
......@@ -115,7 +119,12 @@ class UpdateWebstatsCommand(Command):
stats_about = entity,
hit_type=is_rdf and u'rdf' or u'normal')
print update_stats
print '''=== Update Report ===
Number of stat objects created : %(created)s
Number of stat objects updated : %(updated)s
Number of stat objects already existed : %(exists no change)s
Number of stat objects skipped : %(skipped)s
''' % update_stats
def _init_cw_connection(self, appid):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment