def _getBody(self, params): locale = get_current_locale() params['language'] = IndicoLocale.parse('en').languages[ locale.language] params['python_msg_core_i18n'] = core_gettext('Hello world!') params['python_msg_plugin_i18n'] = _('Hello world!') return render_plugin_template('example:example.html', **params)
def __init__(self, *args, **kwargs): locale = get_current_locale() self.day_number_options = self.WEEK_DAY_NUMBER_CHOICES self.week_day_options = [(n, locale.weekday(n, short=False)) for n in range(7)] self.day_number_missing = False self.week_day_missing = False super().__init__(*args, **kwargs)
def format_datetime(dt, format='medium', locale=None, timezone=None, server_tz=False, keep_tz=False): """ Basically a wrapper around Babel's own format_datetime """ inject_unicode = True if format == 'code': format = 'dd/MM/yyyy HH:mm' inject_unicode = False if not locale: locale = get_current_locale() if keep_tz: assert timezone is None timezone = dt.tzinfo elif not timezone and dt.tzinfo: timezone = DisplayTZ().getDisplayTZ() elif server_tz: timezone = Config.getInstance().getDefaultTimezone() rv = _format_datetime(dt, format=format, locale=locale, tzinfo=timezone) return inject_unicode_debug( rv, 2).encode('utf-8') if inject_unicode else rv.encode('utf-8')
def getVars(self): vars = WTemplated.getVars(self) vars["currentUser"] = self._currentuser config = Config.getInstance() imgLogin = config.getSystemIconURL("login") vars["imgLogin"] = imgLogin vars["isFrontPage"] = self._isFrontPage vars["currentCategory"] = self.__currentCategory vars['prot_obj'] = self._prot_obj current_locale = get_current_locale() vars["ActiveTimezone"] = session.timezone """ Get the timezone for displaying on top of the page. 1. If the user has "LOCAL" timezone then show the timezone of the event/category. If that's not possible just show the standard timezone. 2. If the user has a custom timezone display that one. """ vars["ActiveTimezoneDisplay"] = self._getTimezoneDisplay( vars["ActiveTimezone"]) vars["SelectedLanguage"] = str(current_locale) vars["SelectedLanguageName"] = current_locale.language_name vars["Languages"] = get_all_locales() if DBMgr.getInstance().isConnected(): vars["title"] = info.HelperMaKaCInfo.getMaKaCInfoInstance( ).getTitle() vars["organization"] = info.HelperMaKaCInfo.getMaKaCInfoInstance( ).getOrganisation() else: vars["title"] = "Indico" vars["organization"] = "" vars['roomBooking'] = Config.getInstance().getIsRoomBookingActive() vars['protectionDisclaimerProtected'] = legal_settings.get( 'network_protected_disclaimer') vars['protectionDisclaimerRestricted'] = legal_settings.get( 'restricted_disclaimer') #Build a list of items for the administration menu adminItemList = [] if session.user and session.user.is_admin: adminItemList.append({ 'id': 'serverAdmin', 'url': urlHandlers.UHAdminArea.getURL(), 'text': _("Server admin") }) vars["adminItemList"] = adminItemList vars['extra_items'] = HeaderMenuEntry.group( values_from_signal(signals.indico_menu.send())) vars["getProtection"] = self._getProtection vars["show_contact"] = config.getPublicSupportEmail() is not None return vars
def format_datetime(dt, format='medium', locale=None, timezone=None, server_tz=False, keep_tz=False): """ Basically a wrapper around Babel's own format_datetime """ inject_unicode = True if format == 'code': format = 'dd/MM/yyyy HH:mm' inject_unicode = False if not locale: locale = get_current_locale() if keep_tz: assert timezone is None timezone = dt.tzinfo elif not timezone and dt.tzinfo: timezone = session.tzinfo elif server_tz: timezone = config.DEFAULT_TIMEZONE rv = _format_datetime(dt, format=format, locale=locale, tzinfo=timezone) return inject_unicode_debug( rv, 2).encode('utf-8') if inject_unicode else rv.encode('utf-8')
def format_time(t, format='short', locale=None, timezone=None, server_tz=False, as_unicode=False): """ Basically a wrapper around Babel's own format_time """ inject_unicode = True if format == 'code': format = 'HH:mm' inject_unicode = False if not locale: locale = get_current_locale() if not timezone and t.tzinfo: timezone = session.tzinfo elif server_tz: timezone = config.DEFAULT_TIMEZONE if isinstance(timezone, basestring): timezone = get_timezone(timezone) rv = _format_time(t, format=format, locale=locale, tzinfo=timezone) if as_unicode: return rv return inject_unicode_debug( rv, 2).encode('utf-8') if inject_unicode else rv.encode('utf-8')
def __init__(self, *args, **kwargs): locale = get_current_locale() self.day_number_options = self.WEEK_DAY_NUMBER_CHOICES self.week_day_options = [(n, locale.weekday(n, short=False)) for n in xrange(7)] self.day_number_missing = False self.week_day_missing = False super(IndicoWeekDayRepetitionField, self).__init__(*args, **kwargs)
def format_timedelta(td, format='short', locale=None): """ Basically a wrapper around Babel's own format_timedelta """ if not locale: locale = get_current_locale() return _format_timedelta(td, format=format, locale=locale).encode('utf-8')
def format_date(d, format='medium', locale=None): """ Basically a wrapper around Babel's own format_date """ if not locale: locale = get_current_locale() return _format_date(d, format=format, locale=locale).encode('utf-8')
def format_timedelta(td, format='short', threshold=0.85, locale=None): """ Basically a wrapper around Babel's own format_timedelta """ if not locale: locale = get_current_locale() rv = _format_timedelta(td, format=format, locale=locale, threshold=threshold) return inject_unicode_debug(rv, 2).encode('utf-8')
def __init__(self, *args, **kwargs): locale = get_current_locale() self.day_number_options = self.WEEK_DAY_NUMBER_CHOICES self.week_day_options = [(n, locale.weekday(n, short=False)) for n in xrange(7)] self.week_day_options.append((-1, _('Any day'))) self.day_number_missing = False self.week_day_missing = False super(IndicoWeekDayRepetitionField, self).__init__(*args, **kwargs)
def format_timedelta(td, format='short', threshold=0.85, locale=None): """Basically a wrapper around Babel's own format_timedelta.""" if not locale: locale = get_current_locale() return _format_timedelta(td, format=format, locale=locale, threshold=threshold)
def _process_GET(self): if User.has_rows(): return redirect(url_for('misc.index')) return render_template('bootstrap/bootstrap.html', selected_lang_name=parse_locale(get_current_locale()).language_name, language_options=sorted(get_all_locales().items(), key=itemgetter(1)), form=BootstrapForm(language=session.lang), timezone=Config.getInstance().getDefaultTimezone(), indico_version=MaKaC.__version__, python_version=python_version())
def format_datetime(dt, format='medium', locale=None, timezone=None): """Basically a wrapper around Babel's own format_datetime.""" if format == 'code': format = 'dd/MM/yyyy HH:mm' if not locale: locale = get_current_locale() if not timezone and dt.tzinfo: timezone = session.tzinfo return _format_datetime(dt, format=format, locale=locale, tzinfo=timezone)
def format_date(d, format='medium', locale=None, timezone=None): """Basically a wrapper around Babel's own format_date.""" if format == 'code': format = 'dd/MM/yyyy' if not locale: locale = get_current_locale() if timezone and isinstance(d, datetime) and d.tzinfo: d = d.astimezone(pytz.timezone(timezone) if isinstance(timezone, str) else timezone) return _format_date(d, format=format, locale=locale)
def format_date(d, format='medium', locale=None, timezone=None): """ Basically a wrapper around Babel's own format_date """ if format == 'code': format = 'dd/MM/yyyy' if not locale: locale = get_current_locale() if timezone and isinstance(d, datetime) and d.tzinfo: d = d.astimezone(pytz.timezone(timezone) if isinstance(timezone, basestring) else timezone) return _format_date(d, format=format, locale=locale).encode('utf-8')
def _process_GET(self): if User.has_rows(): return redirect(url_for('misc.index')) return render_template( 'bootstrap/bootstrap.html', selected_lang_name=parse_locale( get_current_locale()).language_name, language_options=sorted(get_all_locales().items(), key=itemgetter(1)), form=BootstrapForm(language=session.lang), timezone=Config.getInstance().getDefaultTimezone(), indico_version=MaKaC.__version__, python_version=python_version())
def format_time(t, format='short', locale=None, timezone=None, server_tz=False): """Basically a wrapper around Babel's own format_time.""" if format == 'code': format = 'HH:mm' if not locale: locale = get_current_locale() if not timezone and t.tzinfo: timezone = session.tzinfo elif server_tz: timezone = config.DEFAULT_TIMEZONE if isinstance(timezone, str): timezone = get_timezone(timezone) return _format_time(t, format=format, locale=locale, tzinfo=timezone)
def getVars( self ): vars = WTemplated.getVars(self) vars["currentUser"] = self._currentuser config = Config.getInstance() imgLogin = config.getSystemIconURL("login") vars["imgLogin"] = imgLogin vars["isFrontPage"] = self._isFrontPage vars["currentCategory"] = self.__currentCategory vars['prot_obj'] = self._prot_obj current_locale = get_current_locale() vars["ActiveTimezone"] = session.timezone """ Get the timezone for displaying on top of the page. 1. If the user has "LOCAL" timezone then show the timezone of the event/category. If that's not possible just show the standard timezone. 2. If the user has a custom timezone display that one. """ vars["ActiveTimezoneDisplay"] = self._getTimezoneDisplay(vars["ActiveTimezone"]) vars["SelectedLanguage"] = str(current_locale) vars["SelectedLanguageName"] = current_locale.language_name vars["Languages"] = get_all_locales() if DBMgr.getInstance().isConnected(): vars["title"] = info.HelperMaKaCInfo.getMaKaCInfoInstance().getTitle() vars["organization"] = info.HelperMaKaCInfo.getMaKaCInfoInstance().getOrganisation() else: vars["title"] = "Indico" vars["organization"] = "" vars['roomBooking'] = Config.getInstance().getIsRoomBookingActive() vars['protectionDisclaimerProtected'] = legal_settings.get('network_protected_disclaimer') vars['protectionDisclaimerRestricted'] = legal_settings.get('restricted_disclaimer') #Build a list of items for the administration menu adminItemList = [] if session.user and session.user.is_admin: adminItemList.append({'id': 'serverAdmin', 'url': urlHandlers.UHAdminArea.getURL(), 'text': _("Server admin")}) vars["adminItemList"] = adminItemList vars['extra_items'] = HeaderMenuEntry.group(values_from_signal(signals.indico_menu.send())) vars["getProtection"] = self._getProtection vars["show_contact"] = config.getPublicSupportEmail() is not None return vars
def format_time(t, format='short', locale=None, timezone=None, server_tz=False): """ Basically a wrapper around Babel's own format_time """ if not locale: locale = get_current_locale() if not timezone and t.tzinfo: timezone = DisplayTZ().getDisplayTZ() elif server_tz: timezone = Config.getInstance().getDefaultTimezone() if timezone: timezone = get_timezone(timezone) return _format_time(t, format=format, locale=locale, tzinfo=timezone).encode('utf-8')
def getHTML( self ): res = [] divs = [] for day in self._month.getDayList(): fulldate = "%s%02d%02d" % (self._month.getYear(),self._month.getMonthNumber(),day.getDayNumber()) if day.getDayNumber() == 1: for i in range(day.getWeekDay()): res.append("<td></td>") categs = day.getCategories() if len(categs)>1: colors = [""" <table cellspacing="0" cellpadding="0" border="0" align="left"> <tr>"""] for categ in categs: colors.append("""<td bgcolor="%s"> </td>"""%self._categColors.getColor( categ )) colors.append(""" </tr> </table>""") res.append( """<td align="right" bgcolor="%s" onMouseOver="setOnAnchor('d%s')" onMouseOut="clearOnAnchor('d%s')">%s<span style="cursor: default;" id="a%s">%s</span></td>"""%( self._multipleColor, fulldate, fulldate, "\n".join(colors), fulldate, day.getDayNumber() ) ) divs.append(self._getDiv(day)) elif len(categs) == 1: res.append( """<td align="right" bgcolor="%s" onMouseOver="setOnAnchor('d%s')" onMouseOut="clearOnAnchor('d%s')"><span style="cursor: default;" id="a%s">%s</span></td>"""%( self._categColors.getColor( categs[0] ), fulldate, fulldate, fulldate, day.getDayNumber() ) ) divs.append(self._getDiv(day)) else: res.append( """<td align="right">%s</td>"""%day.getDayNumber() ) if day.getWeekDay() == 6: res.append(""" </tr> <tr>\n""") str = """ <table cellspacing="1" cellpadding="5"> <tr> <td colspan="7" align="center" style="font-size: 1.2em;">%s</b></td> </tr> <tr> %s </tr> <tr> %s </tr> </table> %s """ % (format_date(self._month._date, 'MMM YYYY'), ''.join(list('<td align="right" bgcolor="#CCCCCC">{}</td>'.format( get_current_locale().weekday(wd)[:2]) for wd in xrange(0, 7))), "\n".join(res), "\n".join(divs)) return str
def format_date(d, format='medium', locale=None, timezone=None): """ Basically a wrapper around Babel's own format_date """ inject_unicode = True if format == 'code': format = 'dd/MM/yyyy' inject_unicode = False if not locale: locale = get_current_locale() if timezone and isinstance(d, datetime) and d.tzinfo: d = d.astimezone(pytz.timezone(timezone) if isinstance(timezone, basestring) else timezone) rv = _format_date(d, format=format, locale=locale) return inject_unicode_debug(rv, 2).encode('utf-8') if inject_unicode else rv.encode('utf-8')
def _compute_countries(self): locale = get_current_locale() countries = defaultdict(int) for country_code, regs in groupby(self.registrants_sorted, methodcaller('getCountry')): country = locale.territories.get(country_code) countries[country] += sum(1 for x in regs) others = [countries.pop(None, 0), _("Others")] if not countries: # no country data for any registrants return [], 0 num_countries = len(countries) # Sort by highest number of people per country then alphabetically per countries' name countries = sorted(((val, name) for name, val in countries.iteritems()), key=lambda x: (-x[0], x[1]), reverse=True) others[0] += sum(val for val, name in countries[:-15]) return ([others] if others[0] else []) + countries[-15:], num_countries
def format_datetime(dt, format='medium', locale=None, timezone=None, server_tz=False, keep_tz=False): """ Basically a wrapper around Babel's own format_datetime """ if not locale: locale = get_current_locale() if keep_tz: assert timezone is None timezone = dt.tzinfo elif not timezone and dt.tzinfo: timezone = DisplayTZ().getDisplayTZ() elif server_tz: timezone = Config.getInstance().getDefaultTimezone() return _format_datetime(dt, format=format, locale=locale, tzinfo=timezone).encode('utf-8')
def format_datetime(dt, format='medium', locale=None, timezone=None): """ Basically a wrapper around Babel's own format_datetime """ inject_unicode = True if format == 'code': format = 'dd/MM/yyyy HH:mm' inject_unicode = False if not locale: locale = get_current_locale() if not timezone and dt.tzinfo: timezone = session.tzinfo rv = _format_datetime(dt, format=format, locale=locale, tzinfo=timezone) return inject_unicode_debug(rv, 2).encode('utf-8') if inject_unicode else rv.encode('utf-8')
def format_datetime(dt, format='medium', locale=None, timezone=None): """ Basically a wrapper around Babel's own format_datetime """ inject_unicode = True if format == 'code': format = 'dd/MM/yyyy HH:mm' inject_unicode = False if not locale: locale = get_current_locale() if not timezone and dt.tzinfo: timezone = session.tzinfo rv = _format_datetime(dt, format=format, locale=locale, tzinfo=timezone) return inject_unicode_debug( rv, 2).encode('utf-8') if inject_unicode else rv.encode('utf-8')
def _format_pretty_datetime(dt, locale, tzinfo, formats): locale = get_current_locale() if not locale else parse_locale(locale) if tzinfo: if dt.tzinfo: dt = dt.astimezone(tzinfo) else: dt = tzinfo.localize(dt).astimezone(tzinfo) today = (now_utc(False).astimezone(tzinfo) if tzinfo else now_utc(False)).replace(hour=0, minute=0) diff = (dt - today).total_seconds() / 86400.0 mapping = [(-6, 'other'), (-1, 'last_week'), (0, 'last_day'), (1, 'same_day'), (2, 'next_day'), (7, 'next_week'), (None, 'other')] fmt = next(formats[key] for delta, key in mapping if delta is None or diff < delta) fmt = fmt.format(date_fmt=locale.date_formats['medium'], time_fmt=locale.time_formats['short']) return _format_datetime(dt, fmt, tzinfo, locale)
def format_time(t, format='short', locale=None, timezone=None, server_tz=False): """ Basically a wrapper around Babel's own format_time """ inject_unicode = True if format == 'code': format = 'HH:mm' inject_unicode = False if not locale: locale = get_current_locale() if not timezone and t.tzinfo: timezone = session.tzinfo elif server_tz: timezone = config.DEFAULT_TIMEZONE if isinstance(timezone, basestring): timezone = get_timezone(timezone) rv = _format_time(t, format=format, locale=locale, tzinfo=timezone) return inject_unicode_debug(rv, 2).encode('utf-8') if inject_unicode else rv.encode('utf-8')
def format_time(t, format='short', locale=None, timezone=None, server_tz=False): """ Basically a wrapper around Babel's own format_time """ inject_unicode = True if format == 'code': format = 'HH:mm' inject_unicode = False if not locale: locale = get_current_locale() if not timezone and t.tzinfo: timezone = DisplayTZ().getDisplayTZ() elif server_tz: timezone = Config.getInstance().getDefaultTimezone() if timezone: timezone = get_timezone(timezone) rv = _format_time(t, format=format, locale=locale, tzinfo=timezone) return inject_unicode_debug(rv, 2).encode('utf-8') if inject_unicode else rv.encode('utf-8')
def format_time(t, format='short', locale=None, timezone=None, server_tz=False): """ Basically a wrapper around Babel's own format_time """ if not locale: locale = get_current_locale() if not timezone and t.tzinfo: timezone = DisplayTZ().getDisplayTZ() elif server_tz: timezone = HelperMaKaCInfo.getMaKaCInfoInstance().getTimezone() if timezone: timezone = get_timezone(timezone) return _format_time(t, format=format, locale=locale, tzinfo=timezone).encode('utf-8')
def format_human_date(dt, format='medium', locale=None): """ Return the date in a human-like format for yesterday, today and tomorrow. Format the date otherwise. """ today = now_utc().date() oneday = timedelta(days=1) if not locale: locale = get_current_locale() if dt == today - oneday: return _("yesterday") elif dt == today: return _("today") elif dt == today + oneday: return _("tomorrow") else: return format_date(dt, format, locale=locale)
def format_datetime(dt, format='medium', locale=None, timezone=None, server_tz=False, keep_tz=False): """ Basically a wrapper around Babel's own format_datetime """ inject_unicode = True if format == 'code': format = 'dd/MM/yyyy HH:mm' inject_unicode = False if not locale: locale = get_current_locale() if keep_tz: assert timezone is None timezone = dt.tzinfo elif not timezone and dt.tzinfo: timezone = DisplayTZ().getDisplayTZ() elif server_tz: timezone = Config.getInstance().getDefaultTimezone() rv = _format_datetime(dt, format=format, locale=locale, tzinfo=timezone) return inject_unicode_debug(rv, 2).encode('utf-8') if inject_unicode else rv.encode('utf-8')
def format_datetime(dt, format='medium', locale=None, timezone=None, server_tz=False, keep_tz=False): """ Basically a wrapper around Babel's own format_datetime """ inject_unicode = True if format == 'code': format = 'dd/MM/yyyy HH:mm' inject_unicode = False if not locale: locale = get_current_locale() if keep_tz: assert timezone is None timezone = dt.tzinfo elif not timezone and dt.tzinfo: timezone = session.tzinfo elif server_tz: timezone = config.DEFAULT_TIMEZONE rv = _format_datetime(dt, format=format, locale=locale, tzinfo=timezone) return inject_unicode_debug(rv, 2).encode('utf-8') if inject_unicode else rv.encode('utf-8')
def format_datetime(dt, format='medium', locale=None, timezone=None, server_tz=False, keep_tz=False): """ Basically a wrapper around Babel's own format_datetime """ if not locale: locale = get_current_locale() if keep_tz: assert timezone is None timezone = dt.tzinfo elif not timezone and dt.tzinfo: timezone = DisplayTZ().getDisplayTZ() elif server_tz: timezone = HelperMaKaCInfo.getMaKaCInfoInstance().getTimezone() return _format_datetime(dt, format=format, locale=locale, tzinfo=timezone).encode('utf-8')
def format_skeleton(dt, skeleton, locale=None, timezone=None): """Basically a wrapper around Babel's own format_skeleton. It also keeps the specified width from the originally requested skeleton string and adjusts the one from the locale data accordingly. The argument order is swapped to keep uniformity with other format_* functions. """ if not locale: locale = get_current_locale() if not timezone and isinstance(dt, datetime) and dt.tzinfo: timezone = session.tzinfo # See https://github.com/python-babel/babel/issues/803 if you wonder why # we aren't using the default format_skeleton from Babel. locale = IndicoLocale.parse(locale) requested_skeleton = skeleton if skeleton not in locale.datetime_skeletons: skeleton = match_skeleton(skeleton, locale.datetime_skeletons) format = locale.datetime_skeletons[skeleton] format = _adjust_skeleton(str(format), requested_skeleton) return _format_datetime(dt, format=format, locale=locale, tzinfo=timezone)
def format_time(t, format='short', locale=None, timezone=None, server_tz=False): """ Basically a wrapper around Babel's own format_time """ inject_unicode = True if format == 'code': format = 'HH:mm' inject_unicode = False if not locale: locale = get_current_locale() if not timezone and t.tzinfo: timezone = DisplayTZ().getDisplayTZ() elif server_tz: timezone = Config.getInstance().getDefaultTimezone() if timezone: timezone = get_timezone(timezone) rv = _format_time(t, format=format, locale=locale, tzinfo=timezone) return inject_unicode_debug( rv, 2).encode('utf-8') if inject_unicode else rv.encode('utf-8')
def _getBody(self, params): locale = get_current_locale() params['language'] = IndicoLocale.parse('en').languages[locale.language] params['python_msg_core_i18n'] = core_gettext('Hello world!') params['python_msg_plugin_i18n'] = _('Hello world!') return render_plugin_template('example:example.html', **params)
def format_interval(start_dt, end_dt, format='yMd', locale=None): """Basically a wrapper around Babel's own format_interval.""" if not locale: locale = get_current_locale() return _format_interval(start_dt, end_dt, format, locale=locale)
def format_number(number, locale=None): if not locale: locale = get_current_locale() rv = _format_number(number, locale=locale) return inject_unicode_debug(rv, 2).encode('utf-8')
def format_number(number, locale=None): if not locale: locale = get_current_locale() return _format_number(number, locale=locale)
def getHTML(self): res = [] divs = [] for day in self._month.getDayList(): fulldate = "%s%02d%02d" % (self._month.getYear(), self._month.getMonthNumber(), day.getDayNumber()) if day.getDayNumber() == 1: for i in range(day.getWeekDay()): res.append("<td></td>") categs = day.getCategories() if len(categs) > 1: colors = [ """ <table cellspacing="0" cellpadding="0" border="0" align="left"> <tr>""" ] for categ in categs: colors.append("""<td bgcolor="%s"> </td>""" % self._categColors.getColor(categ)) colors.append(""" </tr> </table>""") res.append( """<td align="right" bgcolor="%s" onMouseOver="setOnAnchor('d%s')" onMouseOut="clearOnAnchor('d%s')">%s<span style="cursor: default;" id="a%s">%s</span></td>""" % (self._multipleColor, fulldate, fulldate, "\n".join(colors), fulldate, day.getDayNumber())) divs.append(self._getDiv(day)) elif len(categs) == 1: res.append( """<td align="right" bgcolor="%s" onMouseOver="setOnAnchor('d%s')" onMouseOut="clearOnAnchor('d%s')"><span style="cursor: default;" id="a%s">%s</span></td>""" % (self._categColors.getColor(categs[0]), fulldate, fulldate, fulldate, day.getDayNumber())) divs.append(self._getDiv(day)) else: res.append("""<td align="right">%s</td>""" % day.getDayNumber()) if day.getWeekDay() == 6: res.append(""" </tr> <tr>\n""") str = """ <table cellspacing="1" cellpadding="5"> <tr> <td colspan="7" align="center" style="font-size: 1.2em;">%s</b></td> </tr> <tr> %s </tr> <tr> %s </tr> </table> %s """ % (format_date(self._month._date, 'MMM YYYY'), ''.join( list('<td align="right" bgcolor="#CCCCCC">{}</td>'.format( get_current_locale().weekday(wd)[:2]) for wd in xrange(0, 7))), "\n".join(res), "\n".join(divs)) return str
def get_country(code, locale=None): if locale is None: locale = get_current_locale() return _get_country(code, locale)
def get_countries(locale=None): if locale is None: locale = get_current_locale() return _get_countries(locale)
def format_number(number, locale=None): if not locale: locale = get_current_locale() return _format_number(number, locale=locale).encode('utf-8')