diff options
author | Tim Laszlo <tim.laszlo@gmail.com> | 2010-10-14 15:28:58 -0500 |
---|---|---|
committer | Tim Laszlo <tim.laszlo@gmail.com> | 2010-10-14 15:28:58 -0500 |
commit | 7c0a9b20203e13a4da06fd79081215f712cceb38 (patch) | |
tree | 9e4372862491b36fa5ae5bf5a0f54676bfb930b4 /src/lib/Server/Reports/reports/templatetags/django_templating_sigh.py | |
parent | 2b0ea7df179353442712c830fb5c3a5164632d51 (diff) | |
download | bcfg2-7c0a9b20203e13a4da06fd79081215f712cceb38.tar.gz bcfg2-7c0a9b20203e13a4da06fd79081215f712cceb38.tar.bz2 bcfg2-7c0a9b20203e13a4da06fd79081215f712cceb38.zip |
web reports: new skin
Diffstat (limited to 'src/lib/Server/Reports/reports/templatetags/django_templating_sigh.py')
-rw-r--r-- | src/lib/Server/Reports/reports/templatetags/django_templating_sigh.py | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/lib/Server/Reports/reports/templatetags/django_templating_sigh.py b/src/lib/Server/Reports/reports/templatetags/django_templating_sigh.py deleted file mode 100644 index c0d05d2c1..000000000 --- a/src/lib/Server/Reports/reports/templatetags/django_templating_sigh.py +++ /dev/null @@ -1,41 +0,0 @@ -from django import template -#from Bcfg2.Server.Reports.reports.models import Client, Interaction, Bad, Modified, Extra - -register = template.Library() - -def set_interaction(parser, token): - try: - # Splitting by None == splitting by spaces. - tag_name, format_string = token.contents.split(None, 1) - except ValueError: - raise template.TemplateSyntaxError, "%r tag requires an argument" % token.contents[0] - if not (format_string[0] == format_string[-1] and format_string[0] in ('"', "'")): - raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name - return SetInteraction(format_string[1:-1]) - -def sortwell(value): - "sorts a list(or evaluates queryset to list) of bad, extra, or modified items in the best" - "way for presentation" - configItems = list(value) - configItems.sort(lambda x,y: cmp(x.entry.name, y.entry.name)) - configItems.sort(lambda x,y: cmp(x.entry.kind, y.entry.kind)) - return configItems -def sortname(value): - "sorts a list( or evaluates queryset) by name" - configItems = list(value) - configItems.sort(lambda x,y: cmp(x.name, y.name)) - return configItems - -class SetInteraction(template.Node): - def __init__(self, times): - self.times = times#do soemthing to select different interaction with host? - def render(self, context): - try: - context['interaction'] = context['client_interaction_dict'][context['client'].id] - except:#I don't fully know what the implications of this are. - pass - return '' - -register.tag('set_interaction', set_interaction) -register.filter('sortwell', sortwell) -register.filter('sortname', sortname) |