lino 25.4.2__py3-none-any.whl → 25.4.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lino/__init__.py +1 -1
- lino/core/kernel.py +33 -7
- lino/core/renderer.py +3 -3
- lino/core/site.py +10 -36
- lino/help_texts.py +3 -3
- lino/management/commands/demotest.py +16 -22
- lino/mixins/__init__.py +5 -5
- lino/mixins/dupable.py +2 -4
- lino/mixins/registrable.py +5 -2
- lino/modlib/about/models.py +2 -2
- lino/modlib/checkdata/choicelists.py +4 -4
- lino/modlib/checkdata/models.py +11 -3
- lino/modlib/comments/fixtures/demo2.py +4 -0
- lino/modlib/comments/models.py +1 -1
- lino/modlib/dupable/mixins.py +3 -5
- lino/modlib/extjs/ext_renderer.py +1 -1
- lino/modlib/extjs/views.py +1 -1
- lino/modlib/help/fixtures/demo2.py +3 -2
- lino/modlib/jinja/mixins.py +18 -5
- lino/modlib/linod/models.py +1 -1
- lino/modlib/linod/routing.py +49 -46
- lino/modlib/memo/mixins.py +3 -2
- lino/modlib/notify/api.py +33 -14
- lino/modlib/notify/mixins.py +4 -3
- lino/modlib/printing/mixins.py +1 -1
- lino/modlib/publisher/choicelists.py +41 -20
- lino/modlib/publisher/config/publisher/page.pub.html +24 -0
- lino/modlib/publisher/fixtures/demo2.py +12 -0
- lino/modlib/publisher/fixtures/std.py +2 -1
- lino/modlib/publisher/fixtures/synodalworld.py +17 -0
- lino/modlib/publisher/mixins.py +7 -0
- lino/modlib/publisher/models.py +77 -7
- lino/modlib/publisher/ui.py +5 -5
- lino/modlib/publisher/views.py +9 -2
- lino/modlib/system/models.py +1 -1
- lino/modlib/uploads/models.py +2 -2
- lino/static/bootstrap.css +1 -1
- lino/utils/dbfreader.py +64 -32
- lino/utils/dbhash.py +3 -2
- {lino-25.4.2.dist-info → lino-25.4.4.dist-info}/METADATA +1 -1
- {lino-25.4.2.dist-info → lino-25.4.4.dist-info}/RECORD +44 -43
- lino/management/commands/monitor.py +0 -160
- {lino-25.4.2.dist-info → lino-25.4.4.dist-info}/WHEEL +0 -0
- {lino-25.4.2.dist-info → lino-25.4.4.dist-info}/licenses/AUTHORS.rst +0 -0
- {lino-25.4.2.dist-info → lino-25.4.4.dist-info}/licenses/COPYING +0 -0
@@ -1,160 +0,0 @@
|
|
1
|
-
# -*- coding: UTF-8 -*-
|
2
|
-
# Copyright 2012-2021 Rumma & Ko Ltd
|
3
|
-
# License: GNU Affero General Public License v3 (see file COPYING for details)
|
4
|
-
|
5
|
-
# from future import standard_library
|
6
|
-
# standard_library.install_aliases()
|
7
|
-
|
8
|
-
from lino import logger
|
9
|
-
|
10
|
-
import os
|
11
|
-
import errno
|
12
|
-
import pickle as pickle
|
13
|
-
import sys
|
14
|
-
from optparse import make_option
|
15
|
-
from os.path import join
|
16
|
-
|
17
|
-
from django.db import models
|
18
|
-
from django.conf import settings
|
19
|
-
from django.utils import timezone
|
20
|
-
from django.utils.translation import gettext as _
|
21
|
-
from django.utils.encoding import force_str
|
22
|
-
from django.core.management import call_command
|
23
|
-
from django.core.management.base import BaseCommand, CommandError
|
24
|
-
|
25
|
-
from django.db import connections, transaction
|
26
|
-
from django.core.exceptions import ImproperlyConfigured
|
27
|
-
from django.db.utils import DEFAULT_DB_ALIAS
|
28
|
-
|
29
|
-
from django.db.backends.sqlite3.base import DatabaseWrapper as sqlite
|
30
|
-
|
31
|
-
try:
|
32
|
-
from django.db.backends.mysql.base import DatabaseWrapper as mysql
|
33
|
-
except ImproperlyConfigured:
|
34
|
-
mysql = None
|
35
|
-
|
36
|
-
import lino
|
37
|
-
import rstgen
|
38
|
-
from lino.core.utils import obj2str, full_model_name, sorted_models_list
|
39
|
-
|
40
|
-
|
41
|
-
def diffs(old, new, prefix=""):
|
42
|
-
if type(old) != dict:
|
43
|
-
if old != new:
|
44
|
-
yield "%s : %s -> %s" % (prefix, old, new)
|
45
|
-
return
|
46
|
-
keys = set(list(old.keys()) + list(new.keys()))
|
47
|
-
keys.discard("timestamp")
|
48
|
-
# ~ diffs = []
|
49
|
-
if prefix:
|
50
|
-
prefix += " "
|
51
|
-
for k in keys:
|
52
|
-
ov = old.get(k)
|
53
|
-
nv = new.get(k)
|
54
|
-
if ov != nv:
|
55
|
-
for d in diffs(ov, nv, prefix + k):
|
56
|
-
yield d
|
57
|
-
# ~ yield "%s : %s -> %s" % (k, ov, nv)
|
58
|
-
|
59
|
-
|
60
|
-
def compare(old, new):
|
61
|
-
changes = list(diffs(old, new))
|
62
|
-
if len(changes):
|
63
|
-
msg = "Changes since %s:" % old.get("timestamp")
|
64
|
-
msg += "\n- " + ("\n- ".join(changes))
|
65
|
-
# ~ logger.info(msg)
|
66
|
-
# ~ logger.info('- ' + ('- '.join(changes)))
|
67
|
-
return msg
|
68
|
-
else:
|
69
|
-
logger.debug("No changes since %s", old.get("timestamp"))
|
70
|
-
|
71
|
-
|
72
|
-
class Command(BaseCommand):
|
73
|
-
help = "Experimental work. Don't use this."
|
74
|
-
|
75
|
-
def add_arguments(self, parser):
|
76
|
-
parser.add_argument(
|
77
|
-
"--nowrite",
|
78
|
-
action="store_false",
|
79
|
-
dest="write",
|
80
|
-
default=True,
|
81
|
-
help="Do not write status to pickle.",
|
82
|
-
)
|
83
|
-
|
84
|
-
def handle(self, *args, **options):
|
85
|
-
if args:
|
86
|
-
raise CommandError("This command doesn't accept any arguments.")
|
87
|
-
|
88
|
-
self.options = options
|
89
|
-
|
90
|
-
# ~ settings.SITE.startup()
|
91
|
-
|
92
|
-
state = dict()
|
93
|
-
state.update(timestamp=timezone.now())
|
94
|
-
state.update(lino_version=lino.__version__)
|
95
|
-
|
96
|
-
states_file = os.path.join(settings.SITE.project_dir, "states.pck")
|
97
|
-
|
98
|
-
if os.path.exists(states_file):
|
99
|
-
fd = open(states_file)
|
100
|
-
states_list = pickle.load(fd)
|
101
|
-
fd.close()
|
102
|
-
logger.info("Loaded %d states from %s", len(states_list), states_file)
|
103
|
-
else:
|
104
|
-
states_list = []
|
105
|
-
|
106
|
-
models_list = sorted_models_list()
|
107
|
-
|
108
|
-
apps = [p.app_label for p in settings.SITE.installed_plugins]
|
109
|
-
state.update(applications=" ".join(apps))
|
110
|
-
for model in models_list:
|
111
|
-
if model._meta.managed:
|
112
|
-
model_state = dict()
|
113
|
-
# ~ cells.append(str(i))
|
114
|
-
# ~ cells.append(full_model_name(model))
|
115
|
-
# ~ cells.append(str(model))
|
116
|
-
# ~ if model._meta.managed:
|
117
|
-
# ~ cells.append('X')
|
118
|
-
# ~ else:
|
119
|
-
# ~ cells.append('')
|
120
|
-
model_state.update(fields=[f.name for f in model._meta.fields])
|
121
|
-
# ~ qs = model.objects.all()
|
122
|
-
qs = model.objects.order_by("pk")
|
123
|
-
n = qs.count()
|
124
|
-
model_state.update(rows=n)
|
125
|
-
|
126
|
-
connection = connections[DEFAULT_DB_ALIAS]
|
127
|
-
|
128
|
-
# ~ if isinstance(connection,sqlite):
|
129
|
-
# ~ cells.append("-")
|
130
|
-
if mysql and isinstance(connection, mysql):
|
131
|
-
cursor = connection.cursor()
|
132
|
-
dbname = connection.settings_dict["NAME"]
|
133
|
-
sql = """\
|
134
|
-
SELECT (data_length+index_length) tablesize
|
135
|
-
FROM information_schema.tables
|
136
|
-
WHERE table_schema='%s' and table_name='%s';
|
137
|
-
""" % (dbname, model._meta.db_table)
|
138
|
-
# ~ print sql
|
139
|
-
cursor.execute(sql)
|
140
|
-
row = cursor.fetchone()
|
141
|
-
if row is not None:
|
142
|
-
model_state.update(bytes=row[0])
|
143
|
-
else:
|
144
|
-
pass
|
145
|
-
|
146
|
-
state[full_model_name(model)] = model_state
|
147
|
-
|
148
|
-
if len(states_list):
|
149
|
-
msg = compare(state, states_list[-1])
|
150
|
-
if msg:
|
151
|
-
logger.info(msg)
|
152
|
-
# ~ sendmail_admins()
|
153
|
-
|
154
|
-
states_list.append(state)
|
155
|
-
|
156
|
-
# ~ print state
|
157
|
-
if self.options["write"]:
|
158
|
-
f = open(states_file, "w")
|
159
|
-
pickle.dump(states_list, f)
|
160
|
-
logger.info("Saved %d states to %s", len(states_list), states_file)
|
File without changes
|
File without changes
|
File without changes
|