summary: Upgrade to ming 0.4 to avoid extraneous count() queries --> Upgrade to ming 0.4.x to avoid extraneous count() queries
Description has changed:
Diff:
--- old+++ new@@ -1,5 +1,3 @@
Ming 0.4 removes the `__len__` method which does a count() query. This is so that list(query) and query.all() don't cause that to run any more.
We'll need to find & change all our `len(query)` and `query|length` (in templates) to `query.count()`.
--If we're not comfortable with finding these manually via test runs, searching, and exercising all parts of Allura, we could potentially add support in Ming to inspect the frame within `__len__` and if it's not a call from `list()` then raise a DeprecationWarning. (We can't simply raise DeprecationWarning all the time since list(query) automatically calls `__len__` under the covers)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Seems like all done, but there is one test failing, though:
======================================================================ERROR:forgediscussion.tests.functional.test_forum.TestForumStats.test_stats_data----------------------------------------------------------------------Traceback(mostrecentcalllast):File"/home/jetmind/.virtualenvs/allura/local/lib/python2.7/site-packages/nose/case.py",line197,inrunTestself.test(*self.arg)File"/home/jetmind/.virtualenvs/allura/local/lib/python2.7/site-packages/mock.py",line1193,inpatchedarg=patching.__enter__()File"/home/jetmind/.virtualenvs/allura/local/lib/python2.7/site-packages/mock.py",line1268,in__enter__original,local=self.get_original()File"/home/jetmind/.virtualenvs/allura/local/lib/python2.7/site-packages/mock.py",line1242,inget_original"%s does not have the attribute %r"%(target,name)AttributeError:<class'ming.session.Session'>doesnothavetheattribute'aggregate'
Seems like Session.aggregate was removed in Ming 0.4.1, but I see that it was added back in this commit. So, tests pass with Ming installed from current masters, and fail with 0.4.1 from PyPi. I don't sure how you want to handle this, maybe create a dev release on PyPi from current master or disable this test until new release on Ming.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Diff:
Created #430: [#6431] Upgrade to ming 0.4.x to avoid extraneous count() queries (4cp)
Related
Tickets:
#6431Closed #430.
je/42cc_6431
Seems like all done, but there is one test failing, though:
Seems like
Session.aggregate
was removed in Ming 0.4.1, but I see that it was added back in this commit. So, tests pass with Ming installed from current masters, and fail with 0.4.1 from PyPi. I don't sure how you want to handle this, maybe create a dev release on PyPi from current master or disable this test until new release on Ming.We'll cut a new release from Ming master, so you can run the tests against that.
Changes in Allura look good, but please also review forge-classic and sftheme and make the necessary changes there too.
Created #445: [#6431] Make forge-classic and sftheme compatible with Ming 0.4.x (2cp)
Related
Tickets:
#6431Closed #445. Reviewed forge-classic and sftheme code. No changes here, all looks compatible with ming 0.4.1.
Additional changes on allura:db/6431 and merciless:db/bool
Pushed a new commit to allura:db/6431
This is gtg, but neither allura nor ming branches have been merged. Tested with ming:db/bool (rebased to master) and allura:db/6431.