def formatmonthname(self, theyear, themonth, withyear=True):
        """
        Return a month name as a table row.
        """

        if withyear:
            with different_locale(self.locale):
                s = '%s %s' % (month_name[themonth], theyear)
        else:
            with different_locale(self.locale):
                s = '%s' % month_name[themonth]
        return "<tr><th colspan='7' class='%s'><button class='prev_month cal_button' ><< </button>&nbsp&nbsp%s&nbsp&nbsp<button class='next_month cal_button'> >> </button></th></tr>" % (
            self.cssclass_month_head, s)
예제 #2
0
def get_localized_months(lang):
    lc = {
          'it': ('it_IT', 'UTF-8'),
          'en': ('en_US', 'UTF-8'),
          'es': ('es_ES', 'UTF-8'),
          }
    with calendar.different_locale(lc[lang]):
        return {i: calendar.month_name[i].title() for i in range(1, 13)}
예제 #3
0
파일: archive.py 프로젝트: ralsina/nikola
def get_month_name(month_no, locale):
    if sys.version_info[0] == 3:  # Python 3
        with calendar.different_locale((locale, "UTF-8")):
            s = calendar.month_name[month_no]
    else:  # Python 2
        with calendar.TimeEncoding((locale, "UTF-8")):
            s = calendar.month_name[month_no]
    return s
예제 #4
0
def get_month_name(month_no, locale):
    if sys.version_info[0] == 3:  # Python 3
        with calendar.different_locale((locale, "UTF-8")):
            s = calendar.month_name[month_no]
    else:  # Python 2
        with calendar.TimeEncoding((locale, "UTF-8")):
            s = calendar.month_name[month_no]
    return s
예제 #5
0
def month_name(month_no: int, abbr: bool = False, locale: str = None) -> str:
    if locale is None:
        locale = session['locale']
    full_locale = _get_full_locale(locale)
    with calendar.different_locale(full_locale):
        if abbr:
            return calendar.month_abbr[month_no]
        else:
            return calendar.month_name[month_no]
예제 #6
0
    def test_type_of_month_name(self):
        """validate assumption calendar month name is of type str

        Yes, both in windows and linuxTravis, py 26, 27, 33
        """
        import calendar
        with calendar.different_locale(loc_11):
            s = calendar.month_name[1]
        self.assertTrue(type(s) == str)
예제 #7
0
def day_name(dow: int, abbr: bool = True, locale: str = None) -> str:
    if locale is None:
        locale = session['locale']
    full_locale = _get_full_locale(locale)
    with calendar.different_locale(full_locale):
        if abbr:
            return calendar.day_abbr[dow]
        else:
            return calendar.day_name[dow]
예제 #8
0
    def setup(self):
        self.URL_BASE = "http://www.hel.fi/palvelukarttaws/rest/v4/"
        # The urls below are only used for constructing extra links for each unit
        self.ADMIN_URL_BASE = (
            "https://asiointi.hel.fi/tprperhe/TPR/UI/ServicePoint/ServicePointEdit/"
        )
        self.CITIZEN_URL_BASE = "https://palvelukartta.hel.fi/fi/unit/"
        ds_args = dict(id="tprek")
        defaults = dict(name="Toimipisterekisteri")
        self.data_source, _ = DataSource.objects.get_or_create(
            defaults=defaults, **ds_args)
        ds_args = dict(id="kirkanta")
        defaults = dict(name="kirjastot.fi")
        self.kirjastot_data_source, _ = DataSource.objects.get_or_create(
            defaults=defaults, **ds_args)

        # this maps the imported resource names to Hauki objects
        self.data_to_match = {
            "unit":
            Resource.objects.filter(
                origins__data_source=self.data_source,
                resource_type=ResourceType.UNIT).distinct().prefetch_related(
                    "origins"),
            "connection":
            Resource.objects.filter(
                origins__data_source=self.data_source,
                resource_type__in=set(CONNECTION_TYPE_MAPPING.values())
                | set((ResourceType.SUBSECTION, )),
            ).distinct().prefetch_related("origins"),
            "opening_hours":
            DatePeriod.objects.filter(
                origins__data_source=self.data_source).exclude(
                    origins__data_source=self.kirjastot_data_source).distinct(
                    ).prefetch_related("origins"),
            "extra_subsections":
            Resource.objects.filter(
                origins__data_source=self.data_source,
                resource_type=ResourceType.SERVICE_AT_UNIT,
            ).distinct().prefetch_related("origins"),
        }
        with different_locale("fi_FI.utf-8"):
            self.month_by_name = {
                name.lower(): index + 1
                for index, name in enumerate(list(month_name)[1:])
            }
            self.weekday_by_abbr = {
                abbr.lower(): index + 1
                for index, abbr in enumerate(list(day_abbr))
            }

        # if we are merging objects, we must override default get_id methods
        # so that the cache and syncher merge identical connections
        if self.options.get("merge", None):
            self.get_object_id = self.merge_connections_get_object_id
            self.get_data_id = self.merge_connections_get_data_id
예제 #9
0
def get_month_name(month_no, loclg):
    """
    get the right month name from translation
    :param month_no:
    :param loclg:
    :return:
    """
    with different_locale(loclg) as encoding:
        s = month_name[month_no]
        if encoding is not None:
            s = s.decode(encoding)
        return s
예제 #10
0
def get_day_name(day_no, loclg):
    """
    get the right day name from translation
    :param day_no:
    :param loclg:
    :return:
    """
    with different_locale(loclg) as encoding:
        s = day_name[day_no]
        if encoding is not None:
            s = s.decode(encoding)
        return s
예제 #11
0
파일: utils.py 프로젝트: emmanuj/nikola
 def get_month_name(self, month_no, lang):
     """returns localized month name in an unicode string"""
     if sys.version_info[0] == 3:  # Python 3
         with calendar.different_locale(self.locales[lang]):
             s = calendar.month_name[month_no]
         # for py3 s is unicode
     else:  # Python 2
         with calendar.TimeEncoding(self.locales[lang]):
             s = calendar.month_name[month_no]
         s = s.decode(self.encodings[lang])
     # paranoid about calendar ending in the wrong locale (windows)
     self.set_locale(self.current_lang)
     return s
예제 #12
0
    def test_type_of_month_name(self):
        """validate assumption calendar month name is of type str

        Yes, both in windows and linuxTravis, py 26, 27, 33
        """
        import calendar
        if sys.version_info[0] == 3:  # Python 3
            with calendar.different_locale(loc_11):
                s = calendar.month_name[1]
        else:  # Python 2
            with calendar.TimeEncoding(loc_11):
                s = calendar.month_name[1]
        self.assertTrue(type(s) == str)
예제 #13
0
    def test_type_of_month_name(self):
        """validate assumption calendar month name is of type str

        Yes, both in windows and linuxTravis, py 26, 27, 33
        """
        import calendar
        if sys.version_info[0] == 3:  # Python 3
            with calendar.different_locale(loc_11):
                s = calendar.month_name[1]
        else:  # Python 2
            with calendar.TimeEncoding(loc_11):
                s = calendar.month_name[1]
        self.assertTrue(type(s) == str)
예제 #14
0
 def formatmonthname(self, withyear=True):
     """月間カレンダーの一番上、タイトル部分を作成する."""
     if CalendarClass is LocaleHTMLCalendar:
         with different_locale(self.locale):
             s = month_name[self.month]
             if withyear:
                 s = '%s年 %s' % (self.year, s)
     else:
         s = month_name[self.date.month]
         if withyear:
             s = '%s年 %s' % (self.year, s)
     html = '<tr><th colspan="7" class="month">{} シフト登録</th></tr>'
     return html.format(s)
예제 #15
0
파일: utils.py 프로젝트: yasar11732/nikola
 def get_month_name(self, month_no, lang):
     """returns localized month name in an unicode string"""
     if sys.version_info[0] == 3:  # Python 3
         with calendar.different_locale(self.locales[lang]):
             s = calendar.month_name[month_no]
         # for py3 s is unicode
     else:  # Python 2
         with calendar.TimeEncoding(self.locales[lang]):
             s = calendar.month_name[month_no]
         s = s.decode(self.encodings[lang])
     # paranoid about calendar ending in the wrong locale (windows)
     self.set_locale(self.current_lang)
     return s
예제 #16
0
def month_name(num_month, code_alias_locale="es_cu"):
    """
    Retorna numero de mes en el locale espcificado. Por defecto castellano

    Args:
        num_month (int):
        year (int=datetime.date.today().year):
        code_alias_locale (str='es_es'):

    Returns:
        str
    """
    with different_locale(locale.locale_alias.get(code_alias_locale)):
        return pretty_text(calendar.month_name[num_month])
예제 #17
0
def format_locale_date(date, lang):
    lang = LANGUAGE_CODE_MAPPING.get(lang, lang)
    today = datetime.date.today()
    if date:
        month, day = date.split('-')
        date = today.replace(month=int(month), day=int(day))
    else:
        date = today + datetime.timedelta(days=-today.weekday(), weeks=1)
    locale = lang
    if platform.system() != 'Windows':
        locale = LOCALE_MAPPING.get(lang, 'en_GB') + '.UTF8'
    with different_locale(locale):
        date = date.strftime('%b %d')
    return date
예제 #18
0
def test_plot_month(close_figures):
    dta = elnino.load_pandas().data
    dta["YEAR"] = dta.YEAR.astype(int).apply(str)
    dta = dta.set_index("YEAR").T.unstack()
    dates = pd.to_datetime(["-".join([x[1], x[0]]) for x in dta.index.values])

    # test dates argument
    fig = month_plot(dta.values, dates=dates, ylabel="el nino")

    # test with a TimeSeries DatetimeIndex with no freq
    dta.index = pd.DatetimeIndex(dates)
    fig = month_plot(dta)

    # w freq
    dta.index = pd.DatetimeIndex(dates, freq="MS")
    fig = month_plot(dta)

    # test with a TimeSeries PeriodIndex
    dta.index = pd.PeriodIndex(dates, freq="M")
    fig = month_plot(dta)

    # test localized xlabels
    try:
        with calendar.different_locale("DE_de"):
            fig = month_plot(dta)
            labels = [_.get_text() for _ in fig.axes[0].get_xticklabels()]
            expected = [
                "Jan",
                "Feb",
                ("Mär", "Mrz"),
                "Apr",
                "Mai",
                "Jun",
                "Jul",
                "Aug",
                "Sep",
                "Okt",
                "Nov",
                "Dez",
            ]
            for lbl, exp in zip(labels, expected):
                if isinstance(exp, tuple):
                    assert lbl in exp
                else:
                    assert lbl == exp
    except locale.Error:
        pytest.xfail(reason="Failure due to unsupported locale")
예제 #19
0
파일: views.py 프로젝트: FloArt/trackmybank
def basic_context_data(user):
    u_group = user.usergroup.group
    current_month = functions.get_current_month(u_group)
    with calendar.different_locale(settings.LOCALE):
        all_months = [{"id": m, "name": calendar.month_name[m].capitalize()} for m in range(1, 13)]
    all_cats = Category.objects.all().order_by("name")
    months = sorted(Month.objects.filter(ugroup=u_group), key=lambda m: (-m.year, -m.month))
    next_month = None
    next_year = None
    next_salary = None
    if len(months) > 0:
        next_month = months[0].month + 1 if months[0].month < 12 else 1
        next_year = months[0].year if months[0].month < 12 else months[0].year + 1
        next_salary = months[0].salary
    return {
        "categories": all_cats,
        "months": months,
        "next_month": next_month,
        "next_year": next_year,
        "next_salary": next_salary,
        "all_months": all_months,
        "current_month": current_month,
        "lang": settings.LANGUAGE_CODE
    }
예제 #20
0
def get_month_name(month_no):
    with different_locale('pt_BR.UTF-8'):
        return month_name[month_no]
예제 #21
0
def translate_day(day_no, locale):
    locale = LANGUAGE_CODE_MAPPING.get(locale, locale)
    locale = LOCALE_MAPPING.get(locale, 'en_GB') + '.UTF8'
    with different_locale(locale):
        return day_name[day_no]
예제 #22
0
    def _ensure_detail_page(
        self,
        code: str,
        title: str,
        location: str,
        credits: int,
        beginning: datetime,
        ending: datetime,
        notes: str,
        ticket_key: str,
    ) -> str:
        """
        Check whether or not the detail page exists. If it doesn't exist,
        create it.
        """
        params = cast(Dict[str, str], self.helper["parameters"])
        phab = self.org.phabricator()
        #
        # Create or update the detail page
        #
        page_title = f"{title}{params['page_suffix']}"
        page_url = phab.urlize(
            f"{params['path_prefix']}{beginning.year}/{title}")
        page = phab.search_document_by_path(page_url)
        if not page:
            date_format = " %d %B %Y, %H.%M"
            with different_locale("it_IT"):  # type: ignore
                beginning_str = ita_weekday(beginning) + beginning.strftime(
                    date_format)
                ending_str = ita_weekday(ending) + ending.strftime(date_format)
            plural = credits == 1 and "o" or "i"
            page_body = f"""**Maniphest task:** {ticket_key}

La partecipazione all'evento vale {credits} credit{plural} formativ{plural}.

== Logistica ==
**Luogo:** {location}
**Inizio:** {beginning_str}
**Fine:** {ending_str}

{notes}"""
            page = phab.create_page(page_url, page_title, page_body)
        ###
        ### Update the table in the parent page
        ###
        year = beginning.year
        parent_page_title = f"{year}{params['page_suffix']}"
        parent_page_path = f"{params['path_prefix']}{beginning.year}"
        parent_page = phab.search_document_by_path(parent_page_path,
                                                   include_body=True)
        parent_page_body = parent_page["attachments"]["content"]["content"][
            "raw"]
        soup = BeautifulSoup(parent_page_body, features="html.parser")
        with different_locale("it_IT"):  # type: ignore
            date_str = beginning.strftime("%Y-%m-%d")
        row = BeautifulSoup(
            f"""<tr>
<td>{code}</td>
<td>[[{page_url} | {title}]]</td>
<td>{date_str}</td>
<td>{location}</td>
<td>{credits}</td>
<td></td>
</tr>""",
            features="html.parser",
        )
        tbody = soup.find_all("table")[0]
        tbody.append(row)
        phab.update_page(parent_page_path, parent_page_title, str(soup))
        return page
예제 #23
0
 def formatweekday(self, day):
     with calendar.different_locale(self.locale):
         s = calendar.day_abbr[day].capitalize()
         return '<th class="%s">%s</th>' % (self.cssclasses[day], s)
예제 #24
0
 def formatmonthname(self, theyear, themonth, withyear=True):
     with calendar.different_locale(self.locale):
         s = calendar.month_name[themonth].capitalize()
         if withyear:
             s = '%s %s' % (s, theyear)
         return '<tr><th colspan="7" class="month">%s</th></tr>' % s
예제 #25
0
 def upload_paycheck(
     self,
     day: datetime,
     hours: float,
     overtime: float,
     gross: float,
     net: float,
     holidays: float,
     festivities: float,
     permits: float,
     type_: int,
     pdf: str,
 ):
     params = cast(Dict[str, str], self.helper["parameters"])
     with different_locale("it_IT"):  # type: ignore
         if type_ == 1:
             extra = "_13a"
             day_str = "13a " + day.strftime("%Y")
         elif type_ == 2:
             extra = "_14a"
             day_str = "14a " + day.strftime("%Y")
         else:
             extra = ""
             day_str = day.strftime("%b %Y").lower()
         file_name = (params["pdf_prefix"] + "busta_paga_" +
                      day.strftime("%Y-%m") + extra + ".pdf")
         phab = self.org.phabricator()
         #
         # Upload the attachment to Phabricator
         #
         phab_file_name = dirjoin(params["paycheck_page"], file_name)
         file_phid = phab.upload_file(pdf, phab_file_name)
         file = phab.get_file_by_phid(file_phid)
         #
         # Update the Paycheck page within Phriction
         #
         page_path = params["paycheck_page"]
         page = phab.search_document_by_path(page_path, include_body=True)
         if not page:
             raise Exception(f"Wiki page not found {page_path}")
         page_title = page["attachments"]["content"]["title"]
         page_body = page["attachments"]["content"]["content"]["raw"]
         soup = BeautifulSoup(page_body, features="html.parser")
         with change_locale("de_DE"):
             hours_str = locale.format_string("%.2f", hours)
             if overtime > 0:
                 overtime_str = locale.format_string("%.2f", overtime)
             else:
                 overtime_str = "-"
             gross_str = locale.format_string("%.2f", gross)
             net_str = locale.format_string("%.2f", net)
             holidays_str = locale.format_string("%.2f", holidays)
             festivities_str = locale.format_string("%.2f", festivities)
             permits_str = locale.format_string("%.2f", permits)
         row = BeautifulSoup(
             f"""<tr>
 <td>{day_str}</td>
 <td>{hours_str}</td>
 <td>{overtime_str}</td>
 <td>€ {gross_str}</td>
 <td>€ {net_str}</td>
 <td>{holidays_str}</td>
 <td>{festivities_str}</td>
 <td>{permits_str}</td>
 <td>[[ /F{file['id']} | Download ]]</td>
 """,
             features="html.parser",
         )
         tbody = soup.find_all("table")[0]
         tbody.insert(2, row)
         phab.update_page(page_path, page_title, str(soup))
예제 #26
0
 def formatweekday(self, day):
     with calendar.different_locale(self.locale):
         s = calendar.day_abbr[day].capitalize()
         return '<th class="%s">%s</th>' % (self.cssclasses[day], s)
예제 #27
0
 def formatmonthname(self, theyear, themonth):
     with python_calendar.different_locale(self.locale):
         return '%s %s' % (python_calendar.month_name[themonth], theyear)
예제 #28
0
 def get_month_name(self, number):
     with calendar.different_locale("pt_BR.utf8"):
         return calendar.month_name[number].capitalize()
예제 #29
0
def get_month_name(month_num, locale):
    with different_locale(locale):
        return month_name[month_num]
예제 #30
0
    def formatmonthname(self, theyear, themonth, withyear=True):
        """
        Return a month name as a table row.
        """

        lcle = self.locale
        if self.locale in ['en', 'en_EN']:
            lcle = 'C'

        if PY3:
            with calendar.different_locale(lcle) as encoding:
                smonth = calendar.month_name[themonth].capitalize()
        else:
            with TimeEncoding(lcle) as encoding:
                smonth = calendar.month_name[themonth].capitalize()
                if encoding is not None:
                    smonth = smonth.decode(encoding).capitalize()

        if withyear:
            string = '%s %s' % (smonth, theyear)
        else:
            string = '%s' % smonth

        prev_month = self.month - 1
        prev_year = self.year
        if prev_month == 0:
            prev_month = 12
            prev_year = prev_year - 1

        prev_month_lnk = ''
        if self.calendar_name:
            prev_month_lnk = '<a class="button" href="%s">&lt;</a>' % (
                flask.url_for(
                    'calendar',
                    calendar_name=self.calendar_name,
                    year=int(prev_year),
                    month=int(prev_month),
                    day=1))
        elif self.loc_name:
            prev_month_lnk = '<a class="button" href="%s">&lt;</a>' % (
                flask.url_for(
                    'location',
                    loc_name=self.loc_name,
                    year=int(prev_year),
                    month=int(prev_month),
                    day=1))

        next_month = self.month
        next_year = self.year + next_month / 12
        next_month = next_month % 12 + 1

        next_month_lnk = ''
        if self.calendar_name:
            next_month_lnk = '<a class="button" href="%s">&gt;</a>' % (
                flask.url_for(
                    'calendar',
                    calendar_name=self.calendar_name,
                    year=int(next_year),
                    month=int(next_month),
                    day=1))
        elif self.loc_name:
            next_month_lnk = '<a class="button" href="%s">&gt;</a>' % (
                flask.url_for(
                    'location',
                    loc_name=self.loc_name,
                    year=int(next_year),
                    month=int(next_month),
                    day=1))

        return '<tr><th colspan="7" class="month">%s %s %s</th></tr>' % (
            prev_month_lnk, string, next_month_lnk)
예제 #31
0
 def formatmonthname(self, theyear, themonth, withyear=True):
     with calendar.different_locale(self.locale):
         s = calendar.month_name[themonth].capitalize()
         if withyear:
             s = '%s %s' % (s, theyear)
         return '<tr><th colspan="7" class="month">%s</th></tr>' % s
예제 #32
0
 def formatmonthname(self, theyear, themonth):
     with python_calendar.different_locale(self.locale):
         return '%s %s' % (python_calendar.month_name[themonth], theyear)
예제 #33
0
 def formatweekday(self, day):
     with python_calendar.different_locale(self.locale):
         return python_calendar.day_abbr[day]
예제 #34
0
 def formatweekday(self, day):
     with python_calendar.different_locale(self.locale):
         return python_calendar.day_abbr[day]
예제 #35
0
    def create_holiday_request(
        self,
        request_type: int,
        description: str,
        date: datetime,
        p_day: datetime,
        p_beginning: datetime,
        p_ending: datetime,
        d_day: datetime,
        md_beginning: datetime,
        md_ending: datetime,
    ):
        params = cast(Dict[str, str], self.helper["parameters"])
        with different_locale("it_IT"):  # type: ignore
            now = datetime.now()
            datetime_str = date.strftime("%Y-%m-%d") + "_" + now.strftime("%H-%M-%S")
            # Since the description will be used between parentheses, ensure that
            # it starts with a lower case letter and that it doesn't have a trailing
            # full stop.
            description = description[0].lower() + description[1:]
            if description.endswith("."):
                description = description[:-1]
            if request_type == 0:
                file_name = f"{params['pdf_prefix']}_richiesta_permesso_{datetime_str}"
                p_chosen = "☑"
                d_chosen = "☐"
                md_chosen = "☐"
                p_day_str = self.day_to_ita_str(p_day)
                p_beginning_str = p_beginning.strftime("%H:%M")
                p_ending_str = p_ending.strftime("%H:%M")
                d_beginning_str = (
                    md_beginning_str
                ) = md_ending_str = ".................."
                wiki_desc = f"Richiesta permesso per {p_day_str}, {p_beginning_str}-{p_ending_str} ({description})"
            elif request_type == 1:
                file_name = f"{params['pdf_prefix']}_richiesta_ferie_{datetime_str}"
                p_chosen = "☐"
                d_chosen = "☑"
                md_chosen = "☐"
                p_day_str = (
                    p_beginning_str
                ) = (
                    p_ending_str
                ) = md_beginning_str = md_ending_str = ".................."
                d_beginning_str = self.day_to_ita_str(d_day)
                wiki_desc = f"Richiesta ferie per {d_beginning_str} ({description})"
            else:
                file_name = f"{params['pdf_prefix']}_richiesta_ferie_{datetime_str}"
                p_chosen = "☐"
                d_chosen = "☐"
                md_chosen = "☑"
                p_day_str = (
                    p_beginning_str
                ) = p_ending_str = d_beginning_str = ".................."
                md_beginning_str = self.day_to_ita_str(md_beginning)
                md_ending_str = self.day_to_ita_str(md_ending)
                wiki_desc = f"Richiesta ferie da {md_beginning_str} a {md_ending_str} ({description})"
            date_str = self.day_to_ita_str(date)
        values = {
            "date": date_str,
            "p_chosen": p_chosen,
            "d_chosen": d_chosen,
            "md_chosen": md_chosen,
            "p_day": p_day_str,
            "p_beginning": p_beginning_str,
            "p_ending": p_ending_str,
            "d_day": d_beginning_str,
            "md_beginning": md_beginning_str,
            "md_ending": md_ending_str,
        }
        templating = Templating()
        template = replace_path_vars(params["odt_template"])
        file_path = os.path.join(os.path.expanduser("~"), file_name)  # type: ignore
        file_path_odt = file_path + ".odt"
        file_path_pdf = file_path + ".pdf"
        templating.render_template(template, file_path_odt, values, True)
        trailer = PdfReader(file_path_pdf)
        trailer.Info.Producer = "Photocopieuse"
        trailer.Info.Creator = "Photocopieuse"
        trailer.Info.Author = params["employee"]
        trailer.Info.Title = "Richiesta permesso/ferie"
        PdfWriter(file_path_pdf, trailer=trailer).write()
        phab = self.org.phabricator()
        #
        # Upload the attachment to Phabricator
        #
        phab_file_name = dirjoin(params["holidays_page"], file_name) + ".pdf"
        file_phid = phab.upload_file(file_path_pdf, phab_file_name)
        file = phab.get_file_by_phid(file_phid)
        #
        # Update the Holidays wiki page
        #
        page_path = params["holidays_page"]
        page = phab.search_document_by_path(page_path, include_body=True)
        if not page:
            raise Exception(f"Wiki page not found {page_path}")
        page_title = page["attachments"]["content"]["title"]
        page_body = page["attachments"]["content"]["content"]["raw"]
        soup = BeautifulSoup(page_body, "html.parser")
        date_str = date.strftime("%Y-%m-%d")
        row = BeautifulSoup(
            f"""<tr>
<td>{date_str}</td>
<td>{wiki_desc}</td>
<td>[[ /F{file['id']} | Download ]]</td>
</tr>""",
            features="html.parser",
        )
        tbody = soup.find_all("table")[0]
        tbody.insert(2, row)
        phab.update_page(page_path, page_title, str(soup))
예제 #36
0
 def __str__(self):
     with calendar.different_locale(settings.LOCALE):
         return " ".join(
             (calendar.month_name[self.month].capitalize(), str(self.year)))