def init(self, data_path=None): if not data_path: data_path = self.data_path # FIXME: direct substitution into path, hardcoded namespace/app ID from benome.sql_db import Graph db_path = '/opt/benome/data/%s/sql.db' % self.user_id g = Graph(root_context_id=1000, db_path=db_path) g.load(1, ['1', '2001']) self.data = g return True
if interval not in intervals: interval = 'day' days = generate_days(interval, day, month, year, begin_date=begin_date) if interval == 'day': max_depth = None leaf_notes = True elif interval == 'week': if max_depth is None: max_depth = 4 elif interval == 'month': if max_depth is None: max_depth = 4 period_idx = gen_idx(g, 86400, len(days), (days[-1] + 1) * 86400) root = g.get_context(root_context_id) report_data = generate_report_days(root, period_idx, days, max_depth, leaf_notes, leaf_note_timing) report = construct_report(report_data, days, root.label, public=public) return report if __name__ == '__main__': from benome.sql_db import Graph db_path = sys.argv[1] g = Graph(root_context_id=1000, db_path=db_path) g.load(1, ['1', '2001']) root_context = g.get_root() print get_report(root_context, 'month', month=11, year=2015)