Commit 969e4b28 authored by mouadh's avatar mouadh

format

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