Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Projects
B.I.T.S. 4.0
B.I.T.S. Server
Commits
1021869d
Commit
1021869d
authored
Feb 24, 2019
by
JackV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Python3 corrections
parent
d7a9922d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
9 deletions
+11
-9
bitsd.py
bitsd.py
+1
-1
bitsd/listener/handlers.py
bitsd/listener/handlers.py
+2
-2
bitsd/persistence/engine.py
bitsd/persistence/engine.py
+2
-0
bitsd/server/handlers.py
bitsd/server/handlers.py
+1
-0
bootstrap.py
bootstrap.py
+2
-2
setup.py
setup.py
+2
-3
usermanage.py
usermanage.py
+1
-1
No files found.
bitsd.py
View file @
1021869d
#! /usr/bin/env python
2
#! /usr/bin/env python
3
from
bitsd.main
import
main
...
...
bitsd/listener/handlers.py
View file @
1021869d
...
...
@@ -26,7 +26,7 @@ def send(string):
LOG
.
error
(
"No Fonera connected! Not sending %r"
,
string
)
return
try
:
RemoteListener
.
STREAM
.
write
(
string
)
RemoteListener
.
STREAM
.
write
(
string
.
encode
(
'utf-8'
)
)
except
StreamClosedError
as
error
:
LOG
.
error
(
'Could not push message to Fonera! %s'
,
error
)
...
...
@@ -107,7 +107,7 @@ class RemoteListener(tornado.tcpserver.TCPServer):
# Meanwhile, go on with commands...
RemoteListener
.
STREAM
.
read_until
(
b
'
\n
'
,
self
.
handle_command
)
command
=
command
.
strip
(
'
\n
'
)
command
=
command
.
strip
(
b
'
\n
'
)
if
command
:
args
=
command
.
split
(
b
' '
)
...
...
bitsd/persistence/engine.py
View file @
1021869d
...
...
@@ -93,6 +93,8 @@ def query_by_attribute(session, model, attribute, value, first=True):
"""Query all instances of `model` having `attribute == value`.
If first is True, only first result will be returned (useful
if attribute is a primary/candidate key)."""
if
isinstance
(
value
,
bytes
):
value
=
value
.
decode
(
'utf-8'
)
query
=
session
.
query
(
model
).
filter_by
(
**
{
attribute
:
value
})
result
=
query
.
first
()
if
first
else
query
return
result
...
...
bitsd/server/handlers.py
View file @
1021869d
...
...
@@ -338,6 +338,7 @@ class MessagePageHandler(BaseHandler):
with
session_scope
()
as
session
:
user
=
query
.
get_user
(
session
,
username
)
print
(
user
)
message
=
query
.
log_message
(
session
,
user
,
text
)
LOG
.
info
(
"Broadcasting to clients"
)
broadcast
(
message
.
jsondict
())
...
...
bootstrap.py
View file @
1021869d
#! /usr/bin/env python
2
#! /usr/bin/env python
3
#
# Copyright (C) 2013 Stefano Sanfilippo
# Copyright (C) 2013 BITS development team
...
...
@@ -29,6 +29,6 @@ if __name__ == '__main__':
start
()
with
open
(
'INFO.md'
,
'r'
)
as
info
:
infopage
=
Page
(
'Info'
,
info
.
read
()
.
decode
(
'utf-8'
)
)
infopage
=
Page
(
'Info'
,
info
.
read
())
with
session_scope
()
as
session
:
persist
(
session
,
infopage
)
setup.py
View file @
1021869d
#! /usr/bin/env python
2
#! /usr/bin/env python
3
#
# Copyright (C) 2013 Stefano Sanfilippo
# Copyright (C) 2013 BITS development team
...
...
@@ -23,8 +23,7 @@ setup(
'markdown'
,
'futures'
,
'pycares'
,
'passlib'
,
'recaptcha'
'passlib'
],
packages
=
[
'bitsd'
,
...
...
usermanage.py
View file @
1021869d
#! /usr/bin/env python
2
#! /usr/bin/env python
3
#
# Copyright (C) 2013 Stefano Sanfilippo
# Copyright (C) 2013 BITS development team
...
...
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