annotate libervia/server/classes.py @ 1282:0e4e413eb8db

server: user new OrderedSet to handle scripts: OrderedSet is needed because scripts must not be duplicated and must be generated in right order.
author Goffi <goffi@goffi.org>
date Fri, 19 Jun 2020 16:47:51 +0200
parents 25eacbb1d59e
children 822bd0139769
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1239
f511f8fbbf8a fixed shebangs
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
1 #!/usr/bin/env python3
f511f8fbbf8a fixed shebangs
Goffi <goffi@goffi.org>
parents: 1237
diff changeset
2
1185
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
3
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
4 # Libervia: a Salut à Toi frontend
1237
987595a254b0 dates update
Goffi <goffi@goffi.org>
parents: 1186
diff changeset
5 # Copyright (C) 2011-2020 Jérôme Poisson <goffi@goffi.org>
1185
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
6
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
10 # (at your option) any later version.
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
11
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
15 # GNU Affero General Public License for more details.
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
16
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
19
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
20 """Useful genertic classes used in Libervia"""
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
21
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
22
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
23 from collections import namedtuple
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
24
7d6c0e5d5f34 server: moved generic classes definitions (only WebsocketMeta for now) to new "classes" module
Goffi <goffi@goffi.org>
parents:
diff changeset
25 WebsocketMeta = namedtuple("WebsocketMeta", ("url", "token", "debug"))
1186
352865f4a268 server: added a generic way to have notification messages in pages
Goffi <goffi@goffi.org>
parents: 1185
diff changeset
26 Notification = namedtuple("Notification", ("message", "level"))
1281
25eacbb1d59e server (classes): use default for all values for Script:
Goffi <goffi@goffi.org>
parents: 1268
diff changeset
27 Script = namedtuple("Script", ("src", "type", "content"), defaults=(None, None, ""))