lino 25.3.2__py3-none-any.whl → 25.3.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/api/doctest.py +1 -0
- lino/core/site.py +9 -76
- lino/locale/bn/LC_MESSAGES/django.po +1112 -907
- lino/locale/de/LC_MESSAGES/django.mo +0 -0
- lino/locale/de/LC_MESSAGES/django.po +1066 -918
- lino/locale/django.pot +1041 -900
- lino/locale/es/LC_MESSAGES/django.po +1103 -902
- lino/locale/et/LC_MESSAGES/django.po +1103 -915
- lino/locale/fr/LC_MESSAGES/django.po +1105 -916
- lino/locale/nl/LC_MESSAGES/django.po +1102 -917
- lino/locale/pt_BR/LC_MESSAGES/django.po +1099 -900
- lino/locale/zh_Hant/LC_MESSAGES/django.po +1099 -900
- lino/management/commands/buildcache.py +48 -3
- lino/management/commands/dump2py.py +5 -7
- lino/management/commands/install.py +2 -2
- lino/management/commands/prep.py +4 -8
- lino/mixins/duplicable.py +1 -1
- lino/modlib/checkdata/models.py +33 -15
- lino/modlib/comments/fixtures/demo2.py +1 -9
- lino/modlib/extjs/views.py +1 -1
- lino/modlib/users/ui.py +4 -2
- lino/modlib/weasyprint/__init__.py +12 -20
- lino/modlib/weasyprint/config/weasyprint/base.weasy.html +10 -1
- lino/utils/__init__.py +1 -0
- lino/utils/dbhash.py +112 -0
- {lino-25.3.2.dist-info → lino-25.3.4.dist-info}/METADATA +1 -1
- {lino-25.3.2.dist-info → lino-25.3.4.dist-info}/RECORD +31 -31
- lino/management/commands/buildsite.py +0 -57
- {lino-25.3.2.dist-info → lino-25.3.4.dist-info}/WHEEL +0 -0
- {lino-25.3.2.dist-info → lino-25.3.4.dist-info}/licenses/AUTHORS.rst +0 -0
- {lino-25.3.2.dist-info → lino-25.3.4.dist-info}/licenses/COPYING +0 -0
lino/__init__.py
CHANGED
@@ -31,7 +31,7 @@ from django import VERSION
|
|
31
31
|
from django.apps import AppConfig
|
32
32
|
from django.conf import settings
|
33
33
|
import warnings
|
34
|
-
__version__ = '25.3.
|
34
|
+
__version__ = '25.3.4'
|
35
35
|
|
36
36
|
# import setuptools # avoid UserWarning "Distutils was imported before Setuptools"?
|
37
37
|
|
lino/api/doctest.py
CHANGED
@@ -22,6 +22,7 @@ from django.db.models import Model
|
|
22
22
|
from lino.core.actions import ShowTable
|
23
23
|
from lino.core.menus import Menu
|
24
24
|
from lino.utils.html import html2text
|
25
|
+
from lino.utils import dbhash
|
25
26
|
from lino.core.utils import full_model_name, get_models
|
26
27
|
from lino.utils.diag import visible_for
|
27
28
|
from lino.sphinxcontrib.actordoc import menuselection_text
|
lino/core/site.py
CHANGED
@@ -3,14 +3,12 @@
|
|
3
3
|
# License: GNU Affero General Public License v3 (see file COPYING for details)
|
4
4
|
# doctest lino/core/site.py
|
5
5
|
|
6
|
-
import json
|
7
6
|
from lino.core.exceptions import ChangedAPI
|
8
|
-
from
|
7
|
+
from django.apps import apps
|
9
8
|
from lino.utils.html import E, tostring
|
10
9
|
from lino import assert_django_code, DJANGO_DEFAULT_LANGUAGE
|
11
10
|
# from lino.core import constants
|
12
11
|
from lino.core.plugin import Plugin
|
13
|
-
from lino.core.utils import full_model_name as fmn
|
14
12
|
from rstgen.confparser import ConfigParser
|
15
13
|
from django.utils import translation
|
16
14
|
from django.utils.html import mark_safe
|
@@ -657,7 +655,6 @@ class Site(object):
|
|
657
655
|
log_file_path = logdir / self.logger_filename
|
658
656
|
# print("20231019 logging", file_level, "to", log_file_path)
|
659
657
|
self.log_sock_path = logdir / (self.logger_filename + ".sock")
|
660
|
-
# if is_logserver() or not self.log_sock_path.exists():
|
661
658
|
if self.log_sock_path.exists():
|
662
659
|
# print("20231019 log via socket server")
|
663
660
|
handlers["file"] = {
|
@@ -1348,10 +1345,8 @@ class Site(object):
|
|
1348
1345
|
setattr(obj, name, resolve_model(spec, strict=msg))
|
1349
1346
|
|
1350
1347
|
def on_each_app(self, methname, *args):
|
1351
|
-
|
1352
|
-
|
1353
|
-
apps = [a.models_module for a in apps.get_app_configs()]
|
1354
|
-
for mod in apps:
|
1348
|
+
modules = [a.models_module for a in apps.get_app_configs()]
|
1349
|
+
for mod in modules:
|
1355
1350
|
meth = getattr(mod, methname, None)
|
1356
1351
|
if meth is not None:
|
1357
1352
|
if False: # 20150925 once we will do it for good...
|
@@ -1470,7 +1465,7 @@ class Site(object):
|
|
1470
1465
|
def setup_actions(self):
|
1471
1466
|
from lino.core.merge import MergeAction
|
1472
1467
|
|
1473
|
-
for m in get_models():
|
1468
|
+
for m in apps.get_models():
|
1474
1469
|
if m.allow_merge_action:
|
1475
1470
|
m.define_action(merge_row=MergeAction(m))
|
1476
1471
|
|
@@ -1794,61 +1789,6 @@ class Site(object):
|
|
1794
1789
|
# ~ return v
|
1795
1790
|
# ~ return getattr(obj,attrname,*args)
|
1796
1791
|
|
1797
|
-
def mark_virgin(self):
|
1798
|
-
"""
|
1799
|
-
Mark the database as virgin. This is called by :manage:`prep`.
|
1800
|
-
"""
|
1801
|
-
dbhash = self.get_dbhash()
|
1802
|
-
fn = self.site_dir / "dbhash.json"
|
1803
|
-
with fn.open("w") as fp:
|
1804
|
-
json.dump(dbhash, fp)
|
1805
|
-
# self.site.logger.info("Wrote %s", fn)
|
1806
|
-
|
1807
|
-
def check_virgin(self):
|
1808
|
-
"""
|
1809
|
-
Verify whether the database is virgin. Print the differences if there
|
1810
|
-
are any.
|
1811
|
-
"""
|
1812
|
-
new = self.get_dbhash()
|
1813
|
-
db = self.site_dir
|
1814
|
-
fn = db / "dbhash.json"
|
1815
|
-
if not fn.exists():
|
1816
|
-
raise Exception(
|
1817
|
-
f"No `dbhash.json` in {db} (did you run `django-admin prep`?)")
|
1818
|
-
with fn.open("r") as fp:
|
1819
|
-
old = json.load(fp)
|
1820
|
-
|
1821
|
-
# noi1r has noi1e as master_site, but the react front end removes the
|
1822
|
-
# tinymce plugin, i.e. noi1r doesn't care about
|
1823
|
-
# tinymce.TextFieldTemplate model.
|
1824
|
-
|
1825
|
-
ok = True
|
1826
|
-
for k, v in new.items():
|
1827
|
-
v = set(v)
|
1828
|
-
oldv = set(old.get(k, None))
|
1829
|
-
if oldv != v:
|
1830
|
-
if ok:
|
1831
|
-
print(f"Database {db} isn't virgin:")
|
1832
|
-
ok = False
|
1833
|
-
diffs = []
|
1834
|
-
if (added := len(oldv-v)):
|
1835
|
-
diffs.append(f"{added} rows added")
|
1836
|
-
if (removed := len(v-oldv)):
|
1837
|
-
diffs.append(f"{removed} rows removed")
|
1838
|
-
print(f"- {k}: {', '.join(diffs)}")
|
1839
|
-
|
1840
|
-
def get_dbhash(self):
|
1841
|
-
"""
|
1842
|
-
Return a dictionary with a hash value of the current database content.
|
1843
|
-
"""
|
1844
|
-
rv = dict()
|
1845
|
-
for m in get_models(include_auto_created=True):
|
1846
|
-
k = fmn(m)
|
1847
|
-
if k != "sessions.Session":
|
1848
|
-
# rv[k] = m.objects.count()
|
1849
|
-
rv[k] = list(m.objects.values_list('pk', flat=True))
|
1850
|
-
return rv
|
1851
|
-
|
1852
1792
|
def diagnostic_report_rst(self, *args):
|
1853
1793
|
"""Returns a string with a diagnostic report about this
|
1854
1794
|
site. :manage:`diag` is a command-line shortcut to this.
|
@@ -1998,18 +1938,9 @@ class Site(object):
|
|
1998
1938
|
return self._sorted_plugins
|
1999
1939
|
|
2000
1940
|
def setup_menu(self, user_type, main, ar=None):
|
2001
|
-
# from django.apps import apps
|
2002
|
-
# apps = [a.models_module for a in apps.get_app_configs()]
|
2003
|
-
|
2004
1941
|
for k, label in self.top_level_menus:
|
2005
1942
|
methname = "setup_{0}_menu".format(k)
|
2006
1943
|
|
2007
|
-
# for mod in apps:
|
2008
|
-
# if hasattr(mod, methname):
|
2009
|
-
# msg = "{0} still has a function {1}(). \
|
2010
|
-
# Please convert to Plugin method".format(mod, methname)
|
2011
|
-
# raise ChangedAPI(msg)
|
2012
|
-
|
2013
1944
|
if label is None:
|
2014
1945
|
menu = main
|
2015
1946
|
else:
|
@@ -2074,6 +2005,9 @@ class Site(object):
|
|
2074
2005
|
return mark_safe(s)
|
2075
2006
|
|
2076
2007
|
def build_site_cache(self, force=False, later=False, verbosity=1):
|
2008
|
+
from lino.modlib.users.utils import with_user_profile
|
2009
|
+
from lino.modlib.users.choicelists import UserTypes
|
2010
|
+
# from django.utils import translation
|
2077
2011
|
# if not self.is_prepared:
|
2078
2012
|
# self.prepare_layouts()
|
2079
2013
|
# self.is_prepared = True
|
@@ -2108,9 +2042,8 @@ class Site(object):
|
|
2108
2042
|
|
2109
2043
|
self.makedirs_if_missing(self.media_root / "webdav")
|
2110
2044
|
|
2111
|
-
|
2112
|
-
|
2113
|
-
# from django.utils import translation
|
2045
|
+
if verbosity > 0:
|
2046
|
+
self.logger.info("Build site cache in %s.", self.media_root)
|
2114
2047
|
|
2115
2048
|
started = time.time()
|
2116
2049
|
count = 0
|