Commit graph libervia-backend/sat/tools
Author SHA1 Message Date
Goffi
e85c55f7a0 core (config): if flatpak is detected, config is also looked after in /app 2019-06-23 17:40:19 +02:00
Goffi
0f97a75f6f tools (xml_tools): added "read_only" argument in dataFormResult2XMLUI (and use it in plugin pubsub_schema) 2019-06-12 09:11:28 +02:00
Goffi
d117d5c98c tools (email): moved email code to common so it can be used by frontends 2019-05-26 22:20:33 +02:00
Goffi
0edb94b0a2 tools (common/template): fixed theme parsing when there is no "/" in parenthesis 2019-05-25 15:13:35 +02:00
Goffi
94f149bce6 tools (email): fixed bad default value while reading config 2019-05-14 20:16:45 +02:00
Goffi
2f30424c6f tools (common/data_objects): added a "deserialise" argument to BlogItem:
BlogItem is doing deserialisation itself, which is not clean (it should be done at bridge level), and which is causing trouble in jp which doesn't expect serialisation.

As a workaround, the "deserialise" argument has been added for now (default to True), until deserialisation is properly managed in bridge.
2019-05-05 18:50:30 +02:00
Goffi
7d8d9c8ccb tools (xml_tools): split new lines for multi-lines text in XMLUIResult2DataFormResult to be correctly handled in data form 2019-05-03 20:48:19 +02:00
Goffi
1ccb54e571 tools (sat_defer), plugin XEP-0060: added a function "stanza2NotFound" to convert item-not-found StanzaError to exceptions.NotFound in an errback 2019-04-14 08:21:51 +02:00
Goffi
bc061ee885 template (filters): set locale when using "date_fmt" 2019-04-14 08:21:51 +02:00
Goffi
e1ff10bf77 template (i18n): activate ext.i18n.trimmed policy, to have clean translation strings. Set minimal jinja2 version to 2.10 2019-04-14 08:21:51 +02:00
Goffi
4ab939c46a template: added "locales" variables to templates:
"locales" contains an ordered tuple of locales of all available translations. This can be used by templates to diplay language/locale menu.
2019-04-10 21:04:51 +02:00
Goffi
c83ac61e1d tools (common/template): always use highlight.css if present. 2019-03-25 18:40:11 +01:00
Goffi
9335194f7b plugin XEP-0363: updated to namespace "urn:xmpp:http:upload:0", handle headers 2019-03-22 19:26:08 +01:00
Goffi
04f485057b core (log): add traceback when "exc_info" is set 2019-03-03 12:04:55 +01:00
Goffi
9a0218ea10 tools (config): log error message if config can't be read 2019-03-03 08:57:36 +01:00
Goffi
309e5eebb9 tools(common/date_utils): fixed order on year first + set default date for date_parse 2019-03-01 15:35:55 +01:00
Goffi
82bb99f88c core (xml_tools): new elementCopy method to shallow copy a domish.Element 2019-02-28 18:57:00 +01:00
Goffi
512ae0b91e plugin XEP-0277: blog items data are now entirely serialised before going to bridge:
So far, and for historical reasons, blog items data where serialised using a unicode: unicode dict, which was causing trouble for many types of values (timestamps, booleans, lists).
This patch changes it by serialising the whole items before going to bridge, and deserialising it when going back. This way, complex data can be used easily in items.
This impact psEvent and serItemsData* methods which are renamed transItemsData* because there are not always serialising anymore (a new argument "serialise" allows to specify it).
When editing a blog post in jp, metadata are now more easy to manipulate, specially lists like tags.
2019-02-23 18:59:00 +01:00
Goffi
5827849863 tools (common): fixed dateutil.parser import 2019-02-02 01:12:54 +01:00
Goffi
8a59034935 plugin mr mercurial, tools(common/utils): moved command protocol to a new module 2019-01-25 09:06:29 +01:00
Goffi
37ea73b19f frontends, jp, templates: added XHTMLBox widget:
for jp, the XHTML is rendered for now using markdown.
2019-01-19 11:39:02 +01:00
Goffi
87871fabca core (XMLUI): new XHTMLBox widget:
XHTMLBox is a textbox specialised in XHTML, i.e. it renders the XHTML when in read_only, and it allows to edit it.
The XHTML is cleaned by default, the cleaning is done by Text Syntaxes plugin (actually there is a cleaning method which can be set by any plugin, but Text Syntaxes is the one which does it).
2019-01-19 11:39:02 +01:00
Goffi
8e338bf913 date update 2019-01-12 12:25:31 +01:00
Goffi
6f4c7bd950 tools (common/data_objects): moved BlogItems._parseMetadata to a parsePubSubMetadata function, so it can be used in a more generic way 2019-01-11 21:38:20 +01:00
Goffi
d88d2a7d8f tools (common/data_objects): metadata parsing in BlogItems:
metadata are parsed to deserialise some well known values like rsm index and count, and some properties have been added to have easier access.
A "complete" property (or item in metadata) is set to True if we are on the last page, False if we are not, or None if we don't have enough data to know if we are on the last page or not.
2019-01-11 16:35:13 +01:00
Goffi
7a9ee35cfc misc: replaced all "dummy" by the more conventional and readable "__" ("_" being used for gettext) 2019-01-11 11:13:15 +01:00
Goffi
b33d1f66de core (XMLUI): small optimisation: introspection is done once at module loading instead of on each XMLUI instantiation 2019-01-11 09:48:17 +01:00
Goffi
7dc9aae5aa tools (xml_tools): isXMLUICancelled helper function to check if an XMLUI has been cancelled from raw XML. 2019-01-03 20:49:21 +01:00
Goffi
24c4cc0487 frontends (XMLUI): TabsContainer can now be the main container (Primitivus keep the old behaviour and always use VerticalContainer as main container) 2019-01-02 18:32:16 +01:00
Goffi
f83e4f3334 tools (common/data_format): use "default" in json.dumps in serialise (useful notably to serialise jid.JID) 2018-12-01 14:34:55 +01:00
Goffi
4b81275fdf tools (common/date_utils): date_parse_ext + timezone handling:
- new date_parse_ext method parse a date where relative informations can be added. e.g.: "1 week ago", "now - 2 days", "01/01/01 01:01 + 3 hours".
- new TZ_UTC and TZ_LOCAL constants can be used to use UTC time or local time zone.
- date_parse* can now use a default_tz, which will be used if timezone if not specified in date format (default UTC).
- tz_info can now be used in date_format to format the time in given timezone (default: UTC).
2018-12-01 10:40:19 +01:00
Goffi
af64d24d52 tools (common/data_format): serialise now check types and return a default value when empty string is parsed. 2018-12-01 09:59:48 +01:00
Goffi
bcab68049a template: better css files order 2018-10-03 20:38:10 +02:00
Goffi
2d37dc64e9 template: fixed by variable used in css_files_noscript 2018-09-27 08:50:38 +02:00
Goffi
1887d4d733 template: overriden get_template to always have full template name:
Environment.get_template has been overriden to have always full template name (i.e. template with (site/theme) prefix or absolute template).
This is needed to correctly handle cache, so "base/base.html" is converted to "(some_site/some_theme)base/base.html" and won't conflict with an other theme "base/base.html".
2018-09-18 20:59:34 +02:00
Goffi
0a7a2a0902 template: import contextfilter as module attribute 2018-09-18 20:55:58 +02:00
Goffi
e70405cfc2 tools (common/template), jp: refactoring to handle multiple sites:
- site can now be specified in template header before theme, for instance: (some_site/some_theme)path/to/template.ext
- absolute template paths are now implemented, but Renderer must be instanciated with trusted to True for security reason (it's the case for jp)
- a new "front_url_filter" callable can be given to Renderer, which will convert template path to URL seen by end-user (default to real path).
- the "front_url_filter" can be used in templates with… "front_url" filter
- template_data is a new named tuple available in templates, which give site, theme and template relative URL
- search order is site/theme, site/default_theme, and default/default_theme where default link to sat_pubsub templates
- when loading CSS files, files with _noscript suffixes are now loaded, and used when javascript is not available
- "styles_extra.css" is also loaded before "styles.css", useful when a theme want to reuse default style, and just override some rules
- new site can be specified in sat.conf [DEFAULT] section, using sites_path_public_dict or sites_path_private_dict (where sites_path_private_dict won't be used in public frontends, like Libervia)
- "private" argument of Renderer tells the renderer to load private sites or not
- templates are now loaded from "templates" subdirectory, to differenciate them from other data like i18n
- jp template output has been updated to handle those changes, and to manage absolute templates
2018-09-10 08:58:18 +02:00
Goffi
5d6321ec9f frontends (xmlui): class_map is now an arg of create function:
class_map was so far used as a global value, but in some cases, several XMLUI managers may be used (it's the case in Cagou's remote controllers plugins, template_xmlui is used to manage remotes).
This patch set class_map as a create argument, this way it can be set with partial, and several XMLUI managers can be instanced at the same time.
2018-08-31 16:03:12 +02:00
Goffi
14fd4252eb core, frontends (xmlui): added "hidden" widget, to specify a value to be returned unmodified 2018-08-31 15:57:11 +02:00
Goffi
9291d24a99 tools (common/data_format): added serialise and deserialise methods (using json for now) 2018-08-11 18:24:55 +02:00
Goffi
c5c46f3558 tools (trigger, async_trigger): added no_cancel argument to point and asyncPoint when a trigger must not be cancellable 2018-08-11 18:24:52 +02:00
Goffi
68014352a0 core: added async TriggerManager
Async trigger manager add an asyncPoint method which can be used with Deferred (or sync method).
This allow a triggers do to some long operations like doing network requests.

MessageReceived and sendMessageData now use asyncPoint.
2018-07-29 19:22:51 +02:00
Goffi
d5c9fa5e31 plugin XEP-0070: use a confirm dialog instead of a form + simplified a bit the code 2018-06-27 21:15:34 +02:00
Goffi
744cb0c503 code style reformatting using black 2018-06-27 20:14:46 +02:00
Goffi
0242772939 tools (date_utils): moved date_parse to common.date_utils, because it can be used in frontends 2018-06-21 01:21:44 +02:00
Goffi
785af76bc0 tools (common): moved date_fmt function from template filters to new date_utils module, so it can be used everywhere. 2018-06-01 12:04:06 +02:00
Goffi
4a09638f32 tools (common): new files_utils module:
get_unique_name find a name not conflicting with an existing file
2018-05-25 10:52:01 +02:00
Goffi
a9e368cf6a setup, tools(utils): fixed versioning in setup and getRepositoryData 2018-04-06 16:47:40 +02:00
Goffi
3951ea451a tools (utils): better repository version handling:
- removed save_dir_path and .hg_data/pickle method: it is not needed to save repository data anymore as its version is now saved on installation by setuptools_scm
- added "distance" (number of commits since last tag)
- use twisted's which method to find the hg executable
- result is now cached on first execution
- fixed dirstate method
- at last resort, try to find the repository version using the package version, as it is saved there by setuptools_scm
2018-04-05 15:23:38 +02:00
Goffi
578883b8bd tools(utils): fixed path handling in getRepositoryData 2018-04-04 09:21:00 +02:00