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
47641eee
Commit
47641eee
authored
May 12, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into Develop
parents
ce0fab8d
42abe28c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
10 deletions
+8
-10
db.py
cps/db.py
+1
-1
web.py
cps/web.py
+1
-1
worker.py
cps/worker.py
+6
-8
No files found.
cps/db.py
View file @
47641eee
...
@@ -101,7 +101,7 @@ class Identifiers(Base):
...
@@ -101,7 +101,7 @@ class Identifiers(Base):
return
self
.
type
return
self
.
type
def
__repr__
(
self
):
def
__repr__
(
self
):
if
self
.
type
==
"amazon"
:
if
self
.
type
==
"amazon"
or
self
.
type
==
"asin"
:
return
u"https://amzn.com/{0}"
.
format
(
self
.
val
)
return
u"https://amzn.com/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"isbn"
:
elif
self
.
type
==
"isbn"
:
return
u"https://www.worldcat.org/isbn/{0}"
.
format
(
self
.
val
)
return
u"https://www.worldcat.org/isbn/{0}"
.
format
(
self
.
val
)
...
...
cps/web.py
View file @
47641eee
...
@@ -331,7 +331,7 @@ def import_ldap_users():
...
@@ -331,7 +331,7 @@ def import_ldap_users():
match
=
re
.
search
(
"([a-zA-Z0-9-]+)=
%
s"
,
config
.
config_ldap_user_object
,
re
.
IGNORECASE
|
re
.
UNICODE
)
match
=
re
.
search
(
"([a-zA-Z0-9-]+)=
%
s"
,
config
.
config_ldap_user_object
,
re
.
IGNORECASE
|
re
.
UNICODE
)
if
match
:
if
match
:
match_filter
=
match
.
group
(
1
)
match_filter
=
match
.
group
(
1
)
match
=
re
.
search
(
match_filter
+
"=([
[
\
d
\
w-]+)"
,
user
,
re
.
IGNORECASE
|
re
.
UNICODE
)
match
=
re
.
search
(
match_filter
+
"=([
\
d
\
s
\
w-]+)"
,
user
,
re
.
IGNORECASE
|
re
.
UNICODE
)
if
match
:
if
match
:
user
=
match
.
group
(
1
)
user
=
match
.
group
(
1
)
else
:
else
:
...
...
cps/worker.py
View file @
47641eee
...
@@ -99,7 +99,7 @@ def get_attachment(bookpath, filename):
...
@@ -99,7 +99,7 @@ def get_attachment(bookpath, filename):
data
=
file_
.
read
()
data
=
file_
.
read
()
file_
.
close
()
file_
.
close
()
except
IOError
as
e
:
except
IOError
as
e
:
log
.
exception
(
e
)
# traceback.print_exc()
log
.
exception
(
e
)
log
.
error
(
u'The requested file could not be read. Maybe wrong permissions?'
)
log
.
error
(
u'The requested file could not be read. Maybe wrong permissions?'
)
return
None
return
None
...
@@ -459,10 +459,6 @@ class WorkerThread(threading.Thread):
...
@@ -459,10 +459,6 @@ class WorkerThread(threading.Thread):
if
self
.
last
>=
20
:
if
self
.
last
>=
20
:
self
.
_delete_completed_tasks
()
self
.
_delete_completed_tasks
()
# progress=100%, runtime=0, and status finished
# progress=100%, runtime=0, and status finished
log
.
debug
(
"Last "
+
str
(
self
.
last
))
log
.
debug
(
"Current "
+
str
(
self
.
current
))
log
.
debug
(
"id"
+
str
(
self
.
id
))
self
.
id
+=
1
self
.
id
+=
1
starttime
=
datetime
.
now
()
starttime
=
datetime
.
now
()
self
.
queue
.
append
({
'starttime'
:
starttime
,
'taskType'
:
TASK_UPLOAD
})
self
.
queue
.
append
({
'starttime'
:
starttime
,
'taskType'
:
TASK_UPLOAD
})
...
@@ -534,7 +530,8 @@ class WorkerThread(threading.Thread):
...
@@ -534,7 +530,8 @@ class WorkerThread(threading.Thread):
smtplib
.
stderr
=
org_smtpstderr
smtplib
.
stderr
=
org_smtpstderr
except
(
MemoryError
)
as
e
:
except
(
MemoryError
)
as
e
:
self
.
_handleError
(
u'Error sending email: '
+
e
.
message
)
log
.
exception
(
e
)
self
.
_handleError
(
u'MemoryError sending email: '
+
str
(
e
))
return
None
return
None
except
(
smtplib
.
SMTPException
,
smtplib
.
SMTPAuthenticationError
)
as
e
:
except
(
smtplib
.
SMTPException
,
smtplib
.
SMTPAuthenticationError
)
as
e
:
if
hasattr
(
e
,
"smtp_error"
):
if
hasattr
(
e
,
"smtp_error"
):
...
@@ -542,11 +539,12 @@ class WorkerThread(threading.Thread):
...
@@ -542,11 +539,12 @@ class WorkerThread(threading.Thread):
elif
hasattr
(
e
,
"message"
):
elif
hasattr
(
e
,
"message"
):
text
=
e
.
message
text
=
e
.
message
else
:
else
:
log
.
exception
(
e
)
text
=
''
text
=
''
self
.
_handleError
(
u'Error sending email: '
+
text
)
self
.
_handleError
(
u'
Smtplib
Error sending email: '
+
text
)
return
None
return
None
except
(
socket
.
error
)
as
e
:
except
(
socket
.
error
)
as
e
:
self
.
_handleError
(
u'Error sending email: '
+
e
.
strerror
)
self
.
_handleError
(
u'
Socket
Error sending email: '
+
e
.
strerror
)
return
None
return
None
def
_handleError
(
self
,
error_message
):
def
_handleError
(
self
,
error_message
):
...
...
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