◄ ► | Edit | Home | Admin | en de fr et | Sign in

#6776 (ets says 20260418 first selected_rows is None: [None])

by Luc Saffre · in Developers · assigned to Luc Saffre

Summary

This issue caused an internal revolution for the implementation of multi-tenancy. It removed the tenants plugin and introduced the system.host2config setting instead.

Children

Comments

  • 5 months, 2 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : ets is back after the upgrade. The problem itself is not yet fixed: users continue to see white pages with "20241003 No row #25 in publisher.Pages" quite often (i'll need more time to understand why) but at least it should no longer send lots of error messages "[ets] ERROR (EXTERNAL IP): Internal Se...
  • 5 months, 2 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : I will now release lino, xl, noi and react to pypi,and then update ets on lumi.
  • 5 months, 2 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : I pushed my changes in lino xl noi book welfare presto prima vedi and algus.
  • 5 months, 2 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : Question for tomorrow when I will have pushed my changes: I changed one line in lino_react/react/components/index.html: - <title>{% block title %}{{site.title or site.verbose_name}}{% endblock %}</title> + <title>{{ar.get_html_title()}}</title> and ran "npm run dev", but it doesn't have any eff...
  • 5 months, 2 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : Hehe, this is causing an internal avalanche! Multi-tenancy in noi2 is different from multiple ledgers in pronto because in Noi we also want anonymous users to see different things depending on the domain. Until now I thought that this requires a new settings.py (and hence a new Python process) for e...
  • 5 months, 2 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : Yes, it seems that this will work. In WithUserMiddleware.process_request(self, request) I can do something like this: if settings.SITE.with_tenants: host = request._get_raw_host() request.site_config_id = settings.SITE.plugins.tenants.host2sc.get( host, settings.SITE.p...
  • 5 months, 2 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : Seems that the middleware can analyze the host part of the incoming request and set a new attribute "site_config_id" on the request. The tenants plugin then would get a new method or simply a dict host2tenant, which maps the host to a tenant_id (or SiteConfig id... seems that we don't need a Tenant ...
  • 5 months, 2 weeks ago by Luc Saffre in reply to Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : Either the settings or some part of the url, probably the subdomain. TODO: how does Django check the ALLOWED_HOSTS setting?
  • 5 months, 2 weeks ago by Luc Saffre in reply to Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) (1 reply) : But that's not what we want. It seems to me that this example proves that only the settings and not the user can decide which tenant is active.
  • 5 months, 2 weeks ago by Luc Saffre in reply to Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : It's because noi2 is multi-tenant. When you are anonymous, Lino doesn't know which tenant to show and hence shows nothing:
    class TenantOnly(dd.Model): ... @classmethod def get_request_queryset(cls, ar, **fltr): qs = super().get_request_queryset(ar, **fltr) if dd.is_insta...
  • 5 months, 2 weeks ago by Luc Saffre in reply to Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : This is even reproducible in noi2: runserver and then click on "Root pages" in the menu as anonymous. It works when you are signed in.
  • 5 months, 3 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) (3 replies) : Okay after this change the ets site would no longer raise exceptions each time a page is not found, but it still says very often "20241003 No row #22 in publisher.Pages".
  • 5 months, 3 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : I published my changes in lino, xl, book and react.
  • 5 months, 3 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : Another question is whether ar.selected_rows should contain a None item for every invalid item of selected_pks. After some hesitation and experimenting I currently tend to answer: No, Lino silently removes invalid primary keys from the `selected_pks` keyword argument. This can cause the surprising ...
  • 5 months, 3 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : And I seem to remember that I wanted this behaviour at some moment: let get_row_by_pk() return None rather than raise an exception (because there are situations where we just want to test for existence). And it seems that I didn't finish this thought. I'm no longer sure whether it was a good idea.
  • 5 months, 3 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : publisher.Page.get_row_by_pk() returns indeed None when the specified page doesn't exist.
  • 5 months, 3 weeks ago by Luc Saffre about #6776 (ets says 20260418 first selected_rows is None: [None]) : Created new Ticket #6776 (ets says 20260418 first selected_rows is None: [None]).