Skip to content

Commit

Permalink
Miscellaneous fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
subhashb committed Oct 7, 2021
1 parent e32251e commit f29f4d3
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
Release History
===============

Dev
---
0.8.0
-----

* Introduce state to Views to allow persistence
* Move `fields` module to be under main package
* Allow `List` fields to contain `Dict` objects
* Elasticsearch adapter bugfixes and model enhancements
* Make views stateful to allow persistence and retrieval
* Auto-generate Event's `message_id`
* Support pickling of Protean exceptions
* Bugfix - Fetch view objects instead of simply IDs in `cache.get_all()`
* Bugfix - Generate embedded ValueObject's data properly in `to_dict()`
* Bugfix - Derive SQLAlchemy field types correctly for embedded value object fields

0.7.0
-----
Expand Down
1 change: 0 additions & 1 deletion src/protean/adapters/repository/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ def _data_reset(self):
] == Database.ELASTICSEARCH.value and conn.indices.exists(
model_cls._index._name
):
print(f"---> Deleting {model_cls}: {model_cls._index._name}")
conn.delete_by_query(
refresh=True,
index=model_cls._index._name,
Expand Down
2 changes: 1 addition & 1 deletion src/protean/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class NoDomainException(click.UsageError):
@click.version_option()
@click.pass_context
def main(ctx):
"""CLI utilities for the Protean"""
"""CLI utilities for Protean"""
if ctx.invoked_subcommand is None:
click.echo(ctx.get_help())

Expand Down
8 changes: 3 additions & 5 deletions src/protean/core/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,9 @@ def __init__(self, *template, **kwargs): # noqa: C901

# Load Identities
id_field_obj = id_field(self)
if (
not getattr(self, id_field_obj.field_name, None)
and type(id_field_obj) is Auto
):
setattr(self, id_field_obj.field_name, generate_identity())
if type(id_field_obj) is Auto:
if not getattr(self, id_field_obj.field_name, None):
setattr(self, id_field_obj.field_name, generate_identity())
loaded_fields.append(id_field_obj.field_name)

# Load Associations
Expand Down
2 changes: 1 addition & 1 deletion src/protean/domain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def __init__(
self.register(Job)
self.register(JobRepository)

def init(self):
def init(self): # noqa: C901
""" Parse the domain folder, and attach elements dynamically to the domain.
Protean parses all files in the domain file's folder, as well as under it,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class Meta:
aggregate_cls = "Post"


class Permission(BaseValueObject):
dict_object = Dict()


class Post(BaseAggregate):
content = Text(required=True)
comments = HasMany(Comment)


class Permission(BaseValueObject):
dict_object = Dict()


class Audit(BaseAggregate):
permission = ValueObject(Permission)

Expand Down

0 comments on commit f29f4d3

Please sign in to comment.