Exemple #1
0
 def __init__(self, blog, year, month=0, day=0):
     BlogEntries.__init__(self, blog)
     self.year = year
     self.month = month
     if month:
         self.monthname = mname = monthname(month)
         self.monthname_long = mname_long = monthname_long(month)
         self.monthkey = monthkey = (
             "{:02d}".format(month) if not self.archive_use_monthnames else
             mname if not self.archive_long_monthnames else
             mname_long
         )
     else:
         self.monthname = self.monthname_long = self.monthkey = ""
     self.day = day
     self.daykey = daykey = "{:02d}".format(day)
     
     if month:
         if day:
             self.sortkey = (year, month, day)
             self.urlshort = "/{0}/{1}/{2}/".format(year, monthkey, daykey)
             self.default_title = self.archive_day_template
         else:
             self.sortkey = (year, month)
             self.urlshort = "/{0}/{1}/".format(year, monthkey)
             self.default_title = self.archive_month_template
     else:
         self.sortkey = (year,)
         self.urlshort = "/{}/".format(year)
         self.default_title = self.archive_year_template
     
     if self.prefix:
         self.urlshort = "/{0}{1}".format(self.prefix, self.urlshort)
Exemple #2
0
 def __init__(self, blog, year, month=0, day=0):
     BlogEntries.__init__(self, blog)
     self.year = year
     self.month = month
     if month:
         self.monthname = mname = monthname(month)
         self.monthname_long = mname_long = monthname_long(month)
         self.monthkey = monthkey = (
             "{:02d}".format(month) if not self.archive_use_monthnames else
             mname if not self.archive_long_monthnames else
             mname_long
         )
     else:
         self.monthname = self.monthname_long = self.monthkey = ""
     self.day = day
     self.daykey = daykey = "{:02d}".format(day)
     
     if month:
         if day:
             self.sortkey = (year, month, day)
             self.urlshort = "/{0}/{1}/{2}/".format(year, monthkey, daykey)
             self.default_title = self.archive_day_template
         else:
             self.sortkey = (year, month)
             self.urlshort = "/{0}/{1}/".format(year, monthkey)
             self.default_title = self.archive_month_template
     else:
         self.sortkey = (year,)
         self.urlshort = "/{}/".format(year)
         self.default_title = self.archive_year_template
     
     if self.prefix:
         self.urlshort = "/{0}{1}".format(self.prefix, self.urlshort)
Exemple #3
0
 def argstr(self, sep, *args):
     if (len(args) > 1) and self.archive_use_monthnames:
         arg1 = (
             monthname_long(args[1]) if self.archive_long_monthnames
             else monthname(args[1])
         )
         args = (args[0], arg1) + args[2:]
     return sep.join(
         str(arg).rjust(2, '0') for arg in args
     )
Exemple #4
0
 def timestamp_attrfuncs(self):
     return dict(
         year=None,
         month=None,
         day=None,
         hour=None,
         minute=None,
         second=None,
         weekdayname=lambda t: weekdayname(t.weekday(), dt=True),
         weekdayname_long=lambda t: weekdayname_long(t.weekday(), dt=True),
         monthname=lambda t: monthname(t.month),
         monthname_long=lambda t: monthname_long(t.month))
Exemple #5
0
 def timestamp_attrfuncs(self):
     return dict(
         year=None,
         month=None,
         day=None,
         hour=None,
         minute=None,
         second=None,
         weekdayname=lambda t: weekdayname(t.weekday(), dt=True),
         weekdayname_long=lambda t: weekdayname_long(t.weekday(), dt=True),
         monthname=lambda t: monthname(t.month),
         monthname_long=lambda t: monthname_long(t.month)
     )
Exemple #6
0
 def argstr(self, sep, *args):
     if (len(args) > 1) and self.archive_use_monthnames:
         arg1 = (monthname_long(args[1])
                 if self.archive_long_monthnames else monthname(args[1]))
         args = (args[0], arg1) + args[2:]
     return sep.join(str(arg).rjust(2, '0') for arg in args)