[Grok-dev] megrok.rdb

Paul Sephton prsephton at gmail.com
Thu Mar 9 08:45:15 CET 2017


Hi;

I have been using *megrok.rdb* for a while, but found previously that
although it worked well it only worked while pinned to versions < 0.7.0 of
SQLAlchemy.

I finally got irritated enough to go find what the problem was.  It turns
out its something really stupid and innocuous.

sqlalchemy.orm.collections.collection implements a decorator called
*on_link(fn)*.  Megrok.rdb traps *on_link()* to force an *ILocation*
interface compliance for linked tables.  In sqlalchemy 0.7.0, the name of
this method was changed from *on_link()* to just *link()*.

I just wish devs would recognise the far reaching consequences of changing
public API's that are already in use!

Anyway, having done a quick search through github, it seems that megrok.rdb
is not amongst the projects held there, so there's no easy way for me to do
a pull request.  The package owner in the pypi repository is listed as faassen,
kteague.   Faassen, I know, has moved on to the bigger and better world of
*morepath*.

I would like to submit a patch to megrok.rdb to enable compatibility with
more recent versions of SQLAlchemy, and simultaneously drop support for
versions of SQLAlchemy < 0.7.0.  The patch is simply:

 components.py components_new.py
--- components.py    2017-03-09 09:39:30.670965306 +0200
+++ components_new.py    2017-03-09 09:38:22.010966138 +0200
@@ -59,8 +59,8 @@
             keyfunc = default_keyfunc
         MappedCollection.__init__(self, keyfunc=keyfunc)

-    @collection.on_link
-    def on_link(self, adapter):
+    @collection.link
+    def link(self, adapter):
         if adapter is not None:
             self.__parent__ = adapter.owner_state.obj()
             self.__name__ = unicode(adapter.attr.key)

I have no idea who is really maintaining this module, if anyone, but could
whoever it is please take a look.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/grok-dev/attachments/20170309/3f6dce1b/attachment.html>


More information about the Grok-dev mailing list