Issue 229 in couchdb-python: Enhancement: support for defining and syncing of 'validate_doc_update', 'updates' and 'shows' entities in design document

10 views
Skip to first unread message

couchdb...@googlecode.com

unread,
Sep 2, 2013, 2:05:40 PM9/2/13
to couchdb...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 229 by oliora: Enhancement: support for defining and syncing
of 'validate_doc_update', 'updates' and 'shows' entities in design document
http://code.google.com/p/couchdb-python/issues/detail?id=229

I've added classes for defining and syncing
of 'validate_doc_update', 'updates' and 'shows' entities in design
document. Class covering 'lists' entity will be added later.
New classes called ValidateFunctionDefinition, UpdateHandlerDefinition and
ShowFunctionDefinition. Also there is a new function 'sync_definitions'
which syncs a list of definition subtypes. I leave the function
ViewDefinition.sync_many for back compatibility (although it's not marked
in documentation as deprecated because it should be discussed first),
because now it just calls 'sync_definitions'.
Tests and documentation are updated to cover changes.

Patches are attached.
All changes could be also found at https://github.com/oliora/couchdb-python
in design_refactoring branch.

Attachments:
0001-ViewDefinition.sync_many-replaced-with-sync_definiti.patch 4.6 KB
0002-DefinitionMixin-base-class-extracted-from-ViewDefini.patch 3.2 KB
0003-_DesignDocument-refactored-to-easily-support-differe.patch 6.0 KB
0004-Function-_sync_dict_field-extracted-from-ViewDefinit.patch 2.5 KB
0005-UpdateHandlerDefinition-added.patch 6.6 KB
0006-ValidateFunctionDefinition-added.patch 6.8 KB
0007-ShowFunctionDefinition-added.patch 6.9 KB
0008-Renamed-some-of-_DesignDoc-attributes-to-match-corre.patch 976 bytes
0009-Syncronization-of-dictionary-fields-slightly-refacto.patch 2.3 KB
0010-All-new-definition-types-are-added-to-import-list.patch 872 bytes
0011-Small-refactoring-badly-named-function-arguments-ren.patch 1.4 KB

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

couchdb...@googlecode.com

unread,
Sep 2, 2013, 2:25:53 PM9/2/13
to couchdb...@googlegroups.com

Comment #1 on issue 229 by kxepal: Enhancement: support for defining and
syncing of 'validate_doc_update', 'updates' and 'shows' entities in design
document
http://code.google.com/p/couchdb-python/issues/detail?id=229

I feel a bit wrong conception.

The design module is using to define View functions and has ability to sync
their definitions with CouchDB, creating or updating design documents.

In this patch you adds _DesignDocument class which does not what everyone
may except.

The design documents for CouchDB are regular documents with special
behaviour. They have _id, _rev, _attachments, _conflicts etc. fields like
any other docs. They shares client.Document API and behaviour.

Additionally, the design documents may have special fields like views,
shows, validate_doc_update, rewrites and others which has special
processing logic for CouchDB side. These fields have to be defined with
FunctionDefinition instances or be some property-proxies to them.

Each FucntionDefinition acts as standalone design function which is bounded
to some design document. Passing multiple instances to sync_many _function_
groups them and syncs with CouchDB. Having sync_many as _staticmethod_ of
DesignDocument class breaks all the conception since this method can not
use his own class to sync with database.

Take a look on issue-186 patch. There are only function definitions and
conception of fragile design documents preserved. It's very easy to wrap
them into DesignDocument class with nicer API to operate with them and sync
with CouchDB.

couchdb...@googlecode.com

unread,
Sep 2, 2013, 3:51:44 PM9/2/13
to couchdb...@googlegroups.com

Comment #2 on issue 229 by oliora: Enhancement: support for defining and
syncing of 'validate_doc_update', 'updates' and 'shows' entities in design
document
http://code.google.com/p/couchdb-python/issues/detail?id=229

kxepal, although _DesignDocument is a part of private API not public one
(so name is not so important), I agree it could cause misunderstanding. Now
I realize the better name would be something like
_DesignDocumentDefinition. I.e. a definition for the whole design document
consisting of views, updates, shows etc definitions.

I don't see a goal of working with design document thru the normal document
API. In my scenario, I need to define view, update, validate etc
definitions and then sync them in a bunch with DB. Then use some of them
thru Database class methods. That's all. Of course there could be a
different usage scenarios. Please, write your one.

couchdb...@googlecode.com

unread,
Sep 2, 2013, 4:32:00 PM9/2/13
to couchdb...@googlegroups.com

Comment #3 on issue 229 by djc.ochtman: Enhancement: support for defining
and syncing of 'validate_doc_update', 'updates' and 'shows' entities in
design document
http://code.google.com/p/couchdb-python/issues/detail?id=229

BTW, I just love how many patches you turned this into! So much easier to
review. I hope we can all converge on a good design.

couchdb...@googlecode.com

unread,
Sep 3, 2013, 11:14:18 AM9/3/13
to couchdb...@googlegroups.com

Comment #4 on issue 229 by oliora: Enhancement: support for defining and
syncing of 'validate_doc_update', 'updates' and 'shows' entities in design
document
http://code.google.com/p/couchdb-python/issues/detail?id=229

I've added a patch which renames _DesignDocument into
_DesignDocumentDefinition.

Attachments:
0012-_DesignDocument-renamed-to-_DesignDocumentDefinition.patch 2.5 KB

couchdb...@googlecode.com

unread,
Sep 19, 2013, 6:11:44 PM9/19/13
to couchdb...@googlegroups.com

Comment #5 on issue 229 by oliora: Enhancement: support for defining and
syncing of 'validate_doc_update', 'updates' and 'shows' entities in design
document
http://code.google.com/p/couchdb-python/issues/detail?id=229

Any update on that?

couchdb...@googlecode.com

unread,
Sep 20, 2013, 4:54:18 AM9/20/13
to couchdb...@googlegroups.com

Comment #6 on issue 229 by djc.ochtman: Enhancement: support for defining
and syncing of 'validate_doc_update', 'updates' and 'shows' entities in
design document
http://code.google.com/p/couchdb-python/issues/detail?id=229

Alexander, your feedback would be very welcome here.

couchdb...@googlecode.com

unread,
Nov 8, 2013, 4:32:43 PM11/8/13
to couchdb...@googlegroups.com

Comment #7 on issue 229 by oliora: Enhancement: support for defining and
syncing of 'validate_doc_update', 'updates' and 'shows' entities in design
document
http://code.google.com/p/couchdb-python/issues/detail?id=229

More than month have passed but nothing changed. Eh :(

couchdb...@googlecode.com

unread,
Nov 11, 2013, 3:52:58 AM11/11/13
to couchdb...@googlegroups.com

Comment #8 on issue 229 by kxepal: Enhancement: support for defining and
syncing of 'validate_doc_update', 'updates' and 'shows' entities in design
document
http://code.google.com/p/couchdb-python/issues/detail?id=229

> Alexander, your feedback would be very welcome here.

Going to test patches today. On first sight looks ok. Will try to backport
tests from my issue 186 patch - I have a lot of them there (:

couchdb...@googlecode.com

unread,
Jul 15, 2014, 3:52:02 AM7/15/14
to couchdb...@googlegroups.com

Comment #9 on issue 229 by djc.ochtman: Enhancement: support for defining
and syncing of 'validate_doc_update', 'updates' and 'shows' entities in
design document
http://code.google.com/p/couchdb-python/issues/detail?id=229

This issue has been migrated to GitHub. Please continue discussion here:

https://github.com/djc/couchdb-python/issues/229
Reply all
Reply to author
Forward
0 new messages