Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
olapy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
olapy
Commits
bd5982d3
Commit
bd5982d3
authored
May 02, 2017
by
mouadh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove consecutive if-statements
parent
ae0b8fb0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
16 deletions
+12
-16
olapy/core/services/xmla.py
olapy/core/services/xmla.py
+4
-8
olapy/core/services/xmla_discover_tools.py
olapy/core/services/xmla_discover_tools.py
+4
-4
olapy/core/services/xmla_execute_tools.py
olapy/core/services/xmla_execute_tools.py
+4
-4
No files found.
olapy/core/services/xmla.py
View file @
bd5982d3
...
@@ -61,16 +61,12 @@ class XmlaProviderService(ServiceBase):
...
@@ -61,16 +61,12 @@ class XmlaProviderService(ServiceBase):
ctx
.
out_header
=
Session
(
SessionId
=
str
(
XmlaProviderService
.
sessio_id
))
ctx
.
out_header
=
Session
(
SessionId
=
str
(
XmlaProviderService
.
sessio_id
))
config_parser
=
ConfigParser
(
discover_tools
.
executer
.
cube_path
)
config_parser
=
ConfigParser
(
discover_tools
.
executer
.
cube_path
)
if
config_parser
.
xmla_authentication
():
if
config_parser
.
xmla_authentication
()
and
ctx
.
transport
.
req_env
[
'QUERY_STRING'
]
!=
'admin'
:
raise
InvalidCredentialsError
(
fault_string
=
'You do not have permission to access this resource'
,
fault_object
=
None
)
# TODO call (labster) login function or create login with token (according to labster db)
# TODO call (labster) login function or create login with token (according to labster db)
if
ctx
.
transport
.
req_env
[
'QUERY_STRING'
]
!=
'admin'
:
raise
InvalidCredentialsError
(
fault_string
=
'You do not have permission to access this resource'
,
fault_object
=
None
)
# raise AuthenticationError()
if
request
.
RequestType
==
"DISCOVER_DATASOURCES"
:
if
request
.
RequestType
==
"DISCOVER_DATASOURCES"
:
return
discover_tools
.
discover_datasources_response
()
return
discover_tools
.
discover_datasources_response
()
...
...
olapy/core/services/xmla_discover_tools.py
View file @
bd5982d3
...
@@ -165,8 +165,8 @@ class XmlaDiscoverTools():
...
@@ -165,8 +165,8 @@ class XmlaDiscoverTools():
"""
)
"""
)
def
discover_schema_rowsets_response
(
self
,
request
):
def
discover_schema_rowsets_response
(
self
,
request
):
if
request
.
Restrictions
.
RestrictionList
.
SchemaName
==
"MDSCHEMA_HIERARCHIES"
:
if
request
.
Restrictions
.
RestrictionList
.
SchemaName
==
"MDSCHEMA_HIERARCHIES"
and
\
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
return
etree
.
fromstring
(
"""
return
etree
.
fromstring
(
"""
<return>
<return>
...
@@ -218,8 +218,8 @@ class XmlaDiscoverTools():
...
@@ -218,8 +218,8 @@ class XmlaDiscoverTools():
</root>
</root>
</return>
</return>
"""
)
"""
)
if
request
.
Restrictions
.
RestrictionList
.
SchemaName
==
'MDSCHEMA_MEASURES'
:
if
request
.
Restrictions
.
RestrictionList
.
SchemaName
==
'MDSCHEMA_MEASURES'
and
\
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
return
etree
.
fromstring
(
"""
return
etree
.
fromstring
(
"""
<return>
<return>
...
...
olapy/core/services/xmla_execute_tools.py
View file @
bd5982d3
...
@@ -302,10 +302,10 @@ class XmlaExecuteTools():
...
@@ -302,10 +302,10 @@ class XmlaExecuteTools():
"""
"""
columns_loop
=
[]
columns_loop
=
[]
if
(
len
(
mdx_execution_result
[
'columns_desc'
][
'columns'
].
keys
())
==
0
if
(
)
^
(
len
(
mdx_execution_result
[
'columns_desc'
][
'rows'
].
keys
())
==
0
):
(
len
(
mdx_execution_result
[
'columns_desc'
][
'columns'
].
keys
())
==
0
if
self
.
executer
.
facts
in
mdx_execution_result
[
'columns_desc'
][
)
^
(
len
(
mdx_execution_result
[
'columns_desc'
][
'rows'
].
keys
())
==
0
)
'all'
].
keys
():
)
and
self
.
executer
.
facts
in
mdx_execution_result
[
'columns_desc'
][
'all'
].
keys
():
# iterate DataFrame horizontally
# iterate DataFrame horizontally
columns_loop
=
itertools
.
chain
(
*
[
columns_loop
=
itertools
.
chain
(
*
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment