def generate_traffic_chart(traffic_data, inline=True): """Create a graph object from the input traffic data with pygal. If inline is set, the chart is being passed the option to not add an xml declaration header to the beginning of the `render()` output, so it can be directly included in HTML code (wrapped by a `<figure>`) :param traffic_data: The traffic data as given by `query_trafficdata()` :param inline: Determines the option `disable_xml_declaration` :return: The graph object """ traffic_chart = pygal.Bar( title=gettext("Traffic (MiB)"), height=350, show_y_guides=True, human_readable=False, major_label_font_size=12, label_font_size=12, style=traffic_style, disable_xml_declaration=inline, # for direct html import js=[], # prevent automatically fetching scripts from github ) days, in_values, out_values, credit = list(zip(*traffic_data['history'])) traffic_chart.x_labels = days traffic_chart.add(gettext('Input'), in_values, stroke_style={'dasharray': '5'}) traffic_chart.add(gettext('Output'), out_values, stroke_style={'dasharray': '5'}) traffic_chart.add(gettext('Gesamt'), list(map(add, in_values, out_values)), stroke_style={'width': '2'}) return traffic_chart
def generate_traffic_chart(traffic_data, inline=True): """Create a graph object from the input traffic data with pygal. If inline is set, the chart is being passed the option to not add an xml declaration header to the beginning of the `render()` output, so it can be directly included in HTML code (wrapped by a `<figure>`) :param traffic_data: The traffic data as given by `query_trafficdata()` :param inline: Determines the option `disable_xml_declaration` :return: The graph object """ traffic_chart = pygal.Bar( title=gettext("Traffic (MB)"), height=350, show_y_guides=True, human_readable=False, major_label_font_size=12, label_font_size=12, style=BlueStyle, disable_xml_declaration=inline, # for direct html import js=[], # prevent automatically fetching scripts from github ) days, in_values, out_values, credit = zip(*traffic_data['history']) traffic_chart.x_labels = days traffic_chart.add(gettext('Input'), in_values) traffic_chart.add(gettext('Output'), out_values) traffic_chart.add(gettext('Gesamt'), map(add, in_values, out_values)) return traffic_chart
def test_text(self): import sys if sys.platform == 'win32': skip("No gettext on Windows") # TODO more tests would be nice import _locale assert _locale.gettext("1234") == "1234" assert _locale.dgettext(None, "1234") == "1234" assert _locale.dcgettext(None, "1234", _locale.LC_MESSAGES) == "1234" assert _locale.textdomain("1234") == "1234"
} DATABASES = { 'default': dj_database_url.config( default='postgres://*****:*****@localhost:5432/saleor', conn_max_age=600) } TIME_ZONE = 'America/Chicago' #LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'vi' #Translate form LANGUAGES = [ ('vi', gettext('Vietnamese')), ] LOCALE_PATHS = [os.path.join(PROJECT_ROOT, 'locale')] USE_I18N = True USE_L10N = True USE_TZ = True FORM_RENDERER = 'django.forms.renderers.TemplatesSetting' EMAIL_URL = os.environ.get('EMAIL_URL') SENDGRID_USERNAME = os.environ.get('SENDGRID_USERNAME') SENDGRID_PASSWORD = os.environ.get('SENDGRID_PASSWORD') if not EMAIL_URL and SENDGRID_USERNAME and SENDGRID_PASSWORD: EMAIL_URL = 'smtp://%s:%[email protected]:587/?tls=True' % ( SENDGRID_USERNAME, SENDGRID_PASSWORD)