first commit
This commit is contained in:
6
modules/web_shortener/__init__.py
Normal file
6
modules/web_shortener/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from . import routes
|
||||
|
||||
__all__ = [routes]
|
||||
BIN
modules/web_shortener/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
modules/web_shortener/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
modules/web_shortener/__pycache__/routes.cpython-311.pyc
Normal file
BIN
modules/web_shortener/__pycache__/routes.cpython-311.pyc
Normal file
Binary file not shown.
BIN
modules/web_shortener/__pycache__/web.cpython-311.pyc
Normal file
BIN
modules/web_shortener/__pycache__/web.cpython-311.pyc
Normal file
Binary file not shown.
43
modules/web_shortener/locale/bg.po
Normal file
43
modules/web_shortener/locale/bg.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
43
modules/web_shortener/locale/ca.po
Normal file
43
modules/web_shortener/locale/ca.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr "Nombre de clics"
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "Mètode"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr "Registre"
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr "URL de redirecció"
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr "URL escurçada"
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URLs escurçades"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URLs escurçades"
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr "URL escurçada de la web"
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr "Accés a URLs escurçades"
|
||||
43
modules/web_shortener/locale/cs.po
Normal file
43
modules/web_shortener/locale/cs.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
43
modules/web_shortener/locale/de.po
Normal file
43
modules/web_shortener/locale/de.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr "Anzahl Klicks"
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "Methode"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr "Datensatz"
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr "URL Umleitung"
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr "Gekürzte URL"
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "Gekürzte URLs"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "Gekürzte URLs"
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr "Gekürzte URL"
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr "Gekürzte URLs"
|
||||
43
modules/web_shortener/locale/es.po
Normal file
43
modules/web_shortener/locale/es.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr "Número de clicks"
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "Método"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr "Registro"
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr "URL de redirección"
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr "URL acortada"
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URLs acortadas"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URLs acortadas"
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr "URL acortada de la web"
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr "Acceso URL acortada"
|
||||
43
modules/web_shortener/locale/es_419.po
Normal file
43
modules/web_shortener/locale/es_419.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
45
modules/web_shortener/locale/et.po
Normal file
45
modules/web_shortener/locale/et.po
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr "Klikid"
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "Meetod"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr "Kirje"
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr "Suunatud URL"
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr "Lühendatud URL"
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "Lühendatud URL"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "Lühendatud URL"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr "Lühendatud URL"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr "Lühendatud URL"
|
||||
43
modules/web_shortener/locale/fa.po
Normal file
43
modules/web_shortener/locale/fa.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
43
modules/web_shortener/locale/fi.po
Normal file
43
modules/web_shortener/locale/fi.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
43
modules/web_shortener/locale/fr.po
Normal file
43
modules/web_shortener/locale/fr.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr "Nombre de clics"
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "Méthode"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr "Enregistrement"
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr "URL de redirection"
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr "URL raccourcie"
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URLs raccourcies"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URLs raccourcies"
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr "URL raccourcie sur le Web"
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr "Accès à l'URL raccourcie sur le Web"
|
||||
43
modules/web_shortener/locale/hu.po
Normal file
43
modules/web_shortener/locale/hu.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
43
modules/web_shortener/locale/id.po
Normal file
43
modules/web_shortener/locale/id.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "Metode"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
45
modules/web_shortener/locale/it.po
Normal file
45
modules/web_shortener/locale/it.po
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr "Conteggio dei click"
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "Metodo"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr "Record"
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr "URL di rendirizzamento"
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr "URL abbreviato"
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URL abbreviati"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URL abbreviati"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr "URL abbreviato"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr "URL abbreviati"
|
||||
43
modules/web_shortener/locale/lo.po
Normal file
43
modules/web_shortener/locale/lo.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
43
modules/web_shortener/locale/lt.po
Normal file
43
modules/web_shortener/locale/lt.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
43
modules/web_shortener/locale/nl.po
Normal file
43
modules/web_shortener/locale/nl.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr "aantal klikken"
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "Methode"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr "Record"
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr "Omleidings-URL"
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr "Verkorte URL"
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "Verkorte URLs"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "Verkorte URLs"
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr "Web verkorte URL"
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr "Web verkorte URL toegang"
|
||||
43
modules/web_shortener/locale/pl.po
Normal file
43
modules/web_shortener/locale/pl.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
43
modules/web_shortener/locale/pt.po
Normal file
43
modules/web_shortener/locale/pt.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr "Contagem de Cliques"
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "Método"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr "Registro"
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr "URL de Redirecionamento"
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr "URL Encurtada"
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URLs Encurtadas"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URLs Encurtadas"
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr "URL Encurtada da Web"
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr "Acesso à URL Encurtada da Web"
|
||||
45
modules/web_shortener/locale/ro.po
Normal file
45
modules/web_shortener/locale/ro.po
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr "Contor Clickuri"
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "Metodă"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr "Înregistrare"
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr "Redirecționare URL"
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr "URL Prescurtat"
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URL-uri Prescurtate"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "URL-uri Prescurtate"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr "URL Prescurtat"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr "URL-uri Prescurtate"
|
||||
43
modules/web_shortener/locale/ru.po
Normal file
43
modules/web_shortener/locale/ru.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
45
modules/web_shortener/locale/sl.po
Normal file
45
modules/web_shortener/locale/sl.po
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr "Štetje klikov"
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "Način"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr "Zapis"
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr "URL za preusmeritev"
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr "Skrajšani URL"
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "Skrajšani URL-ji"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "Skrajšani URL-ji"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr "Skrajšani URL"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr "Skrajšani URL-ji"
|
||||
43
modules/web_shortener/locale/tr.po
Normal file
43
modules/web_shortener/locale/tr.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
43
modules/web_shortener/locale/uk.po
Normal file
43
modules/web_shortener/locale/uk.po
Normal file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr ""
|
||||
45
modules/web_shortener/locale/zh_CN.po
Normal file
45
modules/web_shortener/locale/zh_CN.po
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:web.shortened_url,count:"
|
||||
msgid "Click Count"
|
||||
msgstr "点击计数"
|
||||
|
||||
msgctxt "field:web.shortened_url,method:"
|
||||
msgid "Method"
|
||||
msgstr "方法"
|
||||
|
||||
msgctxt "field:web.shortened_url,record:"
|
||||
msgid "Record"
|
||||
msgstr "记录"
|
||||
|
||||
msgctxt "field:web.shortened_url,redirect_url:"
|
||||
msgid "Redirect URL"
|
||||
msgstr "重定向网址"
|
||||
|
||||
msgctxt "field:web.shortened_url,shortened_url:"
|
||||
msgid "Shortened URL"
|
||||
msgstr "网址短名"
|
||||
|
||||
msgctxt "field:web.shortened_url.access,url:"
|
||||
msgid "URL"
|
||||
msgstr "网址"
|
||||
|
||||
msgctxt "model:ir.action,name:act_shortened_url"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "网址短名"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_shortened_url_form"
|
||||
msgid "Shortened URLs"
|
||||
msgstr "网址短名"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "model:web.shortened_url,string:"
|
||||
msgid "Web Shortened Url"
|
||||
msgstr "网址短名"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "model:web.shortened_url.access,string:"
|
||||
msgid "Web Shortened Url Access"
|
||||
msgstr "网址短名"
|
||||
20
modules/web_shortener/routes.py
Normal file
20
modules/web_shortener/routes.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.protocols.wrappers import (
|
||||
HTTPStatus, abort, redirect, with_pool, with_transaction)
|
||||
from trytond.wsgi import app
|
||||
|
||||
|
||||
@app.route('/s/<base64:database_name>$<shortened>')
|
||||
@with_pool
|
||||
@with_transaction(readonly=False)
|
||||
def shortened(request, pool, shortened):
|
||||
ShortenedURL = pool.get('web.shortened_url')
|
||||
|
||||
try:
|
||||
shortened_url = ShortenedURL.get(shortened)
|
||||
except IndexError:
|
||||
abort(HTTPStatus.NOT_FOUND)
|
||||
|
||||
return redirect(shortened_url.access(), code=301)
|
||||
2
modules/web_shortener/tests/__init__.py
Normal file
2
modules/web_shortener/tests/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
BIN
modules/web_shortener/tests/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
modules/web_shortener/tests/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
30
modules/web_shortener/tests/test_module.py
Normal file
30
modules/web_shortener/tests/test_module.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
import random
|
||||
import sys
|
||||
|
||||
from trytond.pool import Pool
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
|
||||
|
||||
class WebShortenerTestCase(ModuleTestCase):
|
||||
'Test Web Shortener module'
|
||||
module = 'web_shortener'
|
||||
|
||||
@with_transaction()
|
||||
def test_shorten(self):
|
||||
pool = Pool()
|
||||
ShortenedURL = pool.get('web.shortened_url')
|
||||
expand = ShortenedURL._expand
|
||||
shorten = ShortenedURL._shorten
|
||||
|
||||
self.assertEqual(expand(shorten(0)), 0)
|
||||
self.assertEqual(expand(shorten(sys.maxsize)), sys.maxsize)
|
||||
|
||||
for _ in range(10):
|
||||
x = random.randint(0, sys.maxsize)
|
||||
self.assertEqual(expand(shorten(x)), x)
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
11
modules/web_shortener/tryton.cfg
Normal file
11
modules/web_shortener/tryton.cfg
Normal file
@@ -0,0 +1,11 @@
|
||||
[tryton]
|
||||
version=7.8.0
|
||||
depends:
|
||||
ir
|
||||
xml:
|
||||
web.xml
|
||||
|
||||
[register]
|
||||
model:
|
||||
web.ShortenedURL
|
||||
web.URLAccess
|
||||
14
modules/web_shortener/view/shortened_url_form.xml
Normal file
14
modules/web_shortener/view/shortened_url_form.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="shortened_url"/>
|
||||
<field name="shortened_url" widget="url"/>
|
||||
<label name="redirect_url"/>
|
||||
<field name="redirect_url" widget="url"/>
|
||||
|
||||
<label name="record"/>
|
||||
<field name="record"/>
|
||||
<label name="method"/>
|
||||
<field name="method"/>
|
||||
</form>
|
||||
10
modules/web_shortener/view/shortened_url_list.xml
Normal file
10
modules/web_shortener/view/shortened_url_list.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="shortened_url" widget="url" expand="1"/>
|
||||
<field name="redirect_url" widget="url" expand="1"/>
|
||||
<field name="count"/>
|
||||
<field name="record" expand="1"/>
|
||||
<field name="method" expand="1"/>
|
||||
</tree>
|
||||
129
modules/web_shortener/web.py
Normal file
129
modules/web_shortener/web.py
Normal file
@@ -0,0 +1,129 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
import logging
|
||||
import string
|
||||
from urllib.parse import quote, urljoin
|
||||
|
||||
from sql.aggregate import Count
|
||||
|
||||
import trytond.config as config
|
||||
from trytond.model import ModelSQL, ModelView, fields
|
||||
from trytond.pool import Pool
|
||||
from trytond.tools import grouped_slice, reduce_ids
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.url import http_host
|
||||
from trytond.wsgi import Base64Converter
|
||||
|
||||
ALPHABET = string.digits + string.ascii_lowercase
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ShortenedURL(ModelSQL, ModelView):
|
||||
__name__ = 'web.shortened_url'
|
||||
|
||||
shortened_url = fields.Function(
|
||||
fields.Char("Shortened URL"), 'get_url')
|
||||
redirect_url = fields.Char("Redirect URL", readonly=True, required=True)
|
||||
record = fields.Reference("Record", selection='get_models', readonly=True)
|
||||
method = fields.Selection('get_methods', "Method", readonly=True)
|
||||
count = fields.Function(fields.Integer("Click Count"), 'get_count')
|
||||
|
||||
@classmethod
|
||||
def get_url(cls, shortened_urls, name):
|
||||
urls = {}
|
||||
|
||||
url_parts = {
|
||||
'database': Base64Converter(None).to_url(
|
||||
Transaction().database.name),
|
||||
}
|
||||
url_base = config.get('web', 'shortener_base', default=http_host())
|
||||
for shortened in shortened_urls:
|
||||
url_parts['short_id'] = cls._shorten(shortened.id)
|
||||
urls[shortened.id] = urljoin(
|
||||
url_base, quote('/s/%(database)s$%(short_id)s' % url_parts))
|
||||
return urls
|
||||
|
||||
@classmethod
|
||||
def get_count(cls, shortened_urls, name):
|
||||
pool = Pool()
|
||||
URLAccess = pool.get('web.shortened_url.access')
|
||||
|
||||
access = URLAccess.__table__()
|
||||
cursor = Transaction().connection.cursor()
|
||||
|
||||
counts = {s.id: 0 for s in shortened_urls}
|
||||
for sub_ids in grouped_slice(shortened_urls):
|
||||
cursor.execute(*access.select(
|
||||
access.url, Count(access.id),
|
||||
where=reduce_ids(access.url, sub_ids),
|
||||
group_by=[access.url]))
|
||||
counts.update(cursor)
|
||||
return counts
|
||||
|
||||
@classmethod
|
||||
def _get_models(cls):
|
||||
return []
|
||||
|
||||
@classmethod
|
||||
def get_models(cls):
|
||||
pool = Pool()
|
||||
Model = pool.get('ir.model')
|
||||
get_name = Model.get_name
|
||||
models = cls._get_models()
|
||||
return [(None, '')] + [(m, get_name(m)) for m in models]
|
||||
|
||||
@classmethod
|
||||
def _get_methods(cls):
|
||||
return []
|
||||
|
||||
@fields.depends('record')
|
||||
def get_methods(self):
|
||||
def func(option):
|
||||
if not self.record:
|
||||
return True
|
||||
else:
|
||||
name = option[0].split('|')[0]
|
||||
return self.record.__class__.__name__ == name
|
||||
return [(None, '')] + list(filter(func,
|
||||
((m, m) for m in self._get_methods())))
|
||||
|
||||
@classmethod
|
||||
def get(cls, shortened_id):
|
||||
id = cls._expand(shortened_id)
|
||||
return cls.search([('id', '=', id)], limit=1)[0]
|
||||
|
||||
def access(self, **values):
|
||||
pool = Pool()
|
||||
URLAccess = pool.get('web.shortened_url.access')
|
||||
|
||||
URLAccess(url=self, **values).save()
|
||||
if self.record and self.method:
|
||||
model, method = self.method.split('|')
|
||||
if model == self.record.__class__.__name__:
|
||||
method = getattr(self.record.__class__.__queue__, method)
|
||||
method([self.record])
|
||||
return self.redirect_url
|
||||
|
||||
@staticmethod
|
||||
def _shorten(integer):
|
||||
"Turns an integer into a string in a given alphabet"
|
||||
key_part = []
|
||||
while integer:
|
||||
integer, remainder = divmod(integer, len(ALPHABET))
|
||||
key_part.append(ALPHABET[remainder])
|
||||
else:
|
||||
if not key_part:
|
||||
key_part.append('0')
|
||||
return ''.join(reversed(key_part))
|
||||
|
||||
@staticmethod
|
||||
def _expand(key):
|
||||
"Turns a key from a given alphabet to the corresponding ID"
|
||||
return int(key, len(ALPHABET))
|
||||
|
||||
|
||||
class URLAccess(ModelSQL):
|
||||
__name__ = 'web.shortened_url.access'
|
||||
|
||||
url = fields.Many2One('web.shortened_url', "URL", required=True)
|
||||
54
modules/web_shortener/web.xml
Normal file
54
modules/web_shortener/web.xml
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0"?>
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="shortened_url_view_list">
|
||||
<field name="model">web.shortened_url</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">shortened_url_list</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="shortened_url_view_form">
|
||||
<field name="model">web.shortened_url</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">shortened_url_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_shortened_url">
|
||||
<field name="name">Shortened URLs</field>
|
||||
<field name="res_model">web.shortened_url</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_shortened_url_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="shortened_url_view_list"/>
|
||||
<field name="act_window" ref="act_shortened_url"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_shortened_url_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="shortened_url_view_form"/>
|
||||
<field name="act_window" ref="act_shortened_url"/>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
parent="ir.menu_models"
|
||||
action="act_shortened_url"
|
||||
sequence="50"
|
||||
id="menu_shortened_url_form"/>
|
||||
|
||||
<record model="ir.model.access" id="access_shortened_url">
|
||||
<field name="model">web.shortened_url</field>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="False"/>
|
||||
<field name="perm_create" eval="False"/>
|
||||
<field name="perm_delete" eval="False"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_shortened_url_group_admin">
|
||||
<field name="model">web.shortened_url</field>
|
||||
<field name="group" ref="res.group_admin"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
Reference in New Issue
Block a user