djc / couchdb-python

Python library for working with CouchDB
Other
202 stars 86 forks source link

Query Server package code review #286

Open iblislin opened 8 years ago

iblislin commented 8 years ago

Let's review it commit-by-commit!

Some highlight:

Here is the snippet about the command support.

        if (0, 9, 0) <= self.version < (0, 10, 0):
            self.commands['show_doc'] = render.show_doc
            self.commands['list_begin'] = render.list_begin
            self.commands['list_row'] = render.list_row
            self.commands['list_tail'] = render.list_tail
            self.commands['validate'] = validate.validate

        elif (0, 10, 0) <= self.version < (0, 11, 0):
            self.commands['show'] = render.show
            self.commands['list'] = render.list
            self.commands['filter'] = filters.filter
            self.commands['update'] = render.update
            self.commands['validate'] = validate.validate

        elif self.version >= (0, 11, 0):
            ddoc_commands = {}
            ddoc_commands['shows'] = render.ddoc_show
            ddoc_commands['lists'] = render.ddoc_list
            ddoc_commands['filters'] = filters.ddoc_filter
            ddoc_commands['updates'] = render.ddoc_update
            ddoc_commands['validate_doc_update'] = validate.ddoc_validate

        if self.version >= (1, 1, 0):
            self.commands['add_lib'] = state.add_lib
            ddoc_commands['views'] = filters.ddoc_views

        if self.version >= (0, 11, 0):
            self.commands['ddoc'] = ddoc.DDoc(ddoc_commands)
iblislin commented 8 years ago

Coverage report:

Name                         Stmts   Miss  Cover   Missing
----------------------------------------------------------
../../server/__init__.py       249     10    96%   70, 78-82, 217-222
../../server/compiler.py       177      4    98%   81, 151, 187, 316
../../server/ddoc.py            49      0   100%
../../server/exceptions.py       4      0   100%
../../server/filters.py         22      0   100%
../../server/helpers.py         18      3    83%   13-15
../../server/mime.py           104      2    98%   22, 65
../../server/mock.py            26      1    96%   21
../../server/render.py         234      5    98%   83, 115, 153, 158, 180
../../server/state.py           26      0   100%
../../server/stream.py          32      0   100%
../../server/validate.py        34      0   100%
../../server/views.py           55      0   100%
----------------------------------------------------------
iblislin commented 8 years ago

My bad... i miss this commit. https://github.com/kxepal/couchdb-python/commit/9145545

kxepal commented 8 years ago

@iblis17 This one could be done better today via

from setuptools import find_packages
setup(
...
packages=find_packages()
...
)

So no need to maintain that list.

iblislin commented 8 years ago

find_packages applied. cc4798e

iblislin commented 8 years ago

/me busy in following few days.... I'm sorry for swapping out review temporary.

kxepal commented 8 years ago

@iblis17 no worries, you'd done great job here!

iblislin commented 8 years ago

I'm going to attend PyCon TW this weekend.

Maybe disappear about 3 days....

kxepal commented 8 years ago

Cool! Have fun there! (:

iblislin commented 8 years ago

I have to get through my final exam :sob: I will be back about 1 week later...