Configfile

All scripts in this repository use one shared configuration file read using the python ConfigParser package. The config file is read by the utils.readconfig() method which returns a dict object containing all the required information.

[database]
Database configuration containing specification for mysql server access, namely host, username, password and database name to the database where the Wordpress with the Wetterturnier Wordpress Plugin is installed. Details see database table documentation. The argument mysql_prefix specifies the wordpress table prefix and can be different from wp_ (wordpress defaulut) if needed. mysql_obstable specifies the database where the observations are stored (see table description).
[migrate]

NOTE do not remove all settings as some are used in the live system, e.g., wpconfig setting. This is used in database.database.create_user() using the wordpress API. Large parts are depricated. Used to migrate the data from the old wetterturnier system to the new one on Wetterturnier.de. Only datelock is still used.

Todo

Remove in the near future. To keep the feature: move the datelock into the global config.

[judging]
Defines (via int) which judging class should be used. The scripts will dynamically load the judgingclass object matching this specification. Can be used of the rules/judging are getting changed.
[system]

Depricated, used for migration.

Todo

Remove in the near future.

[stations]

Depricated, used for migration.

Todo

Remove in the near future.

The ../config.conf.template configuration file

Note

The scripts expect the config file to be located in the root directory named :file:config.conf. This is the template, please read the getting started section for more information.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
# -------------------------------------------------------------------
# - NAME:        config.conf.template 
# - AUTHOR:      Reto Stauffer
# - DATE:        2014-07-07
# -------------------------------------------------------------------
# - DESCRIPTION: Template for the config.conf file. By default the
#                config file is expected to be named config.conf
#                in the same directory as the python scripts.
#                You can start making a copy of this file and adjust
#                the settings (mainly mysql config).
#
#                cp config.conf.template config.conf
#                vim config.conf # edit the settings
# -------------------------------------------------------------------
# - EDITORIAL:   2014-07-07, RS: Created file.
# -------------------------------------------------------------------


# - Db stuff
[database]
mysql_host   = localhost
mysql_user   = ********
mysql_pass   = ********
mysql_db     = ********
mysql_prefix = wp_

mysql_obstable = obs.live

# - Some flags used for the migration of wetterturnier.de
#   to the new system. Probably outdatet now.
[migrate]
mitspieler              = False
mitspielerfile          = data/mitspieler.dat
groups                  = True

# Prevent computing dates before 17518
# This argument will be parsed by eval. The check is
# if tdate 'xxxxxx'. If this condition is true, the
# datelock method will return 'false' (date is locked,
# you should not compute this date!
# If commented (not set) will be ignore.
datelock                = < 17518

citytags                = b,i,w,z,l

# - Boolean. Whether the python script is allowed to
#   create new users or should exit.
allow_create_users      = True

# - To create users properly, we need to use the
#   wordpress intrinsic function wp_create_user. Therefore
#   we need the location of the wp-config.php file. Path here.
wpconfig                = /var/www/html/wp-config.php

# - Some directories where all the data are stored. 
#   moses: location of the latest moses coefficient files
#   moses_out: location where to copy newest files (to allow
#   the users to see the coefficients). If folder does not
#   exist it will simply be ignored.
[data]
moses                   = /home/knuepffer/abgabe
moses_out               = /var/www/html/referrerdata/moses

# - IMPORTANT: name of the current judgingclass. The
#   judgingclass is the script which computes the points
#   for the players. There are two scripts, one is
#   the ComputePoints routine, the other one is a test
#   routine called TestPoints. For development purpses
#   you can set them separately (e.g., develop a new
#   judginglcass, test it with TestPoints before
#   you use the new judgingclass for the live points
#   in ComputePoints).
#   judgingclasses are Python modules located in the
#   PyModule directory identified by a file named
#   'judgingclassYYYYMMDD.py' where the config here
#   defines the 'YYYYMMDD'.
[judging]

operational = 20021206
test        = 20021206

# - Some system relevant thigns
[system]
# - Rawdir is a directory containing some files which were
#   used to import old wetterturnier data. Should not be
#   used anymore as soon as the new system is fully online.
rawdir                  = raw

# - We have to convert observation station numbers into
#   wmo station number. Therefore this config is necessary.
#   name: as printed in the archive files, wmo number as integer.
[stations]
Innsbruck-Kranebitten   = 11120
Uni_Innsbruck           = 11320
Tempelhof               = 10384
Tegel                   = 10382
Schoenefeld             = 10385
Hohe_Warte              = 11035
Schwechat               = 11036
Zuerich                 = 06660
Z-Kloten                = 06670
LeipzigSchkeuditz       = 10469
Leipzig                 = 10471