Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
/couchdb-pythonPublic archive

Basic update handler support.#268

Closed
mefyl wants to merge6 commits intodjc:masterfrominfinit:master
Closed

Conversation

mefyl
Copy link

Same player play again, passing Travis build, with a unit test and some doc.

Implementation for some of theddoc query server call, enabling to write update handlers in python. I'm very new to CouchDB so this might be incomplete, but it works for me so far. I might keep adding support as my needs evolve.

@mefyl
Copy link
Author

Note: I'm not sure why I had to patchinfinit@acbfded , but in my setup (Python 3.4.1, CouchDB 1.6.1) the output stream of the query server is text, not binary. Could be the way CouchDB starts the subprocess ? Some subtle Python difference in the way it determines whether stdin is text ? Anyway it fixes it for me and hopefully doesn't break it for other, but some double check would be a good idea.

@kxepal
Copy link
Collaborator

That's completely incorrect implementation. SeeJavaScript query server, histests ormy fork where it's done.

@mefyl
Copy link
Author

I don't think "completely incorrect" is an even remotely appropriated comment. As I stated, it's partial and I'm building it as I go just to fill-in the missing feature. Now, if you have a working version - which I didn't know - I'd be more than glad to just see it merged here and use it.

If there is a fundamental flaw in the way I started implementing this, a few line stating why would be helpful. I certainly don't expect it to pass the test suite you mentionned since I implemented a small subset of theddoc feature.

@kxepal
Copy link
Collaborator

@mefyl it's "incorrect" because:

  1. update functions doesn't have two level function definition like views (e.g. there is no "map")
  2. they should forbid GET requests in order to not let things go wrong
  3. resp part need to wrap strings with {"body": ...} object

"Completely" is because it's incompatible with the way how javascript ones works and breaks common ddoc structure what will prevent you simply backport any JS couchapp to Python.

Sorry for not describing "why" in my reply.

@kxepal
Copy link
Collaborator

Now, if you have a working version - which I didn't know - I'd be more than glad to just see it merged here and use it.

Well, I stopped work on it long time ago because it's done, but it unlikely be merged because of commit history policy. So it's just there for history and for others who want to implement it again (:

@mefyl
Copy link
Author

Thanks for the precisions !

  1. True, my design docs erroneously had thismap indirection, so I ended up thinking that was the CouchDB format. I'll fix it right away. Thedocumentation isn't really rigorous/complete, so one has to do some reverse-engineering on the protocol :-|
  2. Sure thing, although I would count that as an improvement, not a "bug" in a first partial implementation :)
  3. Well, I partly disagree on that one: thedocumentation for ResponseObject states you can usejson instead ofbody and addheaders or several other useful fields, so I left it to the update handler to return{body: ...} or any other combination (the doc I added reflects this). It is true I could wrap plain strings with{body: ...} so you can just return strings while not preventing the other features. Opinion welcomed.

About the "incompatible with javascript" part, are we talking about the erroneousmap key ? If so, it's definitely a mistake I'm fixing.

Understand my process here is to implement the features on the go as I can't sit down one week with specs to implement this, so it will be incremental and inferior to a full implementation for some time. Your code will certainly be of help, thanks for pointing me to it.

@djc
Copy link
Owner

djc commentedAug 12, 2015

@kxepal I'm sorry about the commit policy. Can I somehow entice you to do a little work to get the whole thing merged again? I started on it myself once or twice, but it's quite a bit of work and I currently lack the motivation/time to clean things up. However, given that you already know how things ought to work, it seems like a somewhat clean history isn't that much work.

Otherwise, maybe we should contemplate just squashing the whole thing and making sure the end state makes sense. Let's iterate on it together?

@kxepal
Copy link
Collaborator

@djc No need to sorry: it's good that you have and require commits to met high, good, standards. I respect this and eventually try to follow the same rules. The main problem is that it's very boring to reorganize 50+ commits of iterative work and hard to keep all things consistent after conflicts. Today when I look on those code again, I wish I would at least clean it and fix the style: 4 years is quite a lot of time to change the views on Python coding.

I see two ways to handle it:

  • Reorganize commits to make history more or less clear and make their share right. It would be hard because there iirc there were three versions which evolved one to another: one big view.py -> server subpackage -> stateless design. In the middle new features were added while existed bugs were fixed.
  • Just squash all the stuff and move important bits from commit messages into code commentaries and doc strings. Most simple way to go and it will force to pay more attention to code review, but will produce one massive commit. However, not sure if any history will be important if the code itself will be well documented.

P.S. Sorry for my initial attitude here, it seems I wasn't in good mood to be polite.

@djc
Copy link
Owner

djc commentedAug 13, 2015

@kxepal can we just go straight to implementing the stateless design? With the policy I have in mind, the goal is not to reflect exactly the history of development. The goal is only to have commits that are understandable as a unit, that work towards the goal of the series, and ideally are easily reviewable (which implies some upper bound on size, ideally). I may not have expressed this clearly before. So what I don't like is having the extra bug-fixing commits in the history; those should be squashed into the commit that introduced the bug. Would this make it easier?

Thanks for the apology, accepted. Everyone can have a bad day!

@kxepal
Copy link
Collaborator

@djc you know....I walk over the history, read the code and found that the only way to make it work and don't feel the shame about, is to cut the latest code version into consistent commits. I have the following plan in my head now:

  • 1 commit to turn view.py into server subpackage
  • 1 commit per design function
  • 1 commit per new feature
  • 1 commit per important bug fix (those which are couchdb-* )
    Sounds good for you?

I just importedviewserver branch to GitHub to make it easy estimate all the tragedy (:

@mefyl
Copy link
Author

No offense taken either; if your implementation is being merged, I'll stand by waiting for it. As I stated, there is stillinfinit@acbfded that is require for the server to work at all in my setup, so maybe just this patch should be considered ?

(also the short sha1 is a permutation of abcdef, that should make it worth keeping)

@djc
Copy link
Owner

djc commentedAug 13, 2015

@kxepal that sounds awesome!! I'd love to get that merged.

@mefyl sorry to side-track your pull request, and sorry if your work doesn't end up being used in the project. Still, your pull request has been instrumental in landing a better view server, so I hope you're getting a good deal in the end. I bet@kxepal will look at your pull request if he has problems getting his work to pass with Python 3.

@mefyl
Copy link
Author

I have no pride in seeing MY code merged, if I too get a fully featured view server at no development cost, it's even better :)

iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMar 22, 2016
- Add `server/exceptions.py`Author:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <e196819@hotmail.com>- Rename `ViewServerException` to `QueryServerException`Reference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMar 22, 2016
Author:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <e196819@hotmail.com>- Add `input` and `ouput` into `BaseQueryServer.__init__`  parameters list.- pep8 coding style checked with  $ pep8 --max-line-length=100 --show-source --firstReference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestApr 12, 2016
In `__init__.py`,we implements Python query server with high level API.Author:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <e196819@hotmail.com>- pep8 coding style checked with  $ pep8 --max-line-length=100 --show-source --firstReference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMay 9, 2016
Start to work on callable command line interface ofquery server package.Author:     Alexander Shorin <kxepal@gmail.com>Reference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMay 9, 2016
- Add `server/exceptions.py`Author:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <e196819@hotmail.com>- Rename `ViewServerException` to `QueryServerException`Reference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMay 9, 2016
Author:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <e196819@hotmail.com>- Add `input` and `ouput` into `BaseQueryServer.__init__`  parameters list.- pep8 coding style checked with  $ pep8 --max-line-length=100 --show-source --firstReference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMay 9, 2016
In `__init__.py`,we implements Python query server with high level API.Author:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <e196819@hotmail.com>- pep8 coding style checked with  $ pep8 --max-line-length=100 --show-source --firstReference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMay 9, 2016
Start to work on callable command line interface ofquery server package.Author:     Alexander Shorin <kxepal@gmail.com>Reference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMay 9, 2016
Start to work on callable command line interface ofquery server package.Author:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <e196819@hotmail.com>- Change the entry points of query server in setup.pyReference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMay 9, 2016
Start to work on callable command line interface ofquery server package.Author:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <e196819@hotmail.com>- Change the entry points of query server in setup.pyReference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMay 15, 2016
Author:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <iblis@hs.ntnu.edu.tw>Reference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMay 15, 2016
- Test case incluededAuthor:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <iblis@hs.ntnu.edu.tw>Reference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMay 15, 2016
- Test cases includedAuthor:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <iblis@hs.ntnu.edu.tw>Reference:djc#268See Also:djc#276
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestMay 15, 2016
Author:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <iblis@hs.ntnu.edu.tw>Reference:djc#268See Also:djc#276
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 20, 2016
The `output` parameter of `stream.respond` should be writablewith unicode.Reference:djc#268See Also:djc#276
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 20, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 20, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 20, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 20, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 20, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 20, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 20, 2016
Drop the support for python25 or belowReference:djc#268See Also:djc#276
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 21, 2016
We also take care the new log format.Reference:djc#268See Also:djc#276
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 22, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 23, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 23, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 24, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 28, 2016
We take care the case of"user really want a empty dictionary as `context`".Reference:djc#268See Also:djc#276
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 28, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestMay 30, 2016
compiler.test_required_modules_has_global_namespace_accessReference:djc#268See Also:djc#276
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestJun 6, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestJun 11, 2016
- The output is key-value pair only- Also, provide comprehensive messageReference:djc#268See Also:djc#276
@djc
Copy link
Owner

djc commentedAug 5, 2016

This will be done as part of#286, closing.

@djcdjc closed thisAug 5, 2016
iblislin pushed a commit to iblislin/couchdb-python that referenced this pull requestOct 25, 2016
Author:     Alexander Shorin <kxepal@gmail.com>Patched by: Iblis Lin <iblis@hs.ntnu.edu.tw>Reference:djc#268See Also:djc#276
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestOct 25, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestOct 25, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestOct 25, 2016
iblislin added a commit to iblislin/couchdb-python that referenced this pull requestOct 26, 2016
- Remove duplicate xhtml- Introduce type aliases for `DEFAULT_TYPES`,  e.g. `('text', 'txt'): ['text/plain; charset=utf-8']`.  `txt` is an alias of `text`.Reference:djc#268See Also:djc#276
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@mefyl@kxepal@djc

[8]ページ先頭

©2009-2025 Movatter.jp