adding new methods to entities #143

Closed
jonaprieto opened this Issue Sep 14, 2015 · 1 comment

Projects

None yet

2 participants

@jonaprieto

Is there any way to add a method to entity after his definition in an appropriate way? Because I had tried it, but pony rise ImplementionError. I've found out, that I can add a method iff the method starts and ends with underscore like the following: Entity._newmethod_ and everything works like charm. But, I really want to call the method without the underscores. Or I am doing something wrong? Thanks.

Btw. I added the methods with a decorator, wrapped them with that.

Thanks authors.

@kozlovsky kozlovsky added this to the 0.6.2 milestone Sep 22, 2015
@kozlovsky kozlovsky self-assigned this Sep 22, 2015
@kozlovsky
Contributor

This restriction is obsolete, I'll remove it. Now it will be possible to freely assign methods to entities. This will be part of the next release PonyORM 0.6.2

@kozlovsky kozlovsky closed this in 98fe051 Sep 22, 2015
@kozlovsky kozlovsky added a commit that referenced this issue Jan 11, 2016
@kozlovsky kozlovsky Pony ORM Release 0.6.2 (2015-01-11)
The documentation was moved from this repo to a separate one at https://github.com/ponyorm/pony-doc
The compiled version can be found at https://docs.ponyorm.com

# New features

* Python 3.5 support
* #132, #145: raw_sql() function was added
* #126: Ability to use @db_session with generator functions
* #116: Add support to select by UUID
* Ability to get string SQL statement using the Query.get_sql() method
* New function delete(gen) and Query.delete(bulk=False)
* Now it is possible to override Entity.__init__() and declare custom entity methods

# Backward incompatible changes

* Normalizing table names for symmetric relationships
* Autostrip - automatically remove leading and trailing characters

# Bugfixes

* #87: Pony fails with pymysql installed as MySQLdb
* #118: Pony should reconnect if previous connection was created before process was forked
* #121: Unable to update value of unique attribute
* #122: AssertionError when changing part of a composite key
* #127: a workaround for incorrect pysqlite locking behavior
* #136: Cascade delete does not work correctly for one-to-one relationships
* #141, #143: remove restriction on adding new methods to entities
* #142: Entity.select_random() AssertionError
* #147: Add 'atom_expr' symbol handling for Python 3.5 grammar
ab09f64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment