Skip to content

Commit b3b5e45

Browse files
committed
Merge tag '1.2.3' of https://github.com/IMIO/imio.helpers into plone61
Tagging 1.2.3
2 parents 8eaac68 + 9988689 commit b3b5e45

25 files changed

+972
-191
lines changed

CHANGES.rst

+96-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,102 @@
11
Changelog
22
=========
33

4-
1.0.0 (unreleased)
4+
1.2.3 (2025-03-11)
55
------------------
66

7+
- Improved `email.validate_email_address` to replace '""' in email.
8+
[sgeulette]
9+
- Added Plone 6.1 version in buildout.
10+
[chris-adam]
11+
12+
1.2.2 (2025-02-06)
13+
------------------
14+
15+
- Added parameters `ask_confirm=false, confirm_msg='are_you_sure'` to
16+
JS function `callViewAndReload` so it is possible to have a
17+
confirmation dialog to execute the action or not.
18+
[gbastien]
19+
20+
1.2.1 (2025-01-20)
21+
------------------
22+
23+
- Improved `emailer.send_email` to take into account 3.10.12 python bug.
24+
[sgeulette]
25+
- Removed ipython
26+
[sgeulette]
27+
28+
1.2.0 (2024-12-19)
29+
------------------
30+
31+
- Added new parameter to `batching.batch_get_keys`.
32+
[sgeulette]
33+
34+
1.1.0 (2024-10-02)
35+
------------------
36+
37+
- Imported batch_delete_files from imio.pyutils if someone is yet using it from here.
38+
[sgeulette]
39+
- batch is considered finished if no batching.
40+
[sgeulette]
41+
42+
1.0.1 (2024-09-18)
43+
------------------
44+
45+
- Generated universal wheel version.
46+
[sgeulette]
47+
48+
1.0.0 (2024-09-16)
49+
------------------
50+
51+
- Improved `emailer.send_email` to use send in place of securesend (not using queue).
52+
[sgeulette]
53+
- Added `EMPTY_DATETIME` value that corresponds to `01/01/1950 at 12:00`.
54+
[gbastien]
55+
- Improved batching module
56+
[sgeulette]
57+
- Added `batching.can_delete_batch_files`
58+
[sgeulette]
59+
60+
1.0.0rc4 (2024-07-08)
61+
---------------------
62+
63+
- Added "empty" variables to handle empty indexes searches.
64+
[sgeulette]
65+
66+
1.0.0rc3 (2024-06-07)
67+
---------------------
68+
69+
- Added `temp_disable_link` JS helper that will disable a link for 2 seconds
70+
and to avoid double clicks.
71+
[gbastien]
72+
73+
1.0.0rc2 (2024-04-10)
74+
---------------------
75+
76+
- Added batching module.
77+
[sgeulette]
78+
- Fixed the way JS function `submitFormHelperOnsuccessDefault` manages
79+
returned result when it is a file, now we have a correct `filename`.
80+
[gbastien]
81+
- Added transmogrifier Expression and Condition classes to log expression
82+
compilation or interpretation errors.
83+
[sgeulette]
84+
- Removed `content.safe_encode` as already defined in `imio.pyutils`.
85+
Import it from `imio.pyutils` in `imio.helpers.content` for temporary backward
86+
compatibility, to be removed.
87+
[gbastien]
88+
- Overrided `@@folder_contents` to make it work with `DashboardCollection`.
89+
[gbastien]
90+
- Monkeypatched `plone.app.querystring.registryreader.getVocabularyValues`
91+
to keep vocabulary order onloy for Plone4, behavior is correct in Plone5+.
92+
Manage every `HAS_PLONE_X` values.
93+
[gbastien]
94+
95+
1.0.0rc1 (2024-02-08)
96+
---------------------
97+
98+
- Made compliant with Plone 4, Plone 5, Plone 6
99+
[boulch, laulaz, sgeulette]
7100
- Require `pathlib2` in `setup.py`, backport `pathlib` for `py2.7`.
8101
[gbastien]
9102
- Added `security.setup_app` to be used in run scripts.
@@ -12,11 +105,11 @@ Changelog
12105
[sgeulette]
13106
- Added `setup.test_remove_gs_step` to remove a generic setup step.
14107
[sgeulette]
108+
- Added `imio.helpers.YesNoForFacetedVocabulary`
109+
[sgeulette]
15110
- Fixed `content.base_getattr` that was not returning the `default` if attribute
16111
not existing.
17112
[gbastien]
18-
- Added Plone 6.1 version in buildout.
19-
[chris-adam]
20113

21114
0.80 (2023-12-11)
22115
-----------------

base.cfg

+1-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ eggs +=
2727
Pillow
2828
# Products.PDBDebugMode
2929
# collective.profiler
30-
# ipdb
3130
pdbpp
3231
# plone.reload
3332

@@ -54,6 +53,7 @@ always-checkout = force
5453
auto-checkout +=
5554
appy
5655
collective.behavior.talcondition
56+
imio.pyutils
5757

5858
[testenv]
5959
decorate_acl_methods = true
@@ -65,9 +65,7 @@ eggs = ${test:eggs}
6565
[instance]
6666
eggs +=
6767
${buildout:eggs}
68-
iw.debug
6968
zcml +=
70-
iw.debug
7169

7270
[ploneversioncheck]
7371
recipe = zc.recipe.egg

checkouts.cfg

-8
This file was deleted.

setup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name='imio.helpers',
13-
version='1.0.0.dev0',
13+
version='1.2.3',
1414
description="Various helper methods for development.",
1515
long_description=long_description,
1616
# Get more from http://pypi.python.org/pypi?%3Aaction=list_classifiers
@@ -46,7 +46,7 @@
4646
'collective.fingerpointing',
4747
'collective.monkeypatcher',
4848
'future>=0.18.2',
49-
'imio.pyutils>=1.0.0a0',
49+
'imio.pyutils>=1.1.1',
5050
'natsort',
5151
"pathlib2;python_version<'3'",
5252
'plone.api>1.9.1',
@@ -62,7 +62,6 @@
6262
'test': [
6363
'collective.behavior.talcondition',
6464
'collective.MockMailHost',
65-
'ipdb',
6665
'plone.app.dexterity',
6766
'plone.app.testing',
6867
],
@@ -78,4 +77,5 @@
7877
[z3c.autoinclude.plugin]
7978
target = plone
8079
""",
80+
options={"bdist_wheel": {"universal": True}},
8181
)

sources.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ cedricmessiant_push = [email protected]:cedricmessiant
1919
[sources]
2020
appy = git ${remotes:imio}/appy.git pushurl=${remotes:imio_push}/appy.git
2121
collective.behavior.talcondition = git ${remotes:collective}/collective.behavior.talcondition.git pushurl=${remotes:collective_push}/collective.behavior.talcondition.git
22+
imio.pyutils = git ${remotes:imio}/imio.pyutils.git pushurl=${remotes:imio_push}/imio.pyutils.git

src/imio/helpers/__init__.py

+28-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# -*- coding: utf-8 -*-
22

3+
from datetime import date
4+
from datetime import datetime
35
from imio.helpers.cache import get_cachekey_volatile
46
from plone import api
57
from plone.memoize import ram as pmram
@@ -13,36 +15,49 @@
1315
import os
1416

1517

16-
_ = MessageFactory('imio.helpers')
17-
logger = logging.getLogger('imio.helpers')
18+
_ = MessageFactory("imio.helpers")
19+
logger = logging.getLogger("imio.helpers")
1820

21+
HAS_PLONE_4 = api.env.plone_version().startswith("4")
22+
HAS_PLONE_5 = api.env.plone_version().startswith("5")
23+
HAS_PLONE_5_1 = api.env.plone_version() > "5.1"
24+
HAS_PLONE_5_2 = api.env.plone_version() > "5.2"
1925
HAS_PLONE_5_AND_MORE = int(api.env.plone_version()[0]) >= 5
2026
PLONE_MAJOR_VERSION = int(api.env.plone_version()[0])
2127

28+
EMPTY_TITLE = "No value"
29+
EMPTY_STRING = "__empty_string__"
30+
EMPTY_DATE = date(1950, 1, 1)
31+
EMPTY_DATETIME = datetime(1950, 1, 1, 12, 0)
32+
2233

2334
def GroupsTool__getGroupsForPrincipal_cachekey(method, self, principal):
2435
req = getRequest()
2536
if req is None:
2637
raise pmram.DontCache
27-
date = get_cachekey_volatile('_users_groups_value')
38+
date = get_cachekey_volatile("_users_groups_value")
2839
return date, principal and principal.getId()
2940

3041

3142
def GroupAwareRoleManager__getRolesForPrincipal_cachekey(method, self, principal, request=None):
3243
req = request or getRequest()
3344
# if req is None:
3445
# raise pmram.DontCache
35-
date = get_cachekey_volatile('_users_groups_value')
36-
return (date, principal and principal.getId(), repr(req), req and (req.get('__ignore_direct_roles__', False),
37-
req.get('__ignore_group_roles__', False)) or (None, None))
46+
date = get_cachekey_volatile("_users_groups_value")
47+
return (
48+
date,
49+
principal and principal.getId(),
50+
repr(req),
51+
req and (req.get("__ignore_direct_roles__", False), req.get("__ignore_group_roles__", False)) or (None, None),
52+
)
3853

3954

4055
def PluggableAuthService__getGroupsForPrincipal_cachekey(method, self, principal, request=None, **kwargs):
4156
req = request or getRequest()
4257
if req is None:
4358
raise pmram.DontCache
4459
try:
45-
date = get_cachekey_volatile('_users_groups_value')
60+
date = get_cachekey_volatile("_users_groups_value")
4661
except api.portal.CannotGetPortalError:
4762
raise pmram.DontCache
4863
return date, principal and principal.getId()
@@ -53,18 +68,18 @@ def PluggableAuthService__findUser_cachekey(method, self, plugins, user_id, name
5368
if req is None:
5469
raise pmram.DontCache
5570
try:
56-
date = get_cachekey_volatile('_users_groups_value')
71+
date = get_cachekey_volatile("_users_groups_value")
5772
except api.portal.CannotGetPortalError:
5873
raise pmram.DontCache
59-
return date, repr(plugins), user_id, name, str(req and req._debug or '')
74+
return date, repr(plugins), user_id, name, str(req and req._debug or "")
6075

6176

6277
def PluggableAuthService__verifyUser_cachekey(method, self, plugins, user_id=None, login=None):
6378
req = getRequest()
6479
if req is None:
6580
raise pmram.DontCache
6681

67-
date = get_cachekey_volatile('_users_groups_value')
82+
date = get_cachekey_volatile("_users_groups_value")
6883
return date, repr(plugins), user_id, login
6984

7085

@@ -73,12 +88,12 @@ def GroupsTool_getGroupById_cachekey(method, self, group_id):
7388
if req is None:
7489
raise pmram.DontCache
7590

76-
date = get_cachekey_volatile('_users_groups_value')
91+
date = get_cachekey_volatile("_users_groups_value")
7792
return date, group_id
7893

7994

80-
if os.getenv('decorate_acl_methods', 'Nope') in ('True', 'true'):
81-
logger.info('DECORATING various acl related methods with cache')
95+
if os.getenv("decorate_acl_methods", "Nope") in ("True", "true"):
96+
logger.info("DECORATING various acl related methods with cache")
8297
decorator = pmram.cache(GroupsTool__getGroupsForPrincipal_cachekey)
8398
GroupsTool.getGroupsForPrincipal = decorator(GroupsTool.getGroupsForPrincipal)
8499
decorator = pmram.cache(GroupAwareRoleManager__getRolesForPrincipal_cachekey)

0 commit comments

Comments
 (0)