Mercurial > getan
changeset 406:84f9b1eeb8b6
CHANGES updated. AUTHOR BER added. zeiterfassung.py removed.
* zeiterfassung.py is completely replaced by "getan-eval.py".
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Fri, 10 Feb 2017 15:30:56 +0100 |
parents | 150180e972d3 |
children | ee98d0b45967 |
files | CHANGES getan/config.py getan/states.py scripts/zeiterfassung.py |
diffstat | 4 files changed, 13 insertions(+), 105 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES Fri Feb 10 15:01:07 2017 +0100 +++ b/CHANGES Fri Feb 10 15:30:56 2017 +0100 @@ -1,14 +1,22 @@ UNRELEASED +1.2 X.Y.2017 + + * Already written entries can now be adjusted for start_time and length. + + * Added contrib/getan-report.py, a script to write a daily report. + * Added a template rendering module bases on jinja2. - * zeiterfassung.py is re-written to use the new template based rendering. + * Cleanup: All scripts are now in the directory 'scripts'. * getan-eval.py can be used as a main entry point for user templates. User templates are loaded from ~/.getan/templates and can be used via the --template option. E.g. getan-eval.py --template=mytemplate will try to load ~/.getan/templates/mytemplate. + * zeiterfassung.py is replaced by 'getan-eval.py -t zeiterfassung' + 1.1 03.03.2014
--- a/getan/config.py Fri Feb 10 15:01:07 2017 +0100 +++ b/getan/config.py Fri Feb 10 15:30:56 2017 +0100 @@ -2,6 +2,8 @@ # -*- coding: utf-8 -*- # # (c) 2010 by Ingo Weinzierl <ingo.weinzierl@intevation.de> +# (c) 2017 by Intevation +# Author: Bernhard.Reiter@intevation.de # # This is Free Software licensed under the terms of GPLv3 or later. # For details see LICENSE coming with the source of 'getan'.
--- a/getan/states.py Fri Feb 10 15:01:07 2017 +0100 +++ b/getan/states.py Fri Feb 10 15:30:56 2017 +0100 @@ -3,6 +3,8 @@ # # (c) 2010 by Ingo Weinzierl <ingo.weinzierl@intevation.de> # (c) 2011, 2012, 2014 by Björn Ricks <bjoern.ricks@intevation.de> +# (c) 2017 Intevation GmbH +# Author: Bernhard.Reiter@intevation.de # # This is Free Software licensed under the terms of GPLv3 or later. # For details see LICENSE coming with the source of 'getan'.
--- a/scripts/zeiterfassung.py Fri Feb 10 15:01:07 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# zeiterfassung -# ------------- -# (c) 2008 by Sascha L. Teichmann <sascha.teichmann@intevation.de> -# (c) 2011, 2012 by Björn Ricks <bjoern.ricks@intevation.de> -# -# Simple script which generates lines for zeiterfassung.txt files. -# -# This is Free Software licensed under the terms of GPLv3 or later. -# For details see LICENSE coming with the source of 'getan'. -# -import sys -import getopt -import codecs -import locale - -from datetime import datetime, timedelta - -from getan.template import render - -DEFAULT_DATABASE = "time.db" - -ZEITERFASSUNG_TEMPLATE = "zeiterfassung" - -USAGE = '''usage: %s <options> - with <options> - [--user=|-u <user>] : Name of user, default: $USER - [--database=|-d <database>]: getan database, default: time.db - [--project=|-p <key>] : Key of output project, default: all - [--encoding=|-e encoding] : encoding of output, default: none - [--week=]|-w <week>] : week of year - [--year=]|-y <year>] : year - [--list|-l] : list all projects - [--help|-h] : This text - [--emtpy|-m] : show empty projects - [--lastweek|-c] : entries of last working week - [--template|-t <template>] : jinja2 template to use, default: zeiterfassung -''' - - -def usage(exit_code=0): - print USAGE % sys.argv[0], - sys.exit(exit_code) - - -def main(): - - database = DEFAULT_DATABASE - user = None - list_projects = False - project = None - encoding = None - week = None - year = None - empty_proj = False - database = None - template = ZEITERFASSUNG_TEMPLATE - - opts, args = getopt.getopt( - sys.argv[1:], - 'd:u:p:e:hl:w:y:mct:', - ['database=', 'user=', 'project=', 'encoding=', 'help', 'list', 'week=', - 'year=', 'empty', 'lastweek', 'template=']) - - for opt, val in opts: - if opt in ("--database", "-d"): - database = val - elif opt in ("--user", "-u"): - user = val - elif opt in ("--project", "-p"): - project = val - elif opt in ("--encoding", "-e"): - encoding = val - elif opt in ("--help", "-h"): - usage() - elif opt in ("--list", "-l"): - list_projects = True - elif opt in ("--year", "-y"): - year = int(val) - elif opt in ("--week", "-w"): - week = int(val) - elif opt in ("--lastweek", "-c") and not week: - week = (datetime.now() - timedelta(7)).isocalendar()[1] - elif opt in ("--empty", "-m"): - empty_proj = True - elif opt in ("--template", "-t"): - template = val - - if not encoding: - encoding = locale.getdefaultlocale()[1] - - Writer = codecs.getwriter(encoding) - sys.stdout = Writer(sys.stdout) - - print render(user=user, database=database, week=week, year=year, - template=template, project=project, empty_projects=empty_proj) - - -if __name__ == '__main__': - main() - -# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8: