Versionned attachment for AnyBlok
Project description
.. This file is a part of the AnyBlok / Attachment project
..
.. Copyright (C) 2017 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
..
.. This Source Code Form is subject to the terms of the Mozilla Public License,
.. v. 2.0. If a copy of the MPL was not distributed with this file,You can
.. obtain one at http://mozilla.org/MPL/2.0/.
.. image:: https://img.shields.io/pypi/pyversions/anyblok_attachment.svg?longCache=True
:alt: Python versions
.. image:: https://travis-ci.org/AnyBlok/anyblok_attachment.svg?branch=master
:target: https://travis-ci.org/AnyBlok/anyblok_attachment
:alt: Build status
.. image:: https://coveralls.io/repos/github/AnyBlok/anyblok_attachment/badge.svg?branch=master
:target: https://coveralls.io/github/AnyBlok/anyblok_attachment?branch=master
:alt: Coverage
.. image:: https://img.shields.io/pypi/v/anyblok_attachment.svg
:target: https://pypi.python.org/pypi/anyblok_attachment/
:alt: Version status
.. image:: https://readthedocs.org/projects/anyblok-attachment/badge/?version=latest
:alt: Documentation Status
:scale: 100%
:target: https://doc.anyblok-attachment.anyblok.org/?badge=latest
AnyBlok attachment
==================
Improve `AnyBlok <http://doc.anyblok.org>`_ to add attachment and report
system.
+-------------------------+-----------------+-----------------------------------------------------+
| Blok | Dependancies | Description |
+=========================+=================+=====================================================+
| **attachment** | | Stock and historize Document |
+-------------------------+-----------------+-----------------------------------------------------+
| **report** | **attachment** | Core of the reporting engine for AnyBlok. This blok |
| | | add helper to generate a Document, but it is not a |
| | | templating engine. |
+-------------------------+-----------------+-----------------------------------------------------+
| **report-format** | **attachment** | Simple templating engine, based on |
| | **report** | ``str.format(...)`` |
+-------------------------+-----------------+-----------------------------------------------------+
| **wkhtml2pdf** | **attachment** | Add Model add method to convert HTML 2 PDF. |
| | **report** | |
+-------------------------+-----------------+-----------------------------------------------------+
| **attachment-postgres** | **attachment** | Add Model add method to convert HTML 2 PDF. |
| | | |
+-------------------------+-----------------+-----------------------------------------------------+
AnyBlok / Attachment is released under the terms of the `Mozilla Public License`.
See the `latest documentation <http://doc.anyblok-attachment.anyblok.org/>`_
.. This file is a part of the AnyBlok / Attachment project
..
.. Copyright (C) 2017 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
..
.. This Source Code Form is subject to the terms of the Mozilla Public License,
.. v. 2.0. If a copy of the MPL was not distributed with this file,You can
.. obtain one at http://mozilla.org/MPL/2.0/.
Front Matter
============
Information about the AnyBlok / Attachment project.
Project Homepage
----------------
AnyBlok is hosted on `github <http://github.com>`_ - the main project
page is at https://github.com/AnyBlok/anyblok_attachment. Source code is
tracked here using `GIT <https://git-scm.com>`_.
Releases and project status are available on Pypi at
http://pypi.python.org/pypi/anyblok_attachment.
The most recent published version of this documentation should be at
http://doc.anyblok-attachment.anyblok.org.
Project Status
--------------
AnyBlok with attachment is currently in beta status and is expected to be fairly
stable. Users should take care to report bugs and missing features on an as-needed
basis. It should be expected that the development version may be required
for proper implementation of recently repaired issues in between releases;
Installation
------------
Install released versions of AnyBlok from the Python package index with
`pip <http://pypi.python.org/pypi/pip>`_ or a similar tool::
pip install anyblok_attachment
Installation via source distribution is via the ``setup.py`` script::
python setup.py install
Installation will add the ``anyblok`` commands to the environment.
Unit Test
---------
Run the test with ``nose``::
pip install nose
nosetests anyblok_attachment/tests
Dependencies
------------
AnyBlok / Attachment works with **Python 3.5** and later. The install process will
ensure that `AnyBlok <http://doc.anyblok.org>`_ is installed, in addition to other
dependencies. The latest version of them is strongly recommended.
Author
------
Jean-Sébastien Suzanne
Contributors
------------
`Anybox <http://anybox.fr>`_ team:
* Jean-Sébastien Suzanne
`Sensee <http://sensee.com>`_ team:
* Franck Bret
* Hugo Quezada
Bugs
----
Bugs and feature enhancements to AnyBlok should be reported on the `Issue
tracker <https://github.com/AnyBlok/anyblok_attachment/issues>`_.
.. This file is a part of the AnyBlok / Attachment project
..
.. Copyright (C) 2017 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
.. Copyright (C) 2018 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
.. Copyright (C) 2018 Jean-Sebastien SUZANNE <js.suzanne@gmail.com>
.. Copyright (C) 2020 Jean-Sebastien SUZANNE <js.suzanne@gmail.com>
..
.. This Source Code Form is subject to the terms of the Mozilla Public License,
.. v. 2.0. If a copy of the MPL was not distributed with this file,You can
.. obtain one at http://mozilla.org/MPL/2.0/.
.. contents::
CHANGELOG
=========
2.2.0 (2021-8-17)
------------------
* Adapted to **AnyBlok >= 1.2**
2.1.0 (2020-05-05)
------------------
* Removed **Python 3.4** capability
* Removed **Python 3.5** capability
* Refactored unittest, replaced nose by pytest
* Added **attachment_postgres** blok, only for postgresql driver,
the **LargeBinary** column is replaced by **LargeObject** column
2.0.0 (2018-11-28)
------------------
* Removed the sequence created by the document. Replaced it by a simple counter on latest document
.. note::
You can use this script before migration to update the database::
CREATE FUNCTION update_attachment() RETURNS void AS $$
DECLARE
-- declarations
target RECORD;
BEGIN
FOR target IN select uuid, version from attachment_document where version_number is null LOOP
UPDATE attachment_document SET version_number = CAST(substring(target.version from '..$') as Integer) WHERE uuid = target.uuid AND version = target.version;
END LOOP;
END;
$$ LANGUAGE plpgsql;
CREATE FUNCTION update_sequence() RETURNS void AS $$
DECLARE
-- declarations
seq RECORD;
BEGIN
FOR seq IN select id, seq_name from system_sequence where code ilike 'Attachment.Document#%' LOOP
EXECUTE 'DROP SEQUENCE ' || quote_ident(seq.seq_name);
DELETE FROM system_sequence where id = seq.id;
END LOOP;
END;
$$ LANGUAGE plpgsql;
ALTER TABLE attachment_document DROP CONSTRAINT anyblok_pk_attachment_document;
ALTER TABLE attachment_document ADD COLUMN version_number INTEGER;
select update_attachment();
select update_sequence();
ALTER TABLE attachment_document ADD PRIMARY KEY (uuid, version_number);
UPDATE system_blok SET installed_version = '2.0.0' WHERE name = 'attachment';
DROP FUNCTION update_attachment();
DROP FUNCTION update_sequence();
1.2.0 (2018-09-14)
------------------
* Allow to get another field to represent the file
* PR #4: Added a column name on the template to identify them easyly (@GohuHQ)
* PR #3: Fixed option name for wkhtmltopdf (@GohuHQ)
1.1.1 (2018-06-05)
------------------
* Fix the mixins come from **anyblok_mixins**
1.1.0 (2018-05-16)
------------------
* [ADD] add Mixin ``Mixin.LatestDocument`` and ``Mixin.VersionedDocument``
to help the developer to get **latest_document** or **versioned_document**
1.0.2 (2018-02-24)
------------------
* [REF] Anyblok 0.17.0 changed setter to add application and application
groups, So I had to adapt the existing to use new setter
1.0.1 (2018-01-11)
------------------
* [FIX] ``Mixin.WkHtml2Pdf`` check also if the configuration changed for
**Template.check_if_file_must_be_generated**
1.0.0 (2018-01-10)
------------------
* [ADD] **attachment** blok: stock versionned file
* [ADD] **report** blok: create versionned file from template
* [ADD] **report-format** blok: template type
* [ADD] **wkhtml2pdf** blok: convert html to pdf in the template
..
.. Copyright (C) 2017 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
..
.. This Source Code Form is subject to the terms of the Mozilla Public License,
.. v. 2.0. If a copy of the MPL was not distributed with this file,You can
.. obtain one at http://mozilla.org/MPL/2.0/.
.. image:: https://img.shields.io/pypi/pyversions/anyblok_attachment.svg?longCache=True
:alt: Python versions
.. image:: https://travis-ci.org/AnyBlok/anyblok_attachment.svg?branch=master
:target: https://travis-ci.org/AnyBlok/anyblok_attachment
:alt: Build status
.. image:: https://coveralls.io/repos/github/AnyBlok/anyblok_attachment/badge.svg?branch=master
:target: https://coveralls.io/github/AnyBlok/anyblok_attachment?branch=master
:alt: Coverage
.. image:: https://img.shields.io/pypi/v/anyblok_attachment.svg
:target: https://pypi.python.org/pypi/anyblok_attachment/
:alt: Version status
.. image:: https://readthedocs.org/projects/anyblok-attachment/badge/?version=latest
:alt: Documentation Status
:scale: 100%
:target: https://doc.anyblok-attachment.anyblok.org/?badge=latest
AnyBlok attachment
==================
Improve `AnyBlok <http://doc.anyblok.org>`_ to add attachment and report
system.
+-------------------------+-----------------+-----------------------------------------------------+
| Blok | Dependancies | Description |
+=========================+=================+=====================================================+
| **attachment** | | Stock and historize Document |
+-------------------------+-----------------+-----------------------------------------------------+
| **report** | **attachment** | Core of the reporting engine for AnyBlok. This blok |
| | | add helper to generate a Document, but it is not a |
| | | templating engine. |
+-------------------------+-----------------+-----------------------------------------------------+
| **report-format** | **attachment** | Simple templating engine, based on |
| | **report** | ``str.format(...)`` |
+-------------------------+-----------------+-----------------------------------------------------+
| **wkhtml2pdf** | **attachment** | Add Model add method to convert HTML 2 PDF. |
| | **report** | |
+-------------------------+-----------------+-----------------------------------------------------+
| **attachment-postgres** | **attachment** | Add Model add method to convert HTML 2 PDF. |
| | | |
+-------------------------+-----------------+-----------------------------------------------------+
AnyBlok / Attachment is released under the terms of the `Mozilla Public License`.
See the `latest documentation <http://doc.anyblok-attachment.anyblok.org/>`_
.. This file is a part of the AnyBlok / Attachment project
..
.. Copyright (C) 2017 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
..
.. This Source Code Form is subject to the terms of the Mozilla Public License,
.. v. 2.0. If a copy of the MPL was not distributed with this file,You can
.. obtain one at http://mozilla.org/MPL/2.0/.
Front Matter
============
Information about the AnyBlok / Attachment project.
Project Homepage
----------------
AnyBlok is hosted on `github <http://github.com>`_ - the main project
page is at https://github.com/AnyBlok/anyblok_attachment. Source code is
tracked here using `GIT <https://git-scm.com>`_.
Releases and project status are available on Pypi at
http://pypi.python.org/pypi/anyblok_attachment.
The most recent published version of this documentation should be at
http://doc.anyblok-attachment.anyblok.org.
Project Status
--------------
AnyBlok with attachment is currently in beta status and is expected to be fairly
stable. Users should take care to report bugs and missing features on an as-needed
basis. It should be expected that the development version may be required
for proper implementation of recently repaired issues in between releases;
Installation
------------
Install released versions of AnyBlok from the Python package index with
`pip <http://pypi.python.org/pypi/pip>`_ or a similar tool::
pip install anyblok_attachment
Installation via source distribution is via the ``setup.py`` script::
python setup.py install
Installation will add the ``anyblok`` commands to the environment.
Unit Test
---------
Run the test with ``nose``::
pip install nose
nosetests anyblok_attachment/tests
Dependencies
------------
AnyBlok / Attachment works with **Python 3.5** and later. The install process will
ensure that `AnyBlok <http://doc.anyblok.org>`_ is installed, in addition to other
dependencies. The latest version of them is strongly recommended.
Author
------
Jean-Sébastien Suzanne
Contributors
------------
`Anybox <http://anybox.fr>`_ team:
* Jean-Sébastien Suzanne
`Sensee <http://sensee.com>`_ team:
* Franck Bret
* Hugo Quezada
Bugs
----
Bugs and feature enhancements to AnyBlok should be reported on the `Issue
tracker <https://github.com/AnyBlok/anyblok_attachment/issues>`_.
.. This file is a part of the AnyBlok / Attachment project
..
.. Copyright (C) 2017 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
.. Copyright (C) 2018 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
.. Copyright (C) 2018 Jean-Sebastien SUZANNE <js.suzanne@gmail.com>
.. Copyright (C) 2020 Jean-Sebastien SUZANNE <js.suzanne@gmail.com>
..
.. This Source Code Form is subject to the terms of the Mozilla Public License,
.. v. 2.0. If a copy of the MPL was not distributed with this file,You can
.. obtain one at http://mozilla.org/MPL/2.0/.
.. contents::
CHANGELOG
=========
2.2.0 (2021-8-17)
------------------
* Adapted to **AnyBlok >= 1.2**
2.1.0 (2020-05-05)
------------------
* Removed **Python 3.4** capability
* Removed **Python 3.5** capability
* Refactored unittest, replaced nose by pytest
* Added **attachment_postgres** blok, only for postgresql driver,
the **LargeBinary** column is replaced by **LargeObject** column
2.0.0 (2018-11-28)
------------------
* Removed the sequence created by the document. Replaced it by a simple counter on latest document
.. note::
You can use this script before migration to update the database::
CREATE FUNCTION update_attachment() RETURNS void AS $$
DECLARE
-- declarations
target RECORD;
BEGIN
FOR target IN select uuid, version from attachment_document where version_number is null LOOP
UPDATE attachment_document SET version_number = CAST(substring(target.version from '..$') as Integer) WHERE uuid = target.uuid AND version = target.version;
END LOOP;
END;
$$ LANGUAGE plpgsql;
CREATE FUNCTION update_sequence() RETURNS void AS $$
DECLARE
-- declarations
seq RECORD;
BEGIN
FOR seq IN select id, seq_name from system_sequence where code ilike 'Attachment.Document#%' LOOP
EXECUTE 'DROP SEQUENCE ' || quote_ident(seq.seq_name);
DELETE FROM system_sequence where id = seq.id;
END LOOP;
END;
$$ LANGUAGE plpgsql;
ALTER TABLE attachment_document DROP CONSTRAINT anyblok_pk_attachment_document;
ALTER TABLE attachment_document ADD COLUMN version_number INTEGER;
select update_attachment();
select update_sequence();
ALTER TABLE attachment_document ADD PRIMARY KEY (uuid, version_number);
UPDATE system_blok SET installed_version = '2.0.0' WHERE name = 'attachment';
DROP FUNCTION update_attachment();
DROP FUNCTION update_sequence();
1.2.0 (2018-09-14)
------------------
* Allow to get another field to represent the file
* PR #4: Added a column name on the template to identify them easyly (@GohuHQ)
* PR #3: Fixed option name for wkhtmltopdf (@GohuHQ)
1.1.1 (2018-06-05)
------------------
* Fix the mixins come from **anyblok_mixins**
1.1.0 (2018-05-16)
------------------
* [ADD] add Mixin ``Mixin.LatestDocument`` and ``Mixin.VersionedDocument``
to help the developer to get **latest_document** or **versioned_document**
1.0.2 (2018-02-24)
------------------
* [REF] Anyblok 0.17.0 changed setter to add application and application
groups, So I had to adapt the existing to use new setter
1.0.1 (2018-01-11)
------------------
* [FIX] ``Mixin.WkHtml2Pdf`` check also if the configuration changed for
**Template.check_if_file_must_be_generated**
1.0.0 (2018-01-10)
------------------
* [ADD] **attachment** blok: stock versionned file
* [ADD] **report** blok: create versionned file from template
* [ADD] **report-format** blok: template type
* [ADD] **wkhtml2pdf** blok: convert html to pdf in the template
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
anyblok_attachment-2.2.0.tar.gz
(24.9 kB
view details)
Built Distribution
File details
Details for the file anyblok_attachment-2.2.0.tar.gz
.
File metadata
- Download URL: anyblok_attachment-2.2.0.tar.gz
- Upload date:
- Size: 24.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d0579c80ccbc198ed105b8499f4a335e03c3e98c7756de8ba5b1f511997a5d9 |
|
MD5 | 52d6948e9ae7ee855c1846f57ff03331 |
|
BLAKE2b-256 | 4bb26d7ce9755042e2e739aec9d94c26312f44fbda9c4939f0b15bf1690ba12c |
File details
Details for the file anyblok_attachment-2.2.0-py3-none-any.whl
.
File metadata
- Download URL: anyblok_attachment-2.2.0-py3-none-any.whl
- Upload date:
- Size: 52.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a33c14dd5c14cb188f30a64405b48f1830f810b6b20a9a50f7dd19fe55fe8270 |
|
MD5 | 3efa39b8106d382ac186c867f6542b9d |
|
BLAKE2b-256 | 22d2ee410189c5bb0712cc63d31be828c003bcbe53e3f0af7e706c71e74d252d |