Changeset c547de5


Ignore:
Timestamp:
Nov 3, 2012, 4:16:53 PM (13 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, space-access, stable, stage
Children:
251503b
Parents:
5f1eaa3
git-author:
Alex Dehnert <adehnert@…> (11/03/12 16:16:53)
git-committer:
Alex Dehnert <adehnert@…> (11/03/12 16:16:53)
Message:

Improve the header of the exported HTML files

Files in question are /mit/asa-db/data/db-dump/{midway,website}_groups.html, as
generated by groups/format_groups.py midway and util/export_website_groups.py.

Added information:

  • Paths to /mit/asa-db/data/db-dump/*.html generated files (ASA-#134)
  • Timestamp of generation (ASA-#135)
  • Who can re-run the scripts (ASA-#136)
  • Which groups are included
Location:
asadb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • asadb/groups/format_groups.py

    ra7d30ef rc547de5  
    22
    33import csv
     4import datetime
    45import os
    56import sys
     
    4546    'midway' : {
    4647        'prefix': """
    47         <!-- Automatically generated by %(script)s %(mode)s.
    48         Do not edit; instead re-run that script (or edit it as necessary). -->
     48        <!--
     49        Automatically generated by %(script)s %(mode)s on %(date)s.
     50        Do not edit; instead ask a DB maintainer (asa-db@) to re-run that script (or edit script as necessary).
     51
     52        A more recent version may be in /mit/asa-db/data/db-dump/midway_groups.html.
     53        Includes active, suspended, applying, and NGE's (status) who aren't Dorm/FSILG (class).
     54        -->
    4955        """,
    5056        'format' : '<option value="%(html_name)s">%(html_name)s</option>',
     
    7480    predicate = spec['predicate']
    7581    gs = groups.models.Group.objects.filter(predicate).distinct()
    76     static_args = {'script': 'groups/format_groups.py', 'mode':mode, }
     82    static_args = {
     83        'script': 'groups/format_groups.py',
     84        'mode':mode,
     85        'date':datetime.datetime.now(),
     86    }
    7787    if 'prefix' in spec:
    7888        print spec['prefix'] % static_args
  • asadb/util/export_website_groups.py

    r884ab7c rc547de5  
    55
    66import codecs
     7import datetime
    78import os
    89import sys
     
    1819
    1920TMPL = Template(u"""
    20 <!-- Automatically generated by asadb/util/export_website_groups.py.
    21 Do not edit; instead re-run that script (or edit it as necessary). -->
     21<!--
     22Automatically generated by asadb/util/export_website_groups.py on {{date}}.
     23Do not edit; instead ask a DB maintainer (asa-db@) to re-run that script (or edit script as necessary).
     24
     25A more recent version may be in /mit/asa-db/data/db-dump/website_groups.html.
     26Includes groups with status is_active=True (ie, Suspended and Active groups).
     27-->
    2228{% for group in groups %}
    2329<tr><td>
     
    3238
    3339if __name__ == '__main__':
    34     ctx = Context(
    35         {'groups': groups.models.Group.objects.filter(group_status__is_active=True)}
    36     )
    37     out = codecs.getwriter('utf8')(sys.stdout)
     40    ctx = Context({
     41        'groups': groups.models.Group.objects.filter(group_status__is_active=True),
     42        'date': datetime.datetime.now(),
     43    })
     44    out = codecs.getwriter('utf-8')(sys.stdout)
    3845    out.write(TMPL.render(ctx))
Note: See TracChangeset for help on using the changeset viewer.