Skip to content

Commit 5813b8a

Browse files
authored
Merge pull request #58 from zfi/master
Beta 1.3 - Support for Python 3
2 parents 63b9752 + 8b9c0f8 commit 5813b8a

31 files changed

+960
-132
lines changed

Failures.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) 2019 Parallax Inc. -
3+
# -
4+
# Permission is hereby granted, free of charge, to any person obtaining -
5+
# a copy of this software and associated documentation files (the -
6+
# “Software”), to deal in the Software without restriction, including -
7+
# without limitation the rights to use, copy, modify, merge, publish, -
8+
# distribute, sublicense, and/or sell copies of the Software, and to -
9+
# permit persons to whom the Software is furnished to do so, subject -
10+
# to the following conditions: -
11+
# -
12+
# The above copyright notice and this permission notice shall be -
13+
# included in all copies or substantial portions of the Software. -
14+
# -
15+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -
16+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -
17+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. -
18+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -
19+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -
20+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -
21+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -
22+
# -
23+
# -
24+
# ------------------------------------------------------------------------------
25+
126
import logging
227
'''
328
Failure messages
@@ -36,7 +61,7 @@ def unknown_user_id(id_user):
3661
'message': 'Unknown user',
3762
'code': 400,
3863
'data': id_user
39-
}, 400
64+
}, 404
4065

4166

4267
def unknown_user_email(email):
@@ -46,7 +71,7 @@ def unknown_user_email(email):
4671
'message': 'Unknown user',
4772
'code': 400,
4873
'data': email
49-
}, 400
74+
}, 404
5075

5176

5277
def unknown_user_screen_name(screen_name):
@@ -56,7 +81,7 @@ def unknown_user_screen_name(screen_name):
5681
'message': 'Unknown user screen name',
5782
'code': 400,
5883
'data': screen_name
59-
}, 400
84+
}, 404
6085

6186

6287
def email_already_in_use(email):

FakeSecHead.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

Validation.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) 2019 Parallax Inc. -
3+
# -
4+
# Permission is hereby granted, free of charge, to any person obtaining -
5+
# a copy of this software and associated documentation files (the -
6+
# “Software”), to deal in the Software without restriction, including -
7+
# without limitation the rights to use, copy, modify, merge, publish, -
8+
# distribute, sublicense, and/or sell copies of the Software, and to -
9+
# permit persons to whom the Software is furnished to do so, subject -
10+
# to the following conditions: -
11+
# -
12+
# The above copyright notice and this permission notice shall be -
13+
# included in all copies or substantial portions of the Software. -
14+
# -
15+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -
16+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -
17+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. -
18+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -
19+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -
20+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -
21+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -
22+
# -
23+
# -
24+
# ------------------------------------------------------------------------------
25+
126
from validate_email import validate_email
227

328
import logging

app/AuthToken/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) 2019 Parallax Inc. -
3+
# -
4+
# Permission is hereby granted, free of charge, to any person obtaining -
5+
# a copy of this software and associated documentation files (the -
6+
# “Software”), to deal in the Software without restriction, including -
7+
# without limitation the rights to use, copy, modify, merge, publish, -
8+
# distribute, sublicense, and/or sell copies of the Software, and to -
9+
# permit persons to whom the Software is furnished to do so, subject -
10+
# to the following conditions: -
11+
# -
12+
# The above copyright notice and this permission notice shall be -
13+
# included in all copies or substantial portions of the Software. -
14+
# -
15+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -
16+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -
17+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. -
18+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -
19+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -
20+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -
21+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -
22+
# -
23+
# -
24+
# ------------------------------------------------------------------------------

app/AuthToken/controllers.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) 2019 Parallax Inc. -
3+
# -
4+
# Permission is hereby granted, free of charge, to any person obtaining -
5+
# a copy of this software and associated documentation files (the -
6+
# “Software”), to deal in the Software without restriction, including -
7+
# without limitation the rights to use, copy, modify, merge, publish, -
8+
# distribute, sublicense, and/or sell copies of the Software, and to -
9+
# permit persons to whom the Software is furnished to do so, subject -
10+
# to the following conditions: -
11+
# -
12+
# The above copyright notice and this permission notice shall be -
13+
# included in all copies or substantial portions of the Software. -
14+
# -
15+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -
16+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -
17+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. -
18+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -
19+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -
20+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -
21+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -
22+
# -
23+
# -
24+
# ------------------------------------------------------------------------------
25+
126
# Import the database object from the main app module
227
import logging
328
import uuid
@@ -12,7 +37,7 @@
1237

1338
from Validation import Validation
1439

15-
from models import AuthenticationToken
40+
from app.AuthToken.models import AuthenticationToken
1641

1742
auth_token_app = Blueprint('authtoken', __name__, url_prefix='/authtoken')
1843
api = Api(auth_token_app)

app/AuthToken/models.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,33 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) 2019 Parallax Inc. -
3+
# -
4+
# Permission is hereby granted, free of charge, to any person obtaining -
5+
# a copy of this software and associated documentation files (the -
6+
# “Software”), to deal in the Software without restriction, including -
7+
# without limitation the rights to use, copy, modify, merge, publish, -
8+
# distribute, sublicense, and/or sell copies of the Software, and to -
9+
# permit persons to whom the Software is furnished to do so, subject -
10+
# to the following conditions: -
11+
# -
12+
# The above copyright notice and this permission notice shall be -
13+
# included in all copies or substantial portions of the Software. -
14+
# -
15+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -
16+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -
17+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. -
18+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -
19+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -
20+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -
21+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -
22+
# -
23+
# -
24+
# ------------------------------------------------------------------------------
25+
126
# Import the database object (db) from the main application module
227
# We will define this inside /app/__init__.py in the next sections.
328
from app import db
429

30+
531
class AuthenticationToken(db.Model):
632
id = db.Column(db.BigInteger, primary_key=True)
733
id_user = db.Column(db.BigInteger, db.ForeignKey('user.id'))

app/Authenticate/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) 2019 Parallax Inc. -
3+
# -
4+
# Permission is hereby granted, free of charge, to any person obtaining -
5+
# a copy of this software and associated documentation files (the -
6+
# “Software”), to deal in the Software without restriction, including -
7+
# without limitation the rights to use, copy, modify, merge, publish, -
8+
# distribute, sublicense, and/or sell copies of the Software, and to -
9+
# permit persons to whom the Software is furnished to do so, subject -
10+
# to the following conditions: -
11+
# -
12+
# The above copyright notice and this permission notice shall be -
13+
# included in all copies or substantial portions of the Software. -
14+
# -
15+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -
16+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -
17+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. -
18+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -
19+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -
20+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -
21+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -
22+
# -
23+
# -
24+
# ------------------------------------------------------------------------------

app/Authenticate/controllers.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) 2019 Parallax Inc. -
3+
# -
4+
# Permission is hereby granted, free of charge, to any person obtaining -
5+
# a copy of this software and associated documentation files (the -
6+
# “Software”), to deal in the Software without restriction, including -
7+
# without limitation the rights to use, copy, modify, merge, publish, -
8+
# distribute, sublicense, and/or sell copies of the Software, and to -
9+
# permit persons to whom the Software is furnished to do so, subject -
10+
# to the following conditions: -
11+
# -
12+
# The above copyright notice and this permission notice shall be -
13+
# included in all copies or substantial portions of the Software. -
14+
# -
15+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -
16+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -
17+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. -
18+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -
19+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -
20+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -
21+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -
22+
# -
23+
# -
24+
# ------------------------------------------------------------------------------
25+
126
# Import the database object from the main app module
227
import logging
328
import Failures

app/Email/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) 2019 Parallax Inc. -
3+
# -
4+
# Permission is hereby granted, free of charge, to any person obtaining -
5+
# a copy of this software and associated documentation files (the -
6+
# “Software”), to deal in the Software without restriction, including -
7+
# without limitation the rights to use, copy, modify, merge, publish, -
8+
# distribute, sublicense, and/or sell copies of the Software, and to -
9+
# permit persons to whom the Software is furnished to do so, subject -
10+
# to the following conditions: -
11+
# -
12+
# The above copyright notice and this permission notice shall be -
13+
# included in all copies or substantial portions of the Software. -
14+
# -
15+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -
16+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -
17+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. -
18+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -
19+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -
20+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -
21+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -
22+
# -
23+
# -
24+
# ------------------------------------------------------------------------------

app/Email/services.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# ------------------------------------------------------------------------------
2+
# Copyright (c) 2019 Parallax Inc. -
3+
# -
4+
# Permission is hereby granted, free of charge, to any person obtaining -
5+
# a copy of this software and associated documentation files (the -
6+
# “Software”), to deal in the Software without restriction, including -
7+
# without limitation the rights to use, copy, modify, merge, publish, -
8+
# distribute, sublicense, and/or sell copies of the Software, and to -
9+
# permit persons to whom the Software is furnished to do so, subject -
10+
# to the following conditions: -
11+
# -
12+
# The above copyright notice and this permission notice shall be -
13+
# included in all copies or substantial portions of the Software. -
14+
# -
15+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -
16+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -
17+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. -
18+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -
19+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -
20+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -
21+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -
22+
# -
23+
# -
24+
# ------------------------------------------------------------------------------
25+
126
from app import mail, app
227
from os.path import expanduser, isfile
328
from flask_mail import Message

0 commit comments

Comments
 (0)