def test_convert_good_cvsdate(self):
        """dateutils - conversion of good CVS dates"""
        # here we have to use '$' + 'Date...' here, otherwise the CVS
        # commit would erase this time format to put commit date:
        datecvs = "$" + "Date: 2006/09/21 10:07:22 $"
        datestruct_beginning_expected = (2006, 9, 21, 10, 7, 22)
        self.assertEqual(dateutils.convert_datecvs_to_datestruct(datecvs)[:6], datestruct_beginning_expected)

        datecvs = "$Id: dateutils_tests.py,v 1.6 2007/02/14 18:33:02 tibor " "Exp $"
        datestruct_beginning_expected = (2007, 2, 14, 18, 33, 2)
        self.assertEqual(dateutils.convert_datecvs_to_datestruct(datecvs)[:6], datestruct_beginning_expected)
Example #2
0
    def tmpl_pagefooter(self, req, **kwargs):
        """Creates a page footer

           Parameters:

          - 'ln' *string* - The language to display

          - 'lastupdated' *string* - when the page was last updated

          - 'pagefooteradd' *string* - additional page footer HTML code

           Output:

          - HTML code of the page headers
        """
        ctx = dict(ln=CFG_SITE_LANG, lastupdated=None, pagefooteradd=None)
        ctx.update(kwargs)
        lastupdated = ctx.get('lastupdated')
        if lastupdated and lastupdated != '$Date$':
            if lastupdated.startswith("$Date: ") or lastupdated.startswith("$Id: "):
                ctx['lastupdated'] = convert_datecvs_to_datestruct(lastupdated)

        return render_template_to_string(
            "legacy_page.html",
            no_pagebody=True,
            no_pageheader=True,
            **ctx
        ).encode('utf8')
 def test_convert_bad_cvsdate(self):
     """dateutils - conversion of bad CVS dates"""
     # here we have to use '$' + 'Date...' here, otherwise the CVS
     # commit would erase this time format to put commit date:
     datecvs = "$" + "Date: 2006/AA/21 10:07:22 $"
     datestruct_beginning_expected = (0, 0, 0, 0, 0, 0)
     self.assertEqual(dateutils.convert_datecvs_to_datestruct(datecvs)[:6], datestruct_beginning_expected)
Example #4
0
    def tmpl_pagefooter(self, req, **kwargs):
        """Creates a page footer

           Parameters:

          - 'ln' *string* - The language to display

          - 'lastupdated' *string* - when the page was last updated

          - 'pagefooteradd' *string* - additional page footer HTML code

           Output:

          - HTML code of the page headers
        """
        ctx = dict(ln=CFG_SITE_LANG, lastupdated=None, pagefooteradd=None)
        ctx.update(kwargs)
        lastupdated = ctx.get('lastupdated')
        if lastupdated and lastupdated != '$Date$':
            if lastupdated.startswith("$Date: ") or lastupdated.startswith(
                    "$Id: "):
                ctx['lastupdated'] = convert_datecvs_to_datestruct(lastupdated)

        return render_template_to_string("legacy_page.html",
                                         no_pagebody=True,
                                         no_pageheader=True,
                                         **ctx).encode('utf8')