Metadata-Version: 2.4
Name: collective.geotransform
Version: 4.0.0
Summary: Gracefully email obfuscation for Plone
Author-email: Victor Fernandez de Alba <sneridagh@gmail.com>
License-Expression: GPL-2.0-or-later
Project-URL: PyPI, https://pypi.org/project/collective.geotransform
Project-URL: Source, https://github.com/collective/collective.geotransform
Project-URL: Issues, https://github.com/collective/collective.geotransform/issues
Project-URL: Changelog, https://github.com/collective/collective.geotransform/blob/master/CHANGES.md
Keywords: geo,email,obfuscation,Plone,Zope
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Plone
Classifier: Framework :: Plone :: 6.1
Classifier: Framework :: Plone :: 6.2
Classifier: Framework :: Plone :: Addon
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.GPL
License-File: LICENSE.md
Requires-Dist: beautifulsoup4
Requires-Dist: lxml
Requires-Dist: plone.api
Requires-Dist: plone.base
Requires-Dist: plone.transformchain
Requires-Dist: Products.GenericSetup
Requires-Dist: zope.component
Requires-Dist: zope.interface
Requires-Dist: zope.publisher
Provides-Extra: test
Requires-Dist: plone.app.contenttypes; extra == "test"
Requires-Dist: plone.app.robotframework; extra == "test"
Requires-Dist: plone.app.testing; extra == "test"
Requires-Dist: plone.app.textfield; extra == "test"
Requires-Dist: plone.registry; extra == "test"
Requires-Dist: plone.testing; extra == "test"
Requires-Dist: robotsuite; extra == "test"
Requires-Dist: transaction; extra == "test"
Requires-Dist: zope.testrunner; extra == "test"
Dynamic: license-file

# collective.geotransform

[![Tests](https://github.com/collective/collective.geotransform/actions/workflows/test-matrix.yml/badge.svg)](https://github.com/collective/collective.geotransform/actions/workflows/test-matrix.yml)
[![Meta](https://github.com/collective/collective.geotransform/actions/workflows/meta.yml/badge.svg)](https://github.com/collective/collective.geotransform/actions/workflows/meta.yml)

GEO stands for "Gracefully E-mail Obfuscation". This package implements the solution exposed in this post of A List Apart, authored by Roel Van Gils:

http://www.alistapart.com/articles/gracefulemailobfuscation/

collective.geotransform uses plone.transformchain to transform the response output from Zope before it reaches your browser. It searches for all "mailto:" occurrences inside the response and transforms them into encoded harmless links.
It also searches for plain email addresses (without links) inside the response and transforms them into encrypted spans.
This codification is done via a simple base64 encoding, but enough to fool a spam robot.

This is the form of the encoded mailto link:

```html
<a rel="nofollow" href="geomailto:dmljdG9yLmZlcm5hbmRlejJAdXBjbmV0LmVz">Link text</a>
```

While this is the form of the encoded span for plain email address:

```html
<span class="geomailaddress">dmljdG9yLmZlcm5hbmRlejJAdXBjbmV0LmVz</span>
```

On the browser side, the encoded links and spans are decoded to their original form by using a Javascript that restores them to normal "mailto:" links and decrypted plain text emails.

Authenticated responses are NOT affected by this transform. Only anonymous responses are modified.


## Compatibility

Version 4.x supports Plone 6.1 on Python 3.10 to 3.13, and Plone 6.2 on Python
3.10 to 3.14.

Older versions support older Plone versions:

- Plone 6.0: versions 3.x
- Plone 5: versions 2.x
- Plone 4: versions 1.x


## Installation

Add `collective.geotransform` to the dependencies of your project (with pip, uv or buildout), restart Plone, then activate the add-on in the Add-ons control panel.


## Development

Requires [uv](https://docs.astral.sh/uv/). This installs the package with Plone 6.2.3 in `.venv` (use `PLONE_VERSION=6.1.6 make install` for another version) and the prek git hook.

```shell
make install
make start          # Plone on http://localhost:8080 (admin / admin)
make console        # Python console with the Zope application as `app`
```

Create a Plone site, then activate collective.geotransform in the Add-ons control panel. The transform only applies to anonymous responses: log out (or use a private window) to see the obfuscated links.

### Tests

Tests run through tox, as the CI does. The robot scenario checks that the browser decodes the links: it runs Selenium with headless Chrome.

```shell
make test                                   # Plone 6.2.3
uvx --with tox-uv tox -e py312-plone61      # one Plone / Python combination
make test-all                               # lint, every combination, dependencies
```

Without tox:

```shell
.venv/bin/zope-testrunner --all --test-path=src -s collective.geotransform
```

### Lint

```shell
make check          # format then lint (pyupgrade, isort, black, flake8...)
```

`.editorconfig`, `.flake8`, `.gitignore`, `.pre-commit-config.yaml`, `tox.ini`,
`.github/` and the tool sections of `pyproject.toml` are generated by
[plone.meta](https://github.com/plone/meta): change `.meta.toml`, then run
`uvx --from plone.meta config-package --no-commit --branch current .`.

### Release

```shell
make release        # zest.releaser fullrelease, run through uvx
```


## Contribute

- Issue Tracker: https://github.com/collective/collective.geotransform/issues
- Source Code: https://github.com/collective/collective.geotransform


## License

The project is licensed under the GPLv2 or later.


## TODO

- Accessibility form and validators

# Contributors

- Víctor Fernández de Alba, Original Author
- Laurent Lasudry
- Philip Bauer
- Benoît Suttor
- Tom Gross
- Christophe Boulanger
- Martin Peeters
- Gil Forcada Codinachs
- Maarten Kling
- Maik Derstappen
- Thomas Massmann

# Changelog

<!-- towncrier release notes start -->

## 4.0.0 (2026-11-20)


- Breaking: replace the `pkg_resources` namespace of `collective` with a
  PEP 420 native namespace, and move the package to a `src/` layout.
  Support Plone 6.1 only on Python 3.10 to 3.13, and Plone 6.2 on Python
  3.10 to 3.14. Use 3.x for Plone 6.0.
  [remdub]

- Import `safe_text`, `IFilterSchema` and `IBundleRegistry` from
  `plone.base` instead of the aliases Plone 6.2 deprecates, use
  `plone.testing.zope` in the test layers, and drop `six`.
  [remdub]

- Declare the dependencies the code imports.
  [remdub]

- Configure the package with plone.meta 2.12.0 (test matrix on Plone 6.2.3
  and 6.1), move its metadata to `pyproject.toml`, convert the documentation
  to Markdown and run the development environment on Plone 6.2.3 with uv
  instead of buildout.
  [remdub]


## 3.0 (2023-02-09)

- Add Plone 6 compatibility, drop Plone 5 support
  [boulch]


## 2.1 (2023-01-31)

- Add support for Python 3 and Plone 5.2.
  [pbauer]


## 2.0 (2020-11-18)

- Fix obfuscation with mails within texts
  [laulaz]

- Make mail detection in texts (outside textareas) more robust
  [laulaz]

- Improve / add tests
  [laulaz]


## 2.0a1 (2018-09-24)

- Plone 5 compatibility
  [tomgross]

- Add browserlayer and uninstall profile (fixes #11)
  [tomgross]


## 1.0.4 (2020-11-18)

- Make mail detection in texts (outside textareas) more robust
  [laulaz]

- Improve / add tests
  [laulaz]


## 1.0.3 (2017-12-06)

- Do not obfuscate mails inside textarea or value="" attribute (#15)
  [laulaz]


## 1.0.2 (2016-08-19)

- Do not obfuscate mails when called from Ajax, because we don't know if they
  will be de-obfuscated and that the goal is to fool non-Javascript robots
  [laulaz]


## 1.0.1 (2015-02-03)

- Add metadata.xml into profile.
  [bsuttor]

- Decode utf8 if accent in mail
  [bsuttor]

- Add upgradestep for import new metadata.xml
  [bsuttor]


## 1.0 (2014-10-22)

- Obfuscate plain text mails (#8)
  [laulaz]

- Avoid touching mailto tags content (#4)
  [laulaz]

- Avoid trying to transform non-HTML requests
  [laulaz]

- Handle links with subject and / or body (#1)
  [laulaz]

- Fix check for anonymous (#2) and for portal url (#3)
  [laulaz]

- Fix getSite location
  [laulaz]

- Add tests
  [laulaz]

- Add buildout and bootstrap
  [laulaz]


## 1.0a3 (2012-08-03)

- Fix check for anonymous
  [pbauer]


## 1.0a2 (2010-11-24)

- Fixed broken uploaded file to pypi


## 1.0a1 (2010-10-22)

- Initial release
