changeset b4567a6cb078 in www.tryton.org:default details: https://hg.tryton.org/www.tryton.org?cmd=changeset;node=b4567a6cb078 description: Normalize names and URL using slugify method diffstat:
app.py | 168 +++++---- static/images/success-stories/banque-francaise-mutualiste.jpg | Bin static/images/success-stories/bfm.jpg | Bin static/images/success-stories/c3s.jpg | Bin static/images/success-stories/cultural-commons-collection-society.jpg | Bin static/images/success-stories/imi.jpg | Bin static/images/success-stories/institut-medic-per-la-imatge.jpg | Bin static/images/success-stories/skoda-autohaus-zeidler.jpg | Bin static/images/success-stories/zeidler.jpg | Bin templates/service_providers.html | 2 +- templates/service_providers/first-telecom.html | 15 + templates/service_providers/first_telecom.html | 15 - templates/service_providers/lava-lab-software.html | 13 + templates/service_providers/lava_lab_software.html | 13 - templates/service_providers/virtual-things.html | 11 + templates/service_providers/virtual_things.html | 11 - 16 files changed, 128 insertions(+), 120 deletions(-) diffs (326 lines): diff -r 33330f13f586 -r b4567a6cb078 app.py --- a/app.py Sun Jul 14 14:09:00 2019 +0200 +++ b/app.py Mon Jul 15 22:52:00 2019 +0200 @@ -2,8 +2,10 @@ import datetime import logging import os +import re +import unicodedata -from collections import namedtuple, OrderedDict +from collections import OrderedDict from functools import partial from http import HTTPStatus from logging.handlers import SMTPHandler @@ -71,6 +73,18 @@ Gravatar(app, size=198, default='mp', use_ssl=True) sitemap = Sitemap(app=app) +_slugify_strip_re = re.compile(r'[^\w\s-]') +_slugify_hyphenate_re = re.compile(r'[-\s]+') + + [email protected]_filter('slugify') +def slugify(value): + if not isinstance(value, str): + value = str(value) + value = unicodedata.normalize('NFKD', value) + value = str(_slugify_strip_re.sub('', value).strip()) + return _slugify_hyphenate_re.sub('-', value) + @app.after_request def add_cache_control_header(response): @@ -204,88 +218,82 @@ return datetime +class Case: + def __init__(self, title, description, story=False): + self.title = title + self.description = description + self.story = story + + @property + def name(self): + return slugify(self.title.lower()) + + @property + def url(self): + if self.story: + return url_for('success_story', story=self.name) + + @property + def logo(self): + return 'images/success-stories/%s.jpg' % self.name + + +CASES = [ + Case( + title="AMMEBA", + description="A Medical Mutual Society from Buenos Aires."), + Case( + title="Advocate Consulting Legal", + description="A legal firm servicing the general aviation industry"), + Case( + title="Banque Française Mutualiste", + description="A French bank for the public service."), + Case( + title="La Cave Thrace", + description="Imports and distributes wine in France."), + Case( + title="Cultural Commons Collection Society", + description="Collects and distributes music royalties."), + Case( + title="Grufesa", + description="Exports strawberries in Europe."), + Case( + title="Expertise Vision", + description="Produces vision based systems.", + story=True), + Case( + title="Institut Mèdic per la Imatge", + description="Provides all kinds of MRI scans, nuclear medicine " + "and bone densitometry."), + Case( + title="MenschensKinder Teltow", + description="Operates municipal day care centers and " + "parent-child groups."), + Case( + title="Lackierzentrum Reichenbach", + description="Produces surface coating for automotive, aerospace, " + "construction and mechanical engineering."), + Case( + title="Lucerne Carnival", + description="Organizes the Lucerne Carnival."), + Case( + title="Revelle", + description="Consulting in developing countries and " + "emerging economies."), + Case( + title="Sinclair Containers", + description="Sells and rents containers."), + Case( + title="Skoda Autohaus Zeidler", + description="A German car dealership and workshop for Skoda."), + ] + + @app.route('/success-stories') @cache.cached() def success_stories(): - Case = namedtuple('Case', 'title description url logo'.split()) - cases = [ - Case( - title="AMMEBA", - description="A Medical Mutual Society from Buenos Aires.", - url='', - logo='images/success-stories/ammeba.jpg'), - Case( - title="Advocate Consulting", - description="A legal firm servicing the general aviation industry", - url='', - logo='images/success-stories/advocate-consulting-legal.jpg'), - Case( - title="Banque Française Mutualiste", - description="A French bank for the public service.", - url='', - logo='images/success-stories/bfm.jpg'), - Case( - title="La Cave Thrace", - description="Imports and distributes wine in France.", - url='', - logo='images/success-stories/la-cave-thrace.jpg'), - Case( - title="Cultural Commons Collection Society", - description="Collects and distributes music royalties.", - url='', - logo='images/success-stories/c3s.jpg'), - Case( - title="Grufesa", - description="Exports strawberries in Europe.", - url='', - logo='images/success-stories/grufesa.jpg'), - Case( - title="Expertise Vision", - description="Produces vision based systems.", - url=url_for('success_story', story='expertise-vision'), - logo='images/success-stories/expertise-vision.jpg'), - Case( - title="Institut Mèdic per la Imatge", - description="Provides all kinds of MRI scans, nuclear medicine " - "and bone densitometry.", - url='', - logo='images/success-stories/imi.jpg'), - Case( - title="MenschensKinder Teltow", - description="Operates municipal day care centers and " - "parent-child groups.", - url='', - logo='images/success-stories/menschenskinder-teltow.jpg'), - Case( - title="Lackierzentrum Reichenbach", - description="Produces surface coating for automotive, aerospace, " - "construction and mechanical engineering.", - url='', - logo='images/success-stories/lackierzentrum-reichenbach.jpg'), - Case( - title="Lozärner Fasnachtskomitee", - description="Organizes the Lucerne Carnival.", - url='', - logo='images/success-stories/lucerne-carnival.jpg'), - Case( - title="Revelle Group", - description="Consulting in developing countries and " - "emerging economies.", - url='', - logo='images/success-stories/revelle.jpg'), - Case( - title="Sinclair Containers", - description="Sells and rents containers.", - url='', - logo='images/success-stories/sinclair-containers.jpg'), - Case( - title="Skoda Autohaus Zeidler", - description="A German car dealership and workshop for Skoda.", - url='', - logo='images/success-stories/zeidler.jpg'), - ] - shuffle(cases) - return render_template('success_stories.html', cases=cases) + shuffle(CASES) + return render_template('success_stories.html', cases=CASES) @app.route('/business-cases.html', endpoint='success_stories-alt') diff -r 33330f13f586 -r b4567a6cb078 static/images/success-stories/banque-francaise-mutualiste.jpg Binary file static/images/success-stories/banque-francaise-mutualiste.jpg has changed diff -r 33330f13f586 -r b4567a6cb078 static/images/success-stories/bfm.jpg Binary file static/images/success-stories/bfm.jpg has changed diff -r 33330f13f586 -r b4567a6cb078 static/images/success-stories/c3s.jpg Binary file static/images/success-stories/c3s.jpg has changed diff -r 33330f13f586 -r b4567a6cb078 static/images/success-stories/cultural-commons-collection-society.jpg Binary file static/images/success-stories/cultural-commons-collection-society.jpg has changed diff -r 33330f13f586 -r b4567a6cb078 static/images/success-stories/imi.jpg Binary file static/images/success-stories/imi.jpg has changed diff -r 33330f13f586 -r b4567a6cb078 static/images/success-stories/institut-medic-per-la-imatge.jpg Binary file static/images/success-stories/institut-medic-per-la-imatge.jpg has changed diff -r 33330f13f586 -r b4567a6cb078 static/images/success-stories/skoda-autohaus-zeidler.jpg Binary file static/images/success-stories/skoda-autohaus-zeidler.jpg has changed diff -r 33330f13f586 -r b4567a6cb078 static/images/success-stories/zeidler.jpg Binary file static/images/success-stories/zeidler.jpg has changed diff -r 33330f13f586 -r b4567a6cb078 templates/service_providers.html --- a/templates/service_providers.html Sun Jul 14 14:09:00 2019 +0200 +++ b/templates/service_providers.html Mon Jul 15 22:52:00 2019 +0200 @@ -22,7 +22,7 @@ <div class="row"> {% for provider, _ in providers %} {% set name = provider %} - {% include "service_providers/%s.html" % provider.lower().replace(' ', '_') %} + {% include "service_providers/%s.html" % provider|lower|slugify %} {% endfor %} </div> </div> diff -r 33330f13f586 -r b4567a6cb078 templates/service_providers/first-telecom.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/service_providers/first-telecom.html Mon Jul 15 22:52:00 2019 +0200 @@ -0,0 +1,15 @@ +{% set img = url_for('static', filename='images/service-providers/first-telecom.jpg') %} +{% set website = 'http://www.first.gr/' %} +{% set email = '[email protected]' %} +{% set phone = '+302106441354' %} +{% extends "service_providers/layout.html" %} +{% block description %} +One of the few real ICT companies and thus is almost equally active in +Telecommunications as in IT/Software development. +We devote a significant amount of our time in screening and selecting best of +breed Open Source projects (such as Tryton) with a strategic, sectorial focus +and then dedicate a fair share of our "brains" in developing add-on or even +bespoke solutions around them, that will improve and facilitate our customers’ +experience maximizing their professional agility. +{% endblock description %} +{% block location %}Athens, Greece and Belgrade, Serbia{% endblock %} diff -r 33330f13f586 -r b4567a6cb078 templates/service_providers/first_telecom.html --- a/templates/service_providers/first_telecom.html Sun Jul 14 14:09:00 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -{% set img = url_for('static', filename='images/service-providers/first-telecom.jpg') %} -{% set website = 'http://www.first.gr/' %} -{% set email = '[email protected]' %} -{% set phone = '+302106441354' %} -{% extends "service_providers/layout.html" %} -{% block description %} -One of the few real ICT companies and thus is almost equally active in -Telecommunications as in IT/Software development. -We devote a significant amount of our time in screening and selecting best of -breed Open Source projects (such as Tryton) with a strategic, sectorial focus -and then dedicate a fair share of our "brains" in developing add-on or even -bespoke solutions around them, that will improve and facilitate our customers’ -experience maximizing their professional agility. -{% endblock description %} -{% block location %}Athens, Greece and Belgrade, Serbia{% endblock %} diff -r 33330f13f586 -r b4567a6cb078 templates/service_providers/lava-lab-software.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/service_providers/lava-lab-software.html Mon Jul 15 22:52:00 2019 +0200 @@ -0,0 +1,13 @@ +{% set website = 'http://www.lavalab.com.au/' %} +{% extends "service_providers/layout.html" %} +{% block description %} +An Australian based company specialising in the development of business +specific solutions and services for a range of industries using open source +software. +Our best asset is our experience and understanding in developing web based +business management solutions. +Our team is focusing on implementing solutions based on Tryton and are +continuously developing modules and custom developed software to suit a range +of industries including equipment hire, property management and e-commerce. +{% endblock description %} +{% block location %}Australia{% endblock %} diff -r 33330f13f586 -r b4567a6cb078 templates/service_providers/lava_lab_software.html --- a/templates/service_providers/lava_lab_software.html Sun Jul 14 14:09:00 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -{% set website = 'http://www.lavalab.com.au/' %} -{% extends "service_providers/layout.html" %} -{% block description %} -An Australian based company specialising in the development of business -specific solutions and services for a range of industries using open source -software. -Our best asset is our experience and understanding in developing web based -business management solutions. -Our team is focusing on implementing solutions based on Tryton and are -continuously developing modules and custom developed software to suit a range -of industries including equipment hire, property management and e-commerce. -{% endblock description %} -{% block location %}Australia{% endblock %} diff -r 33330f13f586 -r b4567a6cb078 templates/service_providers/virtual-things.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/service_providers/virtual-things.html Mon Jul 15 22:52:00 2019 +0200 @@ -0,0 +1,11 @@ +{% set img = url_for('static', filename='images/service-providers/virtual-things.jpg') %} +{% set website = 'http://www.virtual-things.biz/' %} +{% set email = '[email protected]' %} +{% set phone = '+498971048155' %} +{% extends "service_providers/layout.html" %} +{% block description %} +An active promoter of the Tryton development since the early stages. +We offer support for the consulting, planning and integration phases as well as +customizing and special module development. +{% endblock description %} +{% block location %}Munich and Aachen, Germany{% endblock %} diff -r 33330f13f586 -r b4567a6cb078 templates/service_providers/virtual_things.html --- a/templates/service_providers/virtual_things.html Sun Jul 14 14:09:00 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -{% set img = url_for('static', filename='images/service-providers/virtual-things.jpg') %} -{% set website = 'http://www.virtual-things.biz/' %} -{% set email = '[email protected]' %} -{% set phone = '+498971048155' %} -{% extends "service_providers/layout.html" %} -{% block description %} -An active promoter of the Tryton development since the early stages. -We offer support for the consulting, planning and integration phases as well as -customizing and special module development. -{% endblock description %} -{% block location %}Munich and Aachen, Germany{% endblock %}
