Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #83 from mardiros/fix/xmlrpc3
Browse files Browse the repository at this point in the history
Replace pyramid_xmlrpc by pyramid_rpc to handle xmlrpc
  • Loading branch information
mardiros authored Jun 29, 2017
2 parents 71ea2b2 + dff1f0c commit 7f8da31
Show file tree
Hide file tree
Showing 9 changed files with 247 additions and 261 deletions.
7 changes: 1 addition & 6 deletions development.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pyramid.includes =
pyramid_filterwarnings
pyramid_tm
pyramid_jinja2
pyramid_rpc.xmlrpc
pyshop
# pyramid_debugtoolbar
# this plugin is not configurable
Expand All @@ -30,12 +31,6 @@ sqlalchemy.echo = 0

tm.commit_veto = pyramid_tm.default_commit_veto

# waiting for https://github.com/Pylons/pyramid_xmlrpc/pull/2
pyshop.enable_xmlrpc = 0
xmlrpc.encoding = utf-8
xmlrpc.allow_none = True
xmlrpc.datetime = True

# pyshop options

# AuthTktAuthenticationPolicy
Expand Down
7 changes: 1 addition & 6 deletions development.mysql.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pyramid.includes =
pyramid_filterwarnings
pyramid_tm
pyramid_jinja2
pyramid_rpc.xmlrpc
pyshop
# pyramid_debugtoolbar
# this plugin is not configurable
Expand All @@ -30,12 +31,6 @@ sqlalchemy.echo = 0

tm.commit_veto = pyramid_tm.default_commit_veto

# waiting for https://github.com/Pylons/pyramid_xmlrpc/pull/2
pyshop.enable_xmlrpc = 0
xmlrpc.encoding = utf-8
xmlrpc.allow_none = True
xmlrpc.datetime = True

# pyshop options

# AuthTktAuthenticationPolicy
Expand Down
8 changes: 1 addition & 7 deletions development.pg.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pyramid.includes =
pyramid_filterwarnings
pyramid_tm
pyramid_jinja2
pyramid_xmlrpc
pyramid_rpc.xmlrpc
pyshop

filterwarnings.action = ignore
Expand All @@ -27,12 +27,6 @@ sqlalchemy.echo = 0

tm.commit_veto = pyramid_tm.default_commit_veto

# waiting for https://github.com/Pylons/pyramid_xmlrpc/pull/2
pyshop.enable_xmlrpc = 1
xmlrpc.encoding = utf-8
xmlrpc.allow_none = True
xmlrpc.datetime = True

# pyshop options

# AuthTktAuthenticationPolicy
Expand Down
10 changes: 1 addition & 9 deletions pyshop.sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ pyramid.includes =
pyramid_filterwarnings
pyramid_tm
pyramid_jinja2
pyramid_rpc.xmlrpc
pyshop
# pyramid_debugtoolbar
# this plugin is not configurable
# waiting for a pull request on gihub
# pyramid_xmlrpc

filterwarnings.action = ignore

Expand All @@ -26,11 +23,6 @@ sqlalchemy.echo = 0

tm.commit_veto = pyramid_tm.default_commit_veto

# waiting for https://github.com/Pylons/pyramid_xmlrpc/pull/2
xmlrpc.encoding = utf-8
xmlrpc.allow_none = True
xmlrpc.datetime = True

# pyshop options

# AuthTktAuthenticationPolicy
Expand Down
11 changes: 5 additions & 6 deletions pyshop/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
PyShop Pyramid configuration helpers.
"""

from pyramid.settings import asbool
from pyramid.interfaces import IBeforeRender
from pyramid.security import has_permission
from pyramid.url import static_path, route_path
from pyramid.httpexceptions import HTTPNotFound
# from pyramid.renderers import JSONP

from pyramid_jinja2 import renderer_factory
from pyramid_rpc.xmlrpc import XMLRPCRenderer

from pyshop.helpers import pypi
from pyshop.helpers.restxt import parse_rest
Expand Down Expand Up @@ -128,8 +125,10 @@ def includeme(config):

# Web Services

if asbool(settings.get('pyshop.enable_xmlrpc', 'true')):
config.add_view('pyshop.views.xmlrpc.PyPI', name='pypi')
config.add_renderer('pyshopxmlrpc', XMLRPCRenderer(allow_none=True))
config.add_xmlrpc_endpoint(
'api', '/pypi/xmlrpc', default_renderer='pyshopxmlrpc')
config.scan('pyshop.views.xmlrpc')

# Backoffice Views

Expand Down
10 changes: 6 additions & 4 deletions pyshop/tests/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def setUp(self):
def tearDown(self):
transaction.commit()


class DummyRoute(object):
name = 'index'

Expand All @@ -45,6 +46,7 @@ def setUp(self):
self.maxDiff = None
authz_policy = ACLAuthorizationPolicy()
self.config = testing.setUp(settings=settings)
self.config.include('pyramid_rpc.xmlrpc')
self.config.include(includeme)
self.session = DBSession()
transaction.begin()
Expand All @@ -56,8 +58,8 @@ def tearDown(self):
testing.tearDown()

def create_request(self, params=None, environ=None, matchdict=None,
headers=None,
path='/', cookies=None, post=None, **kw):
headers=None,
path='/', cookies=None, post=None, **kw):
if params and not isinstance(params, MultiDict):
mparams = MultiDict()
for k, v in params.items():
Expand All @@ -66,8 +68,8 @@ def create_request(self, params=None, environ=None, matchdict=None,
else:
mparams.add(k, v)
params = mparams
rv = DummyRequest(params, environ, headers, path, cookies,
post, matchdict=(matchdict or {}), **kw)
rv = DummyRequest(params, environ, headers, path, cookies,
post, matchdict=(matchdict or {}), **kw)
return rv

def assertIsRedirect(self, view):
Expand Down
1 change: 0 additions & 1 deletion pyshop/tests/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
'sqlalchemy.url': 'sqlite://',
'sqlalchemy.echo': False,
'sqlalchemy.pool_size': 1,
'pyshop.enable_xmlrpc': False,
'pyshop.upload.sanitize': False,
'pyshop.mirror.sanitize': False,
'pyshop.pypi.url': 'http://localhost:65432',
Expand Down
Loading

0 comments on commit 7f8da31

Please sign in to comment.