Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
d9adb4fc
Commit
d9adb4fc
authored
Jan 01, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements for limit tags
parent
1da4efec
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
276 additions
and
27 deletions
+276
-27
admin.py
cps/admin.py
+113
-2
config_sql.py
cps/config_sql.py
+15
-5
server.py
cps/server.py
+1
-1
table.js
cps/static/js/table.js
+76
-0
book_edit.html
cps/templates/book_edit.html
+0
-2
config_view_edit.html
cps/templates/config_view_edit.html
+18
-4
layout.html
cps/templates/layout.html
+1
-1
modal_restriction.html
cps/templates/modal_restriction.html
+36
-0
user_edit.html
cps/templates/user_edit.html
+9
-0
ub.py
cps/ub.py
+7
-12
No files found.
cps/admin.py
View file @
d9adb4fc
...
@@ -207,7 +207,6 @@ def edit_domain(allow):
...
@@ -207,7 +207,6 @@ def edit_domain(allow):
# value: 'superuser!' //new value
# value: 'superuser!' //new value
vals
=
request
.
form
.
to_dict
()
vals
=
request
.
form
.
to_dict
()
answer
=
ub
.
session
.
query
(
ub
.
Registration
)
.
filter
(
ub
.
Registration
.
id
==
vals
[
'pk'
])
.
first
()
answer
=
ub
.
session
.
query
(
ub
.
Registration
)
.
filter
(
ub
.
Registration
.
id
==
vals
[
'pk'
])
.
first
()
# domain_name = request.args.get('domain')
answer
.
domain
=
vals
[
'value'
]
.
replace
(
'*'
,
'
%
'
)
.
replace
(
'?'
,
'_'
)
.
lower
()
answer
.
domain
=
vals
[
'value'
]
.
replace
(
'*'
,
'
%
'
)
.
replace
(
'?'
,
'_'
)
.
lower
()
ub
.
session
.
commit
()
ub
.
session
.
commit
()
return
""
return
""
...
@@ -252,6 +251,118 @@ def list_domain(allow):
...
@@ -252,6 +251,118 @@ def list_domain(allow):
response
.
headers
[
"Content-Type"
]
=
"application/json; charset=utf-8"
response
.
headers
[
"Content-Type"
]
=
"application/json; charset=utf-8"
return
response
return
response
@
admi
.
route
(
"/ajax/editrestriction/<int:type>"
,
methods
=
[
'POST'
])
@
login_required
@
admin_required
def
edit_restriction
(
type
):
element
=
request
.
form
.
to_dict
()
if
element
[
'id'
]
.
startswith
(
'a'
):
if
type
==
0
:
# Tags as template
elementlist
=
config
.
list_restricted_tags
()
elementlist
[
id
[
1
:]]
=
element
[
'Element'
]
config
.
config_restricted_tags
=
','
.
join
(
elementlist
)
if
type
==
1
:
# CustomC
pass
if
type
==
2
:
# Tags per user
pass
if
element
[
'type'
]
.
startswith
(
'd'
):
if
type
==
0
:
# Tags as template
elementlist
=
config
.
list_allowed_tags
()
elementlist
[
id
[
1
:]]
=
element
[
'Element'
]
config
.
config_restricted_tags
=
','
.
join
(
elementlist
)
if
type
==
1
:
# CustomC
pass
if
type
==
2
:
# Tags per user
pass
config
.
save
()
return
""
@
admi
.
route
(
"/ajax/addrestriction/<int:type>"
,
methods
=
[
'POST'
])
@
login_required
@
admin_required
def
add_restriction
(
type
):
log
.
info
(
"Hit: "
+
str
(
type
))
element
=
request
.
form
.
to_dict
()
if
type
==
0
:
# Tags as template
if
'submit_allow'
in
element
:
elementlist
=
config
.
list_allowed_tags
()
if
elementlist
==
[
''
]:
elementlist
=
[]
if
not
element
[
'add_element'
]
in
elementlist
:
elementlist
+=
[
element
[
'add_element'
]]
config
.
config_allowed_tags
=
','
.
join
(
elementlist
)
elif
'submit_deny'
in
element
:
elementlist
=
config
.
list_restricted_tags
()
if
elementlist
==
[
''
]:
elementlist
=
[]
if
not
element
[
'add_element'
]
in
elementlist
:
elementlist
+=
[
element
[
'add_element'
]]
config
.
config_restricted_tags
=
','
.
join
(
elementlist
)
config
.
save
()
if
type
==
1
:
# CustomC
pass
if
type
==
2
:
# Tags per user
pass
return
""
@
admi
.
route
(
"/ajax/deleterestriction/<int:type>"
,
methods
=
[
'POST'
])
@
login_required
@
admin_required
def
delete_restriction
(
type
):
element
=
request
.
form
.
to_dict
()
if
int
(
element
[
'type'
])
==
1
:
if
type
==
0
:
# Tags as template
if
element
[
'id'
]
.
startswith
(
'a'
):
elementlist
=
config
.
list_allowed_tags
()
if
element
[
'Element'
]
in
elementlist
:
elementlist
.
remove
(
element
[
'Element'
])
config
.
config_allowed_tags
=
','
.
join
(
elementlist
)
elif
element
[
'id'
]
.
startswith
(
'd'
):
elementlist
=
config
.
list_restricted_tags
()
if
element
[
'Element'
]
in
elementlist
:
elementlist
.
remove
(
element
[
'Element'
])
config
.
config_restricted_tags
=
','
.
join
(
elementlist
)
config
.
save
()
if
type
==
1
:
# CustomC
pass
if
type
==
2
:
# Tags per user
pass
if
int
(
element
[
'type'
])
==
2
:
if
type
==
0
:
# Tags as template
elementlist
=
config
.
list_allowed_tags
()
if
not
element
[
'Element'
]
in
elementlist
:
elementlist
+=
element
[
'Element'
]
config
.
config_restricted_tags
=
','
.
join
(
elementlist
)
if
type
==
1
:
# CustomC
pass
if
type
==
2
:
# Tags per user
pass
return
""
@
admi
.
route
(
"/ajax/listrestriction/<int:type>"
)
@
login_required
@
admin_required
def
list_restriction
(
type
):
if
type
==
0
:
# Tags as template
#for x, i in enumerate(config.list_restricted_tags()):
# if x != '':
# {'Element': x, 'type': '1', 'id': 'a' + str(i)}
restrict
=
[{
'Element'
:
x
,
'type'
:
'1'
,
'id'
:
'd'
+
str
(
i
)
}
for
i
,
x
in
enumerate
(
config
.
list_restricted_tags
())
if
x
!=
''
]
allow
=
[{
'Element'
:
x
,
'type'
:
'1'
,
'id'
:
'a'
+
str
(
i
)
}
for
i
,
x
in
enumerate
(
config
.
list_allowed_tags
())
if
x
!=
''
]
json_dumps
=
restrict
+
allow
elif
type
==
1
:
# CustomC
json_dumps
=
""
elif
type
==
2
:
# Tags per user
json_dumps
=
""
else
:
json_dumps
=
""
js
=
json
.
dumps
(
json_dumps
)
response
=
make_response
(
js
.
replace
(
"'"
,
'"'
))
response
.
headers
[
"Content-Type"
]
=
"application/json; charset=utf-8"
return
response
@
admi
.
route
(
"/config"
,
methods
=
[
"GET"
,
"POST"
])
@
admi
.
route
(
"/config"
,
methods
=
[
"GET"
,
"POST"
])
@
unconfigured
@
unconfigured
...
@@ -306,7 +417,7 @@ def _configuration_update_helper():
...
@@ -306,7 +417,7 @@ def _configuration_update_helper():
reboot_required
|=
_config_string
(
"config_certfile"
)
reboot_required
|=
_config_string
(
"config_certfile"
)
if
config
.
config_certfile
and
not
os
.
path
.
isfile
(
config
.
config_certfile
):
if
config
.
config_certfile
and
not
os
.
path
.
isfile
(
config
.
config_certfile
):
return
_configuration_result
(
'Certfile location is not valid, please enter correct path'
,
gdriveError
)
return
_configuration_result
(
'Certfile location is not valid, please enter correct path'
,
gdriveError
)
_config_string
(
"config_server_url"
)
_config_string
(
"config_server_url"
)
_config_checkbox_int
(
"config_uploading"
)
_config_checkbox_int
(
"config_uploading"
)
...
...
cps/config_sql.py
View file @
d9adb4fc
...
@@ -74,6 +74,7 @@ class _Settings(_Base):
...
@@ -74,6 +74,7 @@ class _Settings(_Base):
config_default_show
=
Column
(
SmallInteger
,
default
=
6143
)
config_default_show
=
Column
(
SmallInteger
,
default
=
6143
)
config_columns_to_ignore
=
Column
(
String
)
config_columns_to_ignore
=
Column
(
String
)
config_restricted_tags
=
Column
(
String
)
config_restricted_tags
=
Column
(
String
)
config_allowed_tags
=
Column
(
String
)
config_restricted_column
=
Column
(
SmallInteger
,
default
=
0
)
config_restricted_column
=
Column
(
SmallInteger
,
default
=
0
)
config_restricted_column_value
=
Column
(
String
)
config_restricted_column_value
=
Column
(
String
)
config_allowed_column_value
=
Column
(
String
)
config_allowed_column_value
=
Column
(
String
)
...
@@ -180,12 +181,21 @@ class _ConfigSQL(object):
...
@@ -180,12 +181,21 @@ class _ConfigSQL(object):
def
show_detail_random
(
self
):
def
show_detail_random
(
self
):
return
self
.
show_element_new_user
(
constants
.
DETAIL_RANDOM
)
return
self
.
show_element_new_user
(
constants
.
DETAIL_RANDOM
)
'''def show_mature_content(self):
def
list_restricted_tags
(
self
):
return self.show_element_new_user(constants.MATURE_CONTENT)'''
mct
=
self
.
config_restricted_tags
.
split
(
","
)
return
[
t
.
strip
()
for
t
in
mct
]
'''def mature_content_tags(self):
def
list_allowed_tags
(
self
):
mct = self.config_mature_content_tags.split(",")
mct
=
self
.
config_allowed_tags
.
split
(
","
)
return [t.strip() for t in mct]'''
return
[
t
.
strip
()
for
t
in
mct
]
def
list_restricted_column_values
(
self
):
mct
=
self
.
config_restricted_column_values
()
.
split
(
","
)
return
[
t
.
strip
()
for
t
in
mct
]
def
list_allowed_column_values
(
self
):
mct
=
self
.
config_allowed_column_values
()
.
split
(
","
)
return
[
t
.
strip
()
for
t
in
mct
]
def
get_log_level
(
self
):
def
get_log_level
(
self
):
return
logger
.
get_level_name
(
self
.
config_log_level
)
return
logger
.
get_level_name
(
self
.
config_log_level
)
...
...
cps/server.py
View file @
d9adb4fc
...
@@ -24,7 +24,7 @@ import signal
...
@@ -24,7 +24,7 @@ import signal
import
socket
import
socket
try
:
try
:
from
gevent.py
s
wsgi
import
WSGIServer
from
gevent.pywsgi
import
WSGIServer
from
gevent.pool
import
Pool
from
gevent.pool
import
Pool
from
gevent
import
__version__
as
_version
from
gevent
import
__version__
as
_version
VERSION
=
'Gevent '
+
_version
VERSION
=
'Gevent '
+
_version
...
...
cps/static/js/table.js
View file @
d9adb4fc
...
@@ -93,6 +93,73 @@ $(function() {
...
@@ -93,6 +93,73 @@ $(function() {
var
domainId
=
$
(
e
.
relatedTarget
).
data
(
"domain-id"
);
var
domainId
=
$
(
e
.
relatedTarget
).
data
(
"domain-id"
);
$
(
e
.
currentTarget
).
find
(
"#btndeletedomain"
).
data
(
"domainId"
,
domainId
);
$
(
e
.
currentTarget
).
find
(
"#btndeletedomain"
).
data
(
"domainId"
,
domainId
);
});
});
$
(
'#restrictModal'
).
on
(
'hidden.bs.modal'
,
function
()
{
$
(
'#restrict-elements-table'
).
bootstrapTable
(
'destroy'
);
});
// $('#table').bootstrapTable('destroy');
function
startTable
(
type
){
$
(
"#restrict-elements-table"
).
bootstrapTable
({
formatNoMatches
:
function
()
{
return
""
;
},
url
:
window
.
location
.
pathname
+
"/../../ajax/listrestriction/"
+
type
,
onClickCell
:
function
(
field
,
value
,
row
,
$element
)
{
// ...
if
(
field
==
3
){
$
.
ajax
({
type
:
'Post'
,
data
:
'id='
+
row
.
id
+
'&type='
+
row
.
type
+
"&Element="
+
row
.
Element
,
url
:
window
.
location
.
pathname
+
"/../../ajax/deleterestriction/"
+
type
,
async
:
true
,
timeout
:
900
,
success
:
function
(
data
)
{
$
.
ajax
({
method
:
"get"
,
url
:
window
.
location
.
pathname
+
"/../../ajax/listrestriction/"
+
type
,
async
:
true
,
timeout
:
900
,
success
:
function
(
data
)
{
$
(
"#restrict-elements-table"
).
bootstrapTable
(
"load"
,
data
);
}
});
}
});
}
},
striped
:
false
});
$
(
"[id^=submit_]"
).
click
(
function
(
event
)
{
event
.
preventDefault
();
console
.
log
(
$
(
this
)[
0
].
name
)
$
.
ajax
({
url
:
window
.
location
.
pathname
+
"/../../ajax/addrestriction/"
+
type
,
type
:
'Post'
,
data
:
$
(
this
).
closest
(
"form"
).
serialize
()
+
"&"
+
$
(
this
)[
0
].
name
+
"="
,
success
:
function
()
{
$
.
ajax
({
method
:
"get"
,
url
:
window
.
location
.
pathname
+
"/../../ajax/listrestriction/"
+
type
,
async
:
true
,
timeout
:
900
,
success
:
function
(
data
)
{
$
(
"#restrict-elements-table"
).
bootstrapTable
(
"load"
,
data
);
}
});
}
});
return
;
});
}
$
(
'#get_column_values'
).
on
(
'click'
,
function
()
{
startTable
(
1
);
});
$
(
'#get_tags'
).
on
(
'click'
,
function
()
{
startTable
(
0
);
});
});
});
/* Function for deleting domain restrictions */
/* Function for deleting domain restrictions */
...
@@ -104,3 +171,12 @@ function TableActions (value, row, index) {
...
@@ -104,3 +171,12 @@ function TableActions (value, row, index) {
"</a>"
"</a>"
].
join
(
""
);
].
join
(
""
);
}
}
/* Function for deleting domain restrictions */
function
RestrictionActions
(
value
,
row
,
index
)
{
return
[
"<div class=
\"
danger remove
\"
data-restriction-id=
\"
"
+
row
.
id
+
"
\"
title=
\"
Remove
\"
>"
,
"<i class=
\"
glyphicon glyphicon-trash
\"
></i>"
,
"</div>"
].
join
(
""
);
}
cps/templates/book_edit.html
View file @
d9adb4fc
{% extends "layout.html" %}
{% extends "layout.html" %}
{% block body %}
{% block body %}
{% if book %}
{% if book %}
<div
class=
"col-sm-3 col-lg-3 col-xs-12"
>
<div
class=
"col-sm-3 col-lg-3 col-xs-12"
>
<div
class=
"cover"
>
<div
class=
"cover"
>
<img
src=
"{{ url_for('web.get_cover', book_id=book.id) }}"
alt=
"{{ book.title }}"
/>
<img
src=
"{{ url_for('web.get_cover', book_id=book.id) }}"
alt=
"{{ book.title }}"
/>
...
...
cps/templates/config_view_edit.html
View file @
d9adb4fc
{% extends "layout.html" %}
{% extends "layout.html" %}
{% block header %}
<link
href=
"{{ url_for('static', filename='css/libs/bootstrap-table.min.css') }}"
rel=
"stylesheet"
>
<link
href=
"{{ url_for('static', filename='css/libs/bootstrap-editable.css') }}"
rel=
"stylesheet"
>
{% endblock %}
{% block body %}
{% block body %}
<div
class=
"discover"
>
<div
class=
"discover"
>
<h2>
{{title}}
</h2>
<h2>
{{title}}
</h2>
...
@@ -111,14 +115,17 @@
...
@@ -111,14 +115,17 @@
<input
type=
"checkbox"
name=
"edit_shelf_role"
id=
"edit_shelf_role"
{%
if
conf
.
role_edit_shelfs
()
%}
checked
{%
endif
%}
>
<input
type=
"checkbox"
name=
"edit_shelf_role"
id=
"edit_shelf_role"
{%
if
conf
.
role_edit_shelfs
()
%}
checked
{%
endif
%}
>
<label
for=
"edit_shelf_role"
>
{{_('Allow Editing Public Shelfs')}}
</label>
<label
for=
"edit_shelf_role"
>
{{_('Allow Editing Public Shelfs')}}
</label>
</div>
</div>
<div
class=
"form-group"
>
<
!--
div class="form-group">
<label for="config_restricted_tags">{{_('Restrict Tags')}}</label>
<label for="config_restricted_tags">{{_('Restrict Tags')}}</label>
<input type="text" class="form-control" name="config_restricted_tags" id="config_restricted_tags" value="{{ conf.config_restricted_tags if conf.config_restricted_tags != None }}" autocomplete="off">
<input type="text" class="form-control" name="config_restricted_tags" id="config_restricted_tags" value="{{ conf.config_restricted_tags if conf.config_restricted_tags != None }}" autocomplete="off">
</div>
</div-->
<div
class=
"form-group"
>
<a
href=
"#"
id=
"get_tags"
class=
"btn btn-default"
data-toggle=
"modal"
data-target=
"#restrictModal"
>
{{_('Add allowed/denied Tags')}}
</a>
<a
href=
"#"
id=
"get_column_values"
class=
"btn btn-default"
data-toggle=
"modal"
data-target=
"#restrictModal"
>
{{_('Add allowed/denied custom column values')}}
</a>
<!--div class="form-group">
<label for="config_restricted_column_value">{{_('Restricted Column Content')}}</label>
<label for="config_restricted_column_value">{{_('Restricted Column Content')}}</label>
<input type="text" class="form-control" name="config_restricted_column_value" id="config_restricted_column_value" value="{{ conf.config_restricted_column_value if conf.config_restricted_column_value != None }}" autocomplete="off">
<input type="text" class="form-control" name="config_restricted_column_value" id="config_restricted_column_value" value="{{ conf.config_restricted_column_value if conf.config_restricted_column_value != None }}" autocomplete="off">
</div>
</div
--
>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -155,6 +162,9 @@
...
@@ -155,6 +162,9 @@
</form>
</form>
</div>
</div>
{% endblock %}
{% endblock %}
{% block modal %}
{{ restrict_modal() }}
{% endblock %}
{% block js %}
{% block js %}
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
$
(
'.collapse'
).
on
(
'shown.bs.collapse'
,
function
(){
$
(
'.collapse'
).
on
(
'shown.bs.collapse'
,
function
(){
...
@@ -163,4 +173,8 @@
...
@@ -163,4 +173,8 @@
$
(
this
).
parent
().
find
(
".glyphicon-minus"
).
removeClass
(
"glyphicon-minus"
).
addClass
(
"glyphicon-plus"
);
$
(
this
).
parent
().
find
(
".glyphicon-minus"
).
removeClass
(
"glyphicon-minus"
).
addClass
(
"glyphicon-plus"
);
});
});
</script>
</script>
<script
src=
"{{ url_for('static', filename='js/libs/bootstrap-table/bootstrap-table.min.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/libs/bootstrap-table/bootstrap-table-editable.min.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/libs/bootstrap-table/bootstrap-editable.min.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/table.js') }}"
></script>
{% endblock %}
{% endblock %}
cps/templates/layout.html
View file @
d9adb4fc
{% from 'modal_restriction.html' import restrict_modal %}
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"{{ g.user.locale }}"
>
<html
lang=
"{{ g.user.locale }}"
>
<head>
<head>
...
@@ -229,7 +230,6 @@
...
@@ -229,7 +230,6 @@
});
});
});
});
</script>
</script>
{% block js %}{% endblock %}
{% block js %}{% endblock %}
</body>
</body>
</html>
</html>
cps/templates/modal_restriction.html
0 → 100644
View file @
d9adb4fc
{% macro restrict_modal() %}
<div
class=
"modal fade"
id=
"restrictModal"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"restrictModalLabel"
>
<div
class=
"modal-dialog modal-lg"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h4
class=
"modal-title"
id=
"metaModalLabel"
>
{{_('Select allowed/restricted Tags')}}
</h4>
</div>
<div
class=
"modal-body"
>
<table
class=
"table table-no-bordered"
id=
"restrict-elements-table"
data-id-field=
"id"
data-show-header=
"false"
data-editable-mode=
"inline"
>
<thead>
<tr>
<th
data-field=
"Element"
id=
"Element"
data-editable-type=
"text"
data-editable-url=
"{{ url_for('admin.edit_restriction', type = 0)}}"
data-editable=
"true"
data-editable-title=
"{{_('Enter Tag')}}"
></th>
<th
data-field=
"type"
id=
"type"
data-visible=
"false"
></th>
<th
data-field=
"id"
id=
"id"
data-visible=
"false"
></th>
<th
data-align=
"right"
data-formatter=
"RestrictionActions"
></th>
</tr>
</thead>
</table>
<form
id=
"add_restriction"
action=
""
method=
"POST"
>
<div
class=
"form-group required"
>
<label
for=
"add_element"
>
{{_('Add Tag')}}
</label>
<input
type=
"text"
class=
"form-control"
name=
"add_element"
id=
"add_element"
>
</div>
<div
class=
"form-group required"
>
<input
type=
"button"
class=
"btn btn-default"
value=
"{{_('Allow')}}"
name=
"submit_allow"
id=
"submit_allow"
data-dismiss=
"static"
>
<input
type=
"button"
class=
"btn btn-default"
value=
"{{_('Deny')}}"
name=
"submit_deny"
id=
"submit_restrict"
data-dismiss=
"static"
>
</div>
</form>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-default"
data-dismiss=
"modal"
>
{{_('Close')}}
</button>
</div>
</div>
</div>
</div>
{% endmacro %}
cps/templates/user_edit.html
View file @
d9adb4fc
...
@@ -155,3 +155,12 @@
...
@@ -155,3 +155,12 @@
{% endif %}
{% endif %}
</div>
</div>
{% endblock %}
{% endblock %}
{% block modal %}
{{ restrict_modal() }}
{% endblock %}
{% block js %}
<script
src=
"{{ url_for('static', filename='js/libs/bootstrap-table/bootstrap-table.min.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/libs/bootstrap-table/bootstrap-table-editable.min.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/libs/bootstrap-table/bootstrap-editable.min.js') }}"
></script>
<script
src=
"{{ url_for('static', filename='js/table.js') }}"
></script>
{% endblock %}
cps/ub.py
View file @
d9adb4fc
...
@@ -158,25 +158,20 @@ class UserBase:
...
@@ -158,25 +158,20 @@ class UserBase:
return
self
.
check_visibility
(
constants
.
DETAIL_RANDOM
)
return
self
.
check_visibility
(
constants
.
DETAIL_RANDOM
)
def
list_restricted_tags
(
self
):
def
list_restricted_tags
(
self
):
# return [line in (line.strip("," ) for line in self.restricted_tags.split(",") if not line.startswith('~'))]
# return [line in (line.strip(",") for line in self.restricted_tags.split(",") if not line.startswith('~'))]
#return [p.strip(",") for p in self.restricted_tags.split(",") if not(p.startswith(starter))]
'''for line in self.restricted_tags.split(","):
if not line.startswith('~'):
continue'''
mct
=
self
.
restricted_tags
.
split
(
","
)
mct
=
self
.
restricted_tags
.
split
(
","
)
return
[
t
.
strip
()
for
t
in
mct
]
return
[
t
.
strip
()
for
t
in
mct
]
def
list_allowed_tags
(
self
):
def
list_allowed_tags
(
self
):
# return [line in (line.strip("," ) for line in self.restricted_tags.split(",") if not line.startswith('~'))]
# return [line in (line.strip(",") for line in self.restricted_tags.split(",") if not line.startswith('~'))]
#return [p.strip(",") for p in self.restricted_tags.split(",") if not(p.startswith(starter))]
'''for line in self.restricted_tags.split(","):
if not line.startswith('~'):
continue'''
mct
=
self
.
allowed_tags
.
split
(
","
)
mct
=
self
.
allowed_tags
.
split
(
","
)
return
[
t
.
strip
()
for
t
in
mct
]
return
[
t
.
strip
()
for
t
in
mct
]
def
list_restricted_column_values
(
self
):
mct
=
self
.
restricted_column_values
()
.
split
(
","
)
return
[
t
.
strip
()
for
t
in
mct
]
def
list_allowed_column_values
(
self
):
mct
=
self
.
allowed_column_values
()
.
split
(
","
)
return
[
t
.
strip
()
for
t
in
mct
]
def
__repr__
(
self
):
def
__repr__
(
self
):
return
'<User
%
r>'
%
self
.
nickname
return
'<User
%
r>'
%
self
.
nickname
...
...
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