Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
99fc8d33
Commit
99fc8d33
authored
Mar 25, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch de publico
parent
bca19837
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
25 deletions
+23
-25
middleware.py
catalog/middleware.py
+4
-16
base_top.html
catalog/templates/base_top.html
+2
-0
views.py
catalog/views.py
+1
-0
views.py
reports/views.py
+16
-9
No files found.
catalog/middleware.py
View file @
99fc8d33
from
django.shortcuts
import
HttpResponseRedirect
from
django.urls
import
reverse
# from django.core.urlresolvers import reverse
from
catalog.models
import
Publics
...
...
@@ -15,24 +14,13 @@ class AuthRequiredMiddleware(object):
# the view (and later middleware) are called.
response
=
self
.
get_response
(
request
)
# if request.path_info == reverse('ws-news-list2'):
# return response
#publics = Publics.objects.all()
#print (publics)
if
request
.
path_info
==
reverse
(
'ipn'
):
if
"/reports/"
in
request
.
path_info
and
"/scl_data"
in
request
.
path_info
:
print
(
request
.
path_info
)
elif
request
.
path_info
==
reverse
(
'ipn'
):
print
(
request
.
path_info
)
elif
not
request
.
user
.
is_authenticated
and
request
.
path_info
!=
reverse
(
'login'
)
and
not
request
.
user
.
is_active
:
elif
not
request
.
user
.
is_authenticated
and
request
.
path_info
!=
reverse
(
'login'
)
and
not
request
.
user
.
is_active
:
return
HttpResponseRedirect
(
reverse
(
'login'
))
#if not request.user.is_authenticated and request.path_info != reverse('login') and not request.user.is_active:
#if not request.user.is_authenticated or not request.user.is_active:
# return HttpResponseRedirect(reverse('login'))
# Code to be executed for each request/response after
# the view is called.
...
...
catalog/templates/base_top.html
View file @
99fc8d33
...
...
@@ -44,6 +44,7 @@
<a
href=
"#"
class=
"sidebar-toggle"
data-toggle=
"push-menu"
role=
"button"
>
<span
class=
"sr-only"
>
Toggle navigation
</span>
</a>
{% if request.user.is_authenticated %}
<div
class=
"navbar-custom-menu"
>
<ul
class=
"nav navbar-nav"
>
<li>
...
...
@@ -82,6 +83,7 @@
</li>
</ul>
</div>
{% endif %}
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
...
...
catalog/views.py
View file @
99fc8d33
...
...
@@ -588,6 +588,7 @@ def IPN(request):
print
()
f
=
open
(
PATH_USERS
+
"myfile.txt"
,
"w"
)
x
=
request
.
POST
.
dict
()
f
.
write
(
'variables'
)
for
key
,
value
in
x
.
items
():
f
.
write
(
key
+
": "
+
value
+
'
\n
'
)
return
redirect
(
'../../'
)
...
...
reports/views.py
View file @
99fc8d33
...
...
@@ -29,11 +29,18 @@ USERS_PATH = config['PATHS']['PATH_USERS']
###########################################################
def
report_L2ASCL
(
request
,
report
,
purchase_id
):
path
=
USERS_PATH
+
request
.
user
.
email
+
'/'
+
purchase_id
+
'/'
scl_data_path
=
USERS_PATH
+
request
.
user
.
email
+
"/"
+
purchase_id
+
"/"
+
report
+
".json"
if
not
request
.
user
.
is_authenticated
:
email
=
"user@algo.com"
print
(
email
)
else
:
email
=
request
.
user
.
email
path
=
USERS_PATH
+
email
+
'/'
+
purchase_id
+
'/'
scl_data_path
=
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/"
+
report
+
".json"
with
open
(
USERS_PATH
+
request
.
user
.
email
+
"/"
+
purchase_id
+
"/findProducts.json"
)
as
p
:
with
open
(
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/findProducts.json"
)
as
p
:
dataProduct
=
json
.
load
(
p
)
startDate
=
str
(
dataProduct
[
'startDate'
])[:
4
]
+
'-'
+
str
(
dataProduct
[
'startDate'
])[
4
:
6
]
+
'-'
+
str
(
dataProduct
[
'startDate'
])[
6
:
8
]
...
...
@@ -65,19 +72,19 @@ def report_L2ASCL(request, report, purchase_id):
reporteDir
=
report
.
replace
(
'_sclData'
,
''
)
reporteDir
+=
"/mask"
absolute_path
=
USERS_PATH
+
request
.
user
.
email
+
"/"
+
purchase_id
+
"/out"
absolute_path
=
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/out"
folders
=
os
.
listdir
(
absolute_path
)
json_route
=
USERS_PATH
+
request
.
user
.
email
+
"/"
+
purchase_id
+
"/"
json_route
=
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/"
for
file
in
os
.
listdir
(
json_route
):
if
file
.
endswith
(
"_sclData.json"
)
and
not
file
.
endswith
(
"merge_out_sclData.json"
):
with
open
(
USERS_PATH
+
request
.
user
.
email
+
"/"
+
purchase_id
+
"/"
+
file
)
as
f
:
with
open
(
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/"
+
file
)
as
f
:
json_data
=
OrderedDict
(
json
.
load
(
f
))
if
len
(
json_data
)
==
0
:
if
file
[:
6
]
in
folders
:
folders
.
remove
(
file
[:
6
])
with
open
(
USERS_PATH
+
request
.
user
.
email
+
"/"
+
purchase_id
+
"/"
+
report
+
".json"
)
as
f
:
with
open
(
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/"
+
report
+
".json"
)
as
f
:
json_data
=
OrderedDict
(
json
.
load
(
f
))
if
len
(
json_data
)
==
0
:
graphData
=
""
...
...
@@ -85,8 +92,8 @@ def report_L2ASCL(request, report, purchase_id):
defaultDataset
=
""
folders
.
remove
(
reporteDir
)
image_path
=
request
.
user
.
email
+
"/"
+
purchase_id
+
"/"
+
"out/"
+
reporteDir
+
"/TCI/thumbnails/"
SCL_path
=
request
.
user
.
email
+
"/"
+
purchase_id
+
"/"
+
"out/"
+
reporteDir
+
"/SCL/"
image_path
=
email
+
"/"
+
purchase_id
+
"/"
+
"out/"
+
reporteDir
+
"/TCI/thumbnails/"
SCL_path
=
email
+
"/"
+
purchase_id
+
"/"
+
"out/"
+
reporteDir
+
"/SCL/"
...
...
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