From adc04bdf36391bad2e58e9434c38056be8bbd669 Mon Sep 17 00:00:00 2001 From: Ismael Date: Mon, 29 Oct 2018 22:23:48 -0400 Subject: [PATCH] Port vangheem's commit - Be able to override factory for types --- CHANGELOG.rst | 8 ++++++++ VERSION | 2 +- guillotina/api/content.py | 4 ++-- guillotina/configure/__init__.py | 8 +++++--- requirements.txt | 2 +- setup.py | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 64d0c22ae..52c12f90b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,11 @@ +3.2.17-1 +------------------- +- Be able to override factory for types + [vangheem] + - Require pycryptodome instead of pycrypto + [vangheem] + + 3.2.16-1 ------------------- diff --git a/VERSION b/VERSION index d90e61ee9..5797fba03 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.16-1 +3.2.17-1 diff --git a/guillotina/api/content.py b/guillotina/api/content.py index 14e7e3c7c..ee8a01512 100644 --- a/guillotina/api/content.py +++ b/guillotina/api/content.py @@ -172,8 +172,8 @@ async def __call__(self): # Create object try: obj = await create_content_in_container( - self.context, type_, new_id, id=new_id, creators=(user,), - contributors=(user,)) + self.context, type_, new_id, + creators=(user,), contributors=(user,)) except ValueError as e: return ErrorResponse( 'CreatingObject', diff --git a/guillotina/configure/__init__.py b/guillotina/configure/__init__.py index 18c462132..02be706bb 100644 --- a/guillotina/configure/__init__.py +++ b/guillotina/configure/__init__.py @@ -140,9 +140,11 @@ def load_contenttype(_context, contenttype): if 'schema' in conf: classImplements(klass, conf['schema']) - from guillotina.content import ResourceFactory + Factory = resolve_dotted_name( + conf.get('factory', 'guillotina.content.ResourceFactory') + ) - factory = ResourceFactory( + factory = Factory( klass, title='', description='', @@ -616,4 +618,4 @@ def scan(path): def clear(): - _registered_configurations[:] = [] + _registered_configurations[:] = [] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index bbbb404c6..c09d392b7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ chardet==3.0.4 jsonschema==2.6.0 multidict==3.2.0 pycparser==2.18 -pycrypto==2.6.1 +pycryptodome==3.6.6 PyJWT==1.6.0 python-dateutil==2.6.1 PyYAML==3.12 diff --git a/setup.py b/setup.py index 44c2cb001..a92e9d6ae 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ 'aiohttp>=2.3.6,<2.4.0', 'jsonschema', 'python-dateutil', - 'pycrypto', + 'pycryptodome', 'setuptools', 'ujson', 'zope.interface',