Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
ParsePy
Overview
Overview
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
OpenEdx
ParsePy
Commits
250d3694
Commit
250d3694
authored
Feb 03, 2013
by
David Robinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pep8 compliance changes
parent
2b5a26b0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
10 deletions
+19
-10
parse_rest/__init__.py
+9
-5
parse_rest/query.py
+6
-3
parse_rest/user.py
+4
-2
No files found.
parse_rest/__init__.py
View file @
250d3694
...
...
@@ -35,7 +35,8 @@ class ParseType(object):
@staticmethod
def
convert
(
parse_data
):
is_parse_type
=
isinstance
(
parse_data
,
dict
)
and
'__type'
in
parse_data
if
not
is_parse_type
:
return
parse_data
if
not
is_parse_type
:
return
parse_data
parse_type
=
parse_data
[
'__type'
]
native
=
{
...
...
@@ -211,7 +212,8 @@ class ParseResource(ParseBase):
return
cls
(
**
cls
.
GET
(
'/'
+
resource_id
))
def
__init__
(
self
,
**
kw
):
for
key
,
value
in
kw
.
items
():
setattr
(
self
,
key
,
value
)
for
key
,
value
in
kw
.
items
():
setattr
(
self
,
key
,
value
)
def
_to_native
(
self
):
# serializes all attributes that need to be persisted on Parse
...
...
@@ -228,7 +230,7 @@ class ParseResource(ParseBase):
def
_set_object_id
(
self
,
value
):
if
hasattr
(
self
,
'_object_id'
):
raise
ValueError
,
'Can not re-set object id'
raise
ValueError
(
'Can not re-set object id'
)
self
.
_object_id
=
value
def
_get_updated_datetime
(
self
):
...
...
@@ -286,7 +288,8 @@ class Object(ParseResource):
@classmethod
def
factory
(
cls
,
class_name
):
class
DerivedClass
(
cls
):
pass
class
DerivedClass
(
cls
):
pass
DerivedClass
.
__name__
=
class_name
return
DerivedClass
...
...
@@ -306,7 +309,8 @@ class Object(ParseResource):
@property
def
_absolute_url
(
self
):
if
not
self
.
objectId
:
return
None
if
not
self
.
objectId
:
return
None
return
'/'
.
join
([
self
.
__class__
.
ENDPOINT_ROOT
,
self
.
objectId
])
...
...
parse_rest/query.py
View file @
250d3694
...
...
@@ -54,7 +54,8 @@ class Queryset(object):
yield
self
.
_results
.
pop
(
0
)
def
where
(
self
,
**
kw
):
for
key
,
value
in
kw
.
items
():
self
.
eq
(
key
,
value
)
for
key
,
value
in
kw
.
items
():
self
.
eq
(
key
,
value
)
return
self
def
eq
(
self
,
name
,
value
):
...
...
@@ -102,8 +103,10 @@ class Queryset(object):
def
get
(
self
):
results
=
self
.
_fetch
()
if
len
(
results
)
==
0
:
raise
QueryResourceDoesNotExist
if
len
(
results
)
>=
2
:
raise
QueryResourceMultipleResultsReturned
if
len
(
results
)
==
0
:
raise
QueryResourceDoesNotExist
if
len
(
results
)
>=
2
:
raise
QueryResourceMultipleResultsReturned
return
results
[
0
]
def
_fetch
(
self
):
...
...
parse_rest/user.py
View file @
250d3694
...
...
@@ -56,12 +56,14 @@ class User(ParseResource):
@staticmethod
def
signup
(
username
,
password
,
**
kw
):
return
User
(
**
User
.
POST
(
''
,
username
=
username
,
password
=
password
,
**
kw
))
return
User
(
**
User
.
POST
(
''
,
username
=
username
,
password
=
password
,
**
kw
))
@staticmethod
def
login
(
username
,
password
):
login_url
=
'/'
.
join
([
API_ROOT
,
'login'
])
return
User
(
**
User
.
GET
(
login_url
,
username
=
username
,
password
=
password
))
return
User
(
**
User
.
GET
(
login_url
,
username
=
username
,
password
=
password
))
@staticmethod
def
request_password_reset
(
email
):
...
...
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