Plone Interface contracts, plus basic features and utilities

Overview

plone.base

This package is the base package of the CMS Plone <https://plone.org>. It contains only interface contracts and basic features and utilities. It was created to be able to maintain a clean dependency graph (PLIP 3395).

In details this package contains:

interfaces (package)
All zope.interface based contracts for the Plone core packages. In Plone 5 and below this was at Products.CMFPlone.interfaces.
i18nl10n (module)
Plone specific internationalization and localization helpers. In Plone 5 and below this was at Products.CMFPlone.i18nl10n.
batch (module)
Plone specific Batch based on plone.batching. In Plone 5 and below this was at Products.CMFPlone.PloneBatch.
defaultpage (module)
Plone specific handling of default pages with CMFDynamicViewFTI. In Plone 5 and below this was at Products.CMFPlone.defaultpage.
permissions (module)
CMFCore permissions declared public. In Plone 5 and below this was at Products.CMFPlone.permissions.
utils (module)
A subset of commonly used and low-dependency utilities. In Plone 5 and below those been at Products.CMFPlone.utils (but not all were moved).
__init__
PloneMessageFactory with plone i18n-domain and PloneLocalesMessageFactory with plonelocales domain. In Plone 5 and below this was at Products.CMFPlone.__init__.

Source Code

Contributors please read the document Process for Plone core's development

Sources are at the Plone code repository hosted at Github.

File issues at the Products.CMFPlone issue tracker hosted at Github.

Comments
  • Fix folder_contents being broken with VHM and Multilingual

    Fix folder_contents being broken with VHM and Multilingual

    When Multilingual is enabled and VHM is enabled too, serving any folderish's folder_contents under a language folder as a top level domain name is currently broken (if en.site.com/archives is VHMed to PloneSite/en/archives then @@qsOptions URL is /archives/@@qsOptions instead of being /@@qsOptions as it should be.

    The fundamental problem is that the function get_top_site_from_url(...) is failing to retrieve the actual top site because it can't find a site in the traversal structure, so it picks the last folderish as the site, which is obvs broken because /@@qsOptions only works on site roots, not on folderish content.

    This code makes it so that any site found in the structure is returned as the top site from the URL, but if no top site is found in that traversal, the actual site from getSite() is returned instead, which is the correct behavior based on how the function is named, and actually fixes the /@@qsOptions conundrum.

    Reproducer

    Odd intersection of circumstances to reproduce bug:

    1. Create classic Plone site.
    2. Enable Multilingual with en-US or some other language.
    3. Verify visiting /Plone redirects to Plone/en-US or your language folder of choice.
    4. VHM your site so that /Plone/en-US is accessible as / (a standard, supported Multilingual rewrite configuration typically used by Ploners for language-code subdomain hosting). Plone/en-US/VirtualHostRoot is the relevant VHM rewrite.
    5. Visit the site. Verify that site is accessible as /.
    6. Create folder xxx on that location.
    7. Visit folder xxx on that location.
    8. Click on Folder contents in the editor toolbar.
    9. Verify that the folder contents screen for xxx loads, but the actual listing remains empty.
    10. Verify that there is an HTTP 404 for @@qsOptions in the network panel of your browser inspector.

    Rationale

    This code makes the method sometimes return a content object in some cases, rather than an actual site root.

    Why?

    All callsites (see below) need a "root object" from the perspective of the browser to compute a root and generate various URLs for their own purposes, because all their purposes are XHR browser stuff (fill lists of objects and search results, chiefly). This method I'm fixing determines the "root" used for that tree which is used in related items, image insertion, and folder contents browsing, and if that "root" is incorrect / does not correspond to what the browser sees as "root", nothing works.

    Needless to say, this method should never be used to traverse anything server-side.

    Quality control

    Callsites

    My omelette is big. There are not that many uses, and all its uses currently broken are fixed by this patch. I count two uses:

    1. plone.app.content.browser.contents:ContentsBaseAction / get_options / ContextInfo.call
    2. plone.app.widgets:get_relateditems_options

    Unit and regression testing

    All current unit tests pass now. I have added a test case to cover the "root URL object is not actually a site" case, which was never tested before. In addition to that, I have tested this with a local build (most up to date code) and here is what I can verify:

    • Related items works now!
    • Image insertion works as well.
    • Browsing folders in folder contents works too.

    So pretty much everything that was broken before, is no longer broken thanks to this modest change. And that is the complete manual regression test of all users of this code.

    opened by Rudd-O 29
  • Fix permissions during traversal executed from `get_top_site_from_url()`.

    Fix permissions during traversal executed from `get_top_site_from_url()`.

    My previous fix broke several tests. This appears to be the result of trying to traverse iteratively through the structure of a site (which my code does and the previous code does not do in the same way), and encountering Unauthorized exceptions during traversal (which is a legitimate thing to get, as /a/b/c may be accessible to user XXX, but /a/b may not necessarily be).

    The fix is to use unrestricted traversal (bypassing security), and then to return the selected object by using restricted traversal in that case.

    I am confident this should not result in a security issue — however I ask the true expert Plonistas to verify this confidence is warranted. Thanks.

    And sorry for the breakage. We need CI tests in plone.base.

    opened by Rudd-O 15
  • disable TinyMCE advlist plugin, it produces unclean inline styles

    disable TinyMCE advlist plugin, it produces unclean inline styles

    This plugin should not be used at all, but at least not by default. It does everything with inline styles. The recommended way to do table styling is with the formats, similar to how we did it since Plone 4.

    opened by MrTango 4
  • Merge experimental ulocalized time

    Merge experimental ulocalized time

    This lets ulocalized_time: accept a string argument to long_format, for example: ${a} ${d} hello guys ${b} ${Y}. It is a tiny change, really just one extra if-statement. Fixes https://github.com/plone/Products.CMFPlone/issues/3549.

    Also supports dollar signs in registry override for date formats. Then it uses the correct language in multilingual sites. Fixes https://github.com/plone/Products.CMFPlone/issues/3550.

    Adds lots of tests for current behavior and for the new fixes/features.

    04 type: enhancement 13 prio: normal 24 status: ready 32 needs: review 
    opened by mauritsvanrees 4
  • Fix uses of unrestrictedTraverse in get_top_site_from_url()

    Fix uses of unrestrictedTraverse in get_top_site_from_url()

    In some cases (when an object does not yet exist, for example) this method being called must skip these nonexistent objects from the recursive evaluation being done to discover the appropriate site to return.

    opened by Rudd-O 3
  • Add CI for plone.base.

    Add CI for plone.base.

    We should catch it when we miss a dependency, or notice when a dependency pulls in too many others. We currently miss the plone.schema dependency, needed for the Email field. Reported in issue #9, which needs a solution first.

    opened by mauritsvanrees 5
  • Missing plone.schema dependency

    Missing plone.schema dependency

    We currently miss the plone.schema dependency, needed for the Email field. If we add it, it pulls in plone.app.z3cform for IPloneFormLayer, and this package pulls in lots of plone.app packages.

    @jensens Do you think we should move IPloneFormLayer to plone.base? Wait: then plone.schema would need to import it from plone.base, causing a circular dependency between the two. Bad idea. Move it to plone.z3cform then?

    opened by mauritsvanrees 2
Owner
Plone Foundation
Core of the enterprise CMS Plone and related projects. For add-ons visit: https://github.com/collective
Plone Foundation
A Python package implementing various colour checker detection algorithms and related utilities.

A Python package implementing various colour checker detection algorithms and related utilities.

colour-science 147 Dec 29, 2022
Set of utilities for exporting/controlling your robot in Blender

Blender Robotics Utils This repository contains utilities for exporting/controlling your robot in Blender Maintainers This repository is maintained by

Robotology 33 Nov 30, 2022
Python utilities for writing cross-version compatible libraries

Python utilities for writing cross-version compatible libraries

Tyler M. Kontra 85 Jun 29, 2022
Michael Vinyard's utilities

Install vintools To download this package from pypi: pip install vintools Install the development package To download and install the developmen

Michael Vinyard 2 May 22, 2022
Data Utilities e.g. for importing files to onetask

Use this repository to easily convert your source files (csv, txt, excel, json, html) into record-oriented JSON files that can be uploaded into onetask.

onetask.ai 1 Jul 18, 2022
PyResToolbox - A collection of Reservoir Engineering Utilities

pyrestoolbox A collection of Reservoir Engineering Utilities This set of functio

Mark W. Burgoyne 39 Oct 17, 2022
A work in progress box containing various Python utilities

python-wipbox A set of modern Python libraries under development to simplify the execution of reusable routines by different projects. Table of Conten

Deepnox 2 Jan 20, 2022
Python based utilities for interacting with digital multimeters that are built on the FS9721-LP3 chipset.

Python based utilities for interacting with digital multimeters that are built on the FS9721-LP3 chipset.

Fergus 1 Feb 2, 2022
ZX Spectrum Utilities: (zx-spectrum-utils)

Here are a few utility programs that can be used with the zx spectrum. The ZX Spectrum is one of the first home computers from the early 1980s.

Graham Oakes 4 Mar 7, 2022
SysInfo is an app developed in python which gives Basic System Info , and some detailed graphs of system performance .

SysInfo SysInfo is an app developed in python which gives Basic System Info , and some detailed graphs of system performance . Installation Download t

null 5 Nov 8, 2021
A python package containing all the basic functions and classes for python. From simple addition to advanced file encryption.

A python package containing all the basic functions and classes for python. From simple addition to advanced file encryption.

PyBash 11 May 22, 2022
Abstraction of a Unit, includes convertions and basic operations.

Units Abstraction of a Unit, includes convertions and basic operations. ------ EXAMPLE : Free Fall (No air resistance) ------- from units_test import

null 1 Dec 23, 2021
Basic loader is a small tool that will help you generating Cloudflare cookies

Basic Loader Cloudflare cookies loader This tool may help some people getting valide cloudflare cookies Installation ?? : pip install -r requirements.

IHateTomLrge 8 Mar 30, 2022
Check the basic quality of any dataset

Data Quality Checker in Python Check the basic quality of any dataset. Sneak Peek Read full tutorial at Medium. Explore the app Requirements python 3.

MalaDeep 8 Feb 23, 2022
A tool written in python to generate basic repo files from github

A tool written in python to generate basic repo files from github

Riley 7 Dec 2, 2021
ColorController is a Pythonic interface for managing colors by english-language name and various color values.

ColorController.py Table of Contents Encode color data in various formats. 1.1: Create a ColorController object using a familiar, english-language col

Tal Zaken 2 Feb 12, 2022
A collection of common regular expressions bundled with an easy to use interface.

CommonRegex Find all times, dates, links, phone numbers, emails, ip addresses, prices, hex colors, and credit card numbers in a string. We did the har

Madison May 1.5k Dec 31, 2022
PyGMT - A Python interface for the Generic Mapping Tools

PyGMT A Python interface for the Generic Mapping Tools Documentation (development version) | Contact | Try Online Why PyGMT? A beautiful map is worth

The Generic Mapping Tools (GMT) 564 Dec 28, 2022
This is discord nitro code generator and checker made with python. This will generate nitro codes and checks if the code is valid or not. If code is valid then it will print the code leaving 2 lines and if not then it will print '*'.

Discord Nitro Generator And Checker ⚙️ Rᴜɴ Oɴ Rᴇᴘʟɪᴛ ??️ Lᴀɴɢᴜᴀɢᴇs Aɴᴅ Tᴏᴏʟs If you are taking code from this repository without a fork, then atleast

Vɪɴᴀʏᴀᴋ Pᴀɴᴅᴇʏ 37 Jan 7, 2023