[Checkins] SVN: z3c.amf/trunk/ path changes & version bump
Jean-Fran�ois Roche
jfroche at jfroche.be
Tue Nov 25 09:25:37 EST 2008
Log message for revision 93343:
path changes & version bump
Changed:
U z3c.amf/trunk/docs/HISTORY.txt
U z3c.amf/trunk/setup.py
U z3c.amf/trunk/z3c/amf/HTTPRequest.py
U z3c.amf/trunk/z3c/amf/README.txt
U z3c.amf/trunk/z3c/amf/amfgateway.py
U z3c.amf/trunk/z3c/amf/configure.zcml
-=-
Modified: z3c.amf/trunk/docs/HISTORY.txt
===================================================================
--- z3c.amf/trunk/docs/HISTORY.txt 2008-11-25 14:22:49 UTC (rev 93342)
+++ z3c.amf/trunk/docs/HISTORY.txt 2008-11-25 14:25:37 UTC (rev 93343)
@@ -1,6 +1,13 @@
Changelog
=========
+0.2 - (2008-11-25)
+------------------
+
+* Handle path change in service
+
+* register crossdomain.xml view
+
0.1 - (2008-11-17)
------------------
Modified: z3c.amf/trunk/setup.py
===================================================================
--- z3c.amf/trunk/setup.py 2008-11-25 14:22:49 UTC (rev 93342)
+++ z3c.amf/trunk/setup.py 2008-11-25 14:25:37 UTC (rev 93343)
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os
-version = '0.1'
+version = '0.2'
setup(name='z3c.amf',
version=version,
@@ -34,8 +34,4 @@
'pyamf',
'Products.CMFCore',
'Products.PluggableAuthService'
- ],
- entry_points="""
- # -*- Entry points: -*-
- """,
- )
+ ])
Modified: z3c.amf/trunk/z3c/amf/HTTPRequest.py
===================================================================
--- z3c.amf/trunk/z3c/amf/HTTPRequest.py 2008-11-25 14:22:49 UTC (rev 93342)
+++ z3c.amf/trunk/z3c/amf/HTTPRequest.py 2008-11-25 14:25:37 UTC (rev 93343)
@@ -80,6 +80,10 @@
aparser.parse()
meth = aparser.method
self.args = aparser.args
+ if aparser.paths:
+ splitedPath = environ['PATH_INFO'].split('/')
+ splitedPath.extend(aparser.paths)
+ environ['PATH_INFO'] = "/".join(splitedPath)
response = amfgateway.AMFResponse(response)
response._amfVersion = aparser.amfVersion
response._clientType = aparser.clientType
Modified: z3c.amf/trunk/z3c/amf/README.txt
===================================================================
--- z3c.amf/trunk/z3c/amf/README.txt 2008-11-25 14:22:49 UTC (rev 93342)
+++ z3c.amf/trunk/z3c/amf/README.txt 2008-11-25 14:25:37 UTC (rev 93343)
@@ -35,6 +35,9 @@
... def echoTuple(self, value):
... return tuple(value)
...
+ ... def echoParams(self, value1, value2):
+ ... return "%s-%s" % (value1, value2)
+ ...
... def echoDate(self):
... return datetime(2008, 11, 17, 11, 11)
...
@@ -62,7 +65,7 @@
... <flash:view
... for="OFS.interfaces.IFolder"
... methods="echoString echoList echoDict echoVoid echoTuple
- ... echoDate echoXML"
+ ... echoDate echoXML echoParams"
... class="z3c.amf.README.EchoView"
... permission="zope.Public"
... />
@@ -80,12 +83,15 @@
We create some helper functions.
For Requests:
- >>> def createAMFRequest(target, body, username=None, password=None):
+ >>> def createAMFRequest(target, body, username=None, password=None, multiParameters=False):
... envelope = remoting.Envelope(pyamf.AMF0, pyamf.ClientTypes.Flash9)
... if username is not None and password is not None:
... envelope.headers['Credentials'] = dict(userid=unicode(username),
... password=unicode(password))
- ... request = remoting.Request(target, [body], envelope)
+ ... if multiParameters:
+ ... request = remoting.Request(target, body, envelope)
+ ... else:
+ ... request = remoting.Request(target, [body], envelope)
... envelope[u'/1'] = request
... amfRequest = remoting.encode(envelope)
... amfRequest.seek(0)
@@ -196,6 +202,20 @@
(u'/1', <Response status=/onResult><Element html at ...></Response>,
<type 'instance'>)
+Multi Parameters
+----------------
+
+ >>> amfRequest = createAMFRequest(target='echoParams', body=['foo', 'bar'],
+ ... multiParameters=True)
+ >>> response = http(r"""
+ ... POST /test_folder_1_ HTTP/1.0
+ ... Content-Length: 102
+ ... Content-Type: application/x-amf
+ ...
+ ... %s""" % amfRequest)
+ >>> printAMFResponse(response)
+ (u'/1', <Response status=/onResult>foo-bar</Response>, <type 'unicode'>)
+
Errors
------
@@ -244,3 +264,18 @@
... %s""" % amfRequest)
>>> printAMFResponse(response)
(u'/1', <Response status=/onResult>Hello World!</Response>, <type 'unicode'>)
+
+Path in service
+---------------
+
+ >>> amfRequest = createAMFRequest(target='test_folder_1_.echoProtectedString',
+ ... body='It works!', username=user_name,
+ ... password=user_password)
+ >>> response = http(r"""
+ ... POST / HTTP/1.0
+ ... Content-Length: 200
+ ... Content-Type: application/x-amf
+ ...
+ ... %s""" % amfRequest)
+ >>> printAMFResponse(response)
+ (u'/1', <Response status=/onResult>It works!</Response>, <type 'unicode'>)
Modified: z3c.amf/trunk/z3c/amf/amfgateway.py
===================================================================
--- z3c.amf/trunk/z3c/amf/amfgateway.py 2008-11-25 14:22:49 UTC (rev 93342)
+++ z3c.amf/trunk/z3c/amf/amfgateway.py 2008-11-25 14:25:37 UTC (rev 93343)
@@ -38,14 +38,19 @@
context = pyamf.get_context(pyamf.AMF0)
self.requests = remoting.decode(data, context)
self.auth = None
+ self.paths = None
def parse(self):
name, request = self.requests.items()[0]
if self.requests.headers:
self.auth = self.requests.headers.get(u'Credentials')
self.method = request.target
+ if '.' in self.method:
+ paths = self.method.split('.')
+ self.method = paths[-1]
+ self.paths = paths[:-1]
params = request.body
- if params[0] is None:
+ if len(params) == 0 or params[0] is None:
self.args = tuple()
else:
self.args = tuple(params)
@@ -122,7 +127,8 @@
type='Resource not found',
description=str(v))
elif not isinstance(v, pyamf.BaseError): # 500
- f = remoting.ErrorFault(code=str(t), type=str(v), description=content)
+ f = remoting.ErrorFault(code=str(t), type=str(v),
+ description=content)
self.setBody(f)
return tb
Modified: z3c.amf/trunk/z3c/amf/configure.zcml
===================================================================
--- z3c.amf/trunk/z3c/amf/configure.zcml 2008-11-25 14:22:49 UTC (rev 93342)
+++ z3c.amf/trunk/z3c/amf/configure.zcml 2008-11-25 14:25:37 UTC (rev 93343)
@@ -1,8 +1,11 @@
<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:flash="http://namespaces.zope.org/flash"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="z3c.amf">
- <permission
+ <include package=".browser"/>
+
+ <permission
id="zope2.FlashAccess"
title="Flash Access"/>
More information about the Checkins
mailing list