def getMonthText(self, short_txt): # Make sure range is valid if (self.mMonth < 1) or (self.mMonth > 12): return "" else: return locale.getMonth(self.mMonth, [locale.SHORT, locale.LONG][not short_txt])
def getMonthText(self, short_txt): # Make sure range is valid if (self.mMonth < 1) or (self.mMonth > 12): return "" else: return locale.getMonth( self.mMonth, [locale.SHORT, locale.LONG][not short_txt] )
def getLocaleDate(self, dateTimeFormat): buf = StringIO.StringIO() if dateTimeFormat == DateTime.FULLDATE: buf.write(locale.getDay(self.getDayOfWeek(), locale.LONG)) buf.write(", ") buf.write(locale.getMonth(self.mMonth, locale.LONG)) buf.write(" ") buf.write(str(self.mDay)) buf.write(", ") buf.write(str(self.mYear)) elif dateTimeFormat == DateTime.ABBREVDATE: buf.write(locale.getDay(self.getDayOfWeek(), locale.SHORT)) buf.write(", ") buf.write(locale.getMonth(self.mMonth, locale.SHORT)) buf.write(" ") buf.write(str(self.mDay)) buf.write(", ") buf.write(str(self.mYear)) elif dateTimeFormat == DateTime.NUMERICDATE: buf.write(str(self.mMonth)) buf.write("/") buf.write(str(self.mDay)) buf.write("/") buf.write(str(self.mYear)) elif dateTimeFormat == DateTime.FULLDATENOYEAR: buf.write(locale.getDay(self.getDayOfWeek(), locale.LONG)) buf.write(", ") buf.write(locale.getMonth(self.mMonth, locale.LONG)) buf.write(" ") buf.write(str(self.mDay)) elif dateTimeFormat == DateTime.ABBREVDATENOYEAR: buf.write(locale.getDay(self. getDayOfWeek(), locale.SHORT)) buf.write(", ") buf.write(locale.getMonth(self.mMonth, locale.SHORT)) buf.write(" ") buf.write(str(self.mDay)) elif dateTimeFormat == DateTime.NUMERICDATENOYEAR: buf.write(str(self.mMonth)) buf.write("/") buf.write(str(self.mDay)) return buf.getvalue()