Introduced "MaskedEmail" and allow a masked email in the Gasthausbox.
[philipp/winterrodeln/wrpylib.git] / wrpylib / wrmwdb.py
1 #!/usr/bin/python2.6
2 # -*- coding: iso-8859-15 -*-
3 # $Id$
4 # $HeadURL$
5 """This module contains code to make tha access of winterrodeln
6 tables in MediaWiki easy. The module uses sqlalchemy to access the database.
7 """
8 from sqlalchemy import Table, Column, types, schema
9
10
11 def wrreport_table(metadata):
12     """Returns the sqlalchemy Table representing the "wrreport" Winterrodeln table in MediaWiki.
13     Current table definition.
14     * version 1.2
15     * version 1.3 (no changes)
16     * version 1.4 (no changes)
17     :param metadata: metadata = sqlalchemy.MetaData()
18     """
19     return Table("wrreport", metadata,
20     Column("id", types.Integer, primary_key=True),
21     Column("page_id", types.Integer, schema.ForeignKey('wrsledruncache.page_id')),
22     Column("page_title", types.Unicode(255), nullable=False),
23     Column("date_report", types.Date),
24     Column("date_entry", types.DateTime, nullable=False),
25     Column("date_invalid", types.DateTime),
26     Column("condition", types.Integer),
27     Column("description", types.Unicode),
28     Column("author_name", types.Unicode(30)),
29     Column("author_ip", types.Unicode(15)),
30     Column("author_userid", types.Integer),
31     Column("author_username", types.Unicode(30)),
32     Column("delete_date", types.DateTime),
33     Column("delete_person_name", types.Unicode(30)),
34     Column("delete_person_ip", types.Unicode(15)),
35     Column("delete_person_userid", types.Integer),
36     Column("delete_person_username", types.Unicode(30)),
37     Column("delete_reason_public", types.Unicode),
38     )
39
40
41 def wrsledruncache_table(metadata):
42     """Returns the sqlalchemy Table representing the "wrsledruncache" Winterrodeln table in MediaWiki.
43     Current table definition
44     * version 1.4 (renamed table and added column walkup_possible)
45     :param metadata: metadata = sqlalchemy.MetaData()
46     """
47     return Table("wrsledruncache", metadata,
48     Column("page_id", types.Integer, primary_key=True),
49     Column("page_title", types.Unicode(255)),
50     Column("position_latitude", types.Float),
51     Column("position_longitude", types.Float),
52     Column("top_latitude", types.Float),
53     Column("top_longitude", types.Float),
54     Column("top_elevation", types.Integer),
55     Column("bottom_latitude", types.Float),
56     Column("bottom_longitude", types.Float),
57     Column("bottom_elevation", types.Integer),
58     Column("length", types.Integer),
59     Column("difficulty", types.Integer),
60     Column("avalanches", types.Integer),
61     Column("operator", types.Unicode(255)),
62     Column("public_transport", types.Integer),
63     Column("walkup_possible", types.Boolean),
64     Column("walkup_time", types.Integer),
65     Column("walkup_separate", types.Float),
66     Column("walkup_separate_comment", types.Unicode(255)),
67     Column("lift", types.Boolean),
68     Column("lift_details", types.Unicode(255)),
69     Column("night_light", types.Float),
70     Column("night_light_comment", types.Unicode(255)),
71     Column("night_light_days", types.Integer),
72     Column("night_light_days_comment", types.Unicode(255)),
73     Column("sled_rental", types.Boolean),
74     Column("sled_rental_comment", types.Unicode(255)),
75     Column("cachet", types.Unicode(255)),
76     Column("information_web", types.Unicode(255)),
77     Column("information_phone", types.Unicode(255)),
78     Column("image", types.Unicode(255)),
79     Column("show_in_overview", types.Boolean),
80     Column("forum_id", types.Integer),
81     Column("under_construction", types.Boolean),
82     )
83
84
85 def wrinncache_table(metadata):
86     """Returns the sqlalchemy Table representing the "wrinncache" Winterrodeln table in MediaWiki.
87     Current table definition
88     * version 1.3 (changes made from version 1.2)
89     * version 1.4 (no changes)
90     :param metadata: metadata = sqlalchemy.MetaData()
91     """
92     return Table("wrinncache", metadata,
93     Column("page_id", types.Integer, primary_key=True),
94     Column("page_title", types.Unicode(255)),
95     Column("position_latitude", types.Float),
96     Column("position_longitude", types.Float),
97     Column("position_elevation", types.Integer),
98     Column("seats", types.Integer),
99     Column("overnight", types.Boolean),
100     Column("overnight_comment", types.Unicode(255)),
101     Column("smoker_area", types.Boolean),
102     Column("nonsmoker_area", types.Boolean),
103     Column("sled_rental", types.Boolean),
104     Column("sled_rental_comment", types.Unicode(255)),
105     Column("mobile_provider", types.Unicode),
106     Column("homepage", types.Unicode(255)),
107     Column("email_list", types.Unicode),
108     Column("phone_list", types.Unicode),
109     Column("image", types.Unicode(255)),
110     Column("sledding_list", types.Unicode),
111     Column("under_construction", types.Boolean),
112     )
113
114
115 def wrreportcache_table(metadata):
116     """Returns the sqlalchemy Table representing the "wrreportcache" Winterrodeln table in MediaWiki.
117     Current table definition.
118     * version 1.5 (introduction)
119     :param metadata: metadata = sqlalchemy.MetaData()
120     """
121     return Table("wrreportcache", metadata,
122     Column("page_id", types.Integer, primary_key=True),
123     Column("page_title", types.Unicode(255), nullable=False),
124     Column("report_id", types.Integer),
125     Column("date_report", types.Date),
126     Column("condition", types.Integer),
127     Column("description", types.Unicode),
128     Column("author_name", types.Unicode(30)),
129     Column("author_username", types.Unicode(30))
130     )
131
132