Commit 969e4b28 authored by mouadh's avatar mouadh

format

parent bb35b4f8
...@@ -3,8 +3,8 @@ from __future__ import absolute_import, division, print_function ...@@ -3,8 +3,8 @@ from __future__ import absolute_import, division, print_function
from spyne import ComplexModel, Integer, Unicode, XmlAttribute from spyne import ComplexModel, Integer, Unicode, XmlAttribute
from spyne.model.fault import Fault from spyne.model.fault import Fault
class Tuple(object):
class Tuple(object):
def __init__(self, Hierarchy, UName, Caption, LName, LNum, DisplayInfo, def __init__(self, Hierarchy, UName, Caption, LName, LNum, DisplayInfo,
PARENT_UNIQUE_NAME, HIERARCHY_UNIQUE_NAME, Value): PARENT_UNIQUE_NAME, HIERARCHY_UNIQUE_NAME, Value):
self.Hierarchy = Hierarchy self.Hierarchy = Hierarchy
...@@ -92,7 +92,9 @@ class Propertielist(ComplexModel): ...@@ -92,7 +92,9 @@ class Propertielist(ComplexModel):
class Command(ComplexModel): class Command(ComplexModel):
_type_info = {'Statement': Unicode,} _type_info = {
'Statement': Unicode,
}
class ExecuteRequest(ComplexModel): class ExecuteRequest(ComplexModel):
...@@ -105,6 +107,7 @@ class DiscoverRequest(ComplexModel): ...@@ -105,6 +107,7 @@ class DiscoverRequest(ComplexModel):
Restrictions = Restrictionlist Restrictions = Restrictionlist
Properties = Propertielist Properties = Propertielist
# class AuthenticationError(Fault): # class AuthenticationError(Fault):
# __namespace__ = 'spyne.examples.authentication' # __namespace__ = 'spyne.examples.authentication'
# faultcode='Client.AuthenticationError', # faultcode='Client.AuthenticationError',
......
...@@ -15,6 +15,7 @@ from spyne.server.wsgi import WsgiApplication ...@@ -15,6 +15,7 @@ from spyne.server.wsgi import WsgiApplication
from ..mdx.tools.config_file_parser import ConfigParser from ..mdx.tools.config_file_parser import ConfigParser
from ..services.models import DiscoverRequest, ExecuteRequest, Session\ from ..services.models import DiscoverRequest, ExecuteRequest, Session\
# , AuthenticationError # , AuthenticationError
from .xmla_discover_tools import XmlaDiscoverTools from .xmla_discover_tools import XmlaDiscoverTools
from .xmla_execute_tools import XmlaExecuteTools from .xmla_execute_tools import XmlaExecuteTools
from .xmla_execute_xsds import execute_xsd from .xmla_execute_xsds import execute_xsd
...@@ -38,15 +39,14 @@ class XmlaProviderService(ServiceBase): ...@@ -38,15 +39,14 @@ class XmlaProviderService(ServiceBase):
discover_tools = XmlaDiscoverTools() discover_tools = XmlaDiscoverTools()
SessionId = discover_tools.SessionId SessionId = discover_tools.SessionId
@rpc(
DiscoverRequest,
@rpc(DiscoverRequest, _returns=AnyXml,
_returns=AnyXml, _body_style="bare",
_body_style="bare", _out_header=Session,
_out_header=Session, _throws=InvalidCredentialsError
_throws=InvalidCredentialsError # _throws=AuthenticationError
# _throws=AuthenticationError )
)
def Discover(ctx, request): def Discover(ctx, request):
""" """
the first principle function of xmla protocol the first principle function of xmla protocol
...@@ -69,8 +69,10 @@ class XmlaProviderService(ServiceBase): ...@@ -69,8 +69,10 @@ class XmlaProviderService(ServiceBase):
# TODO call labster login or create login with token (according to labster db) # TODO call labster login or create login with token (according to labster db)
if ctx.transport.req_env['QUERY_STRING'] != 'mouadh': if ctx.transport.req_env['QUERY_STRING'] != 'mouadh':
raise InvalidCredentialsError(fault_string='You do not have permission to access this resource', raise InvalidCredentialsError(
fault_object=None) fault_string=
'You do not have permission to access this resource',
fault_object=None)
# raise AuthenticationError() # raise AuthenticationError()
...@@ -132,10 +134,11 @@ class XmlaProviderService(ServiceBase): ...@@ -132,10 +134,11 @@ class XmlaProviderService(ServiceBase):
# Execute function must take 2 argument ( JUST 2 ! ) Command and Properties # Execute function must take 2 argument ( JUST 2 ! ) Command and Properties
# we encapsulate them in ExecuteRequest object # we encapsulate them in ExecuteRequest object
@rpc(ExecuteRequest, @rpc(
_returns=AnyXml, ExecuteRequest,
_body_style="bare", _returns=AnyXml,
_out_header=Session) _body_style="bare",
_out_header=Session)
def Execute(ctx, request): def Execute(ctx, request):
""" """
the second principle function of xmla protocol the second principle function of xmla protocol
...@@ -202,7 +205,7 @@ class XmlaProviderService(ServiceBase): ...@@ -202,7 +205,7 @@ class XmlaProviderService(ServiceBase):
xmla_tools.generate_slicer_axis(df), xmla_tools.generate_slicer_axis(df),
xmla_tools.generate_cell_data(df), xmla_tools.generate_cell_data(df),
datetime.now().strftime('%Y-%m-%dT%H:%M:%S')).replace( datetime.now().strftime('%Y-%m-%dT%H:%M:%S')).replace(
'&', '&')) '&', '&'))
# Problem: # Problem:
# An XML parser returns the error “xmlParseEntityRef: noname” # An XML parser returns the error “xmlParseEntityRef: noname”
......
...@@ -34,7 +34,6 @@ class XmlaDiscoverTools(): ...@@ -34,7 +34,6 @@ class XmlaDiscoverTools():
]] ]]
self.SessionId = uuid.uuid1() self.SessionId = uuid.uuid1()
def change_catalogue(self, new_catalogue): def change_catalogue(self, new_catalogue):
""" """
if you change the catalogue(cube) in any request, we have to instantiate the MdxEngine with the new catalogue if you change the catalogue(cube) in any request, we have to instantiate the MdxEngine with the new catalogue
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment