-
Notifications
You must be signed in to change notification settings - Fork 83
Merge query server from kxepal/viewserver #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- branch `viewserver` - without any modification
checked with $ pep8 --max-line-length=100 --show-source --first couchdb/server
…5545 - branch `viewserver` - without any modification
checked with $ pep8 --max-line-length=100 --show-source --first couchdb/server
Also, new file: tests/server/__main__ for standlone testing
In py3, the `base64.b64decode` will raise `binascii.Error`. In py2, it will be `TypeError`
related test case: server.mime.ProvidesTestCase.test_run_first_registered_for_unknown_mimetype
The origin test code compare ouput string directly, but the order of python dict is random. e.g. server.output == '{"foo": "bar", "baz": "qaz"}' If there are multiple keys, the comparison will fail randomly. If there is only one key in result, i do not change the code.
The original `apply_context` will change `func.__globals__` which refers to module globals(). Consider following senario: - User has a script contains two functions: `mylist` and `myshow`. - Also, the `mylist` can invoke `get_row`. - There do not exist `get_row` in the scope of `myshow`, if user try to invoke it, the exception should raise. Let's see what will original code do:: def mylist(): pass def myshow(): get_row() # this should fail render.run_list(..., mylist, ...) render.run_show(..., myshow, ...) # but then no exception raised Because the first `run_list` will change `mylist.__globals__`, and actually the `mylist.__globals__` and `myshow.__globals__` refer to some object. This pollutes the `__globals__`.
Also, fix the test cases in couchdb/tests/view.py
- We can run query server via `couchpy` or `python -m couchdb.server`
Awesome! Thank you! As for security: forget about it. There is no safe sandboxing for Python, unless PyPy, but it's not proven to be secure AFAIK. |
Hi @kxepal Not sure this package is python3 ready or not, and it seems unmaintained. |
Hi @iblis17 |
:-o I will check out PyPy sandbox project. |
from pkgutil import iter_modules | ||
except ImportError: | ||
try: | ||
# Python 2.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that was a time...I think this could be removed with light heart (:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed in a0962ac
Hi @djc! I will create a new branch to work on and let this branch un-rebased. Everyone can test/file bugs with this branch first. @kxepal when I need your help, may I discuss here? or do we have irc channel? |
@iblis17 Feel free here anytime. Here we have a code as context, so it would be easy to talk about it. |
Author: Alexander Shorin <[email protected]> Patched by: Iblis Lin <[email protected]> Reference: djc#268 See Also: djc#276
Author: Alexander Shorin <[email protected]> Patched by: Iblis Lin <[email protected]> Reference: djc#268 See Also: djc#276
Author: Alexander Shorin <[email protected]> Patched by: Iblis Lin <[email protected]> Reference: djc#268 See Also: djc#276
- Test case inclueded Author: Alexander Shorin <[email protected]> Patched by: Iblis Lin <[email protected]> Reference: djc#268 See Also: djc#276
- Test cases included Author: Alexander Shorin <[email protected]> Patched by: Iblis Lin <[email protected]> Reference: djc#268 See Also: djc#276
Author: Alexander Shorin <[email protected]> Patched by: Iblis Lin <[email protected]> Reference: djc#268 See Also: djc#276
Author: Alexander Shorin <[email protected]> Patched by: Iblis Lin <[email protected]> Reference: djc#268 See Also: djc#276
Hi!
I read #268 and i really want the python query server!
This PR import the code from kxepal/couchdb-python@9145545.
And i modified the code in order to support python3.
The test cases from @kxepal is included.
To be honest, i do not test it with my couch yet. i just want to send this PR as soon as possible.
And i do not review whole the code base, i just make the testing pass.
So please test and review it carefully. 😄
I listed some idea needed everyone's feedback or potential problem here:
import socket, os