Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
e2dc41f2
Commit
e2dc41f2
authored
Jan 18, 2011
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
fixed level where json ld is applied
parent
27c19e13
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
helios/datatypes/__init__.py
+8
-6
8 additions, 6 deletions
helios/datatypes/__init__.py
helios/models.py
+0
-5
0 additions, 5 deletions
helios/models.py
helios/views.py
+1
-1
1 addition, 1 deletion
helios/views.py
with
9 additions
and
12 deletions
helios/datatypes/__init__.py
+
8
−
6
View file @
e2dc41f2
...
...
@@ -80,8 +80,8 @@ class LDObjectContainer(object):
return
self
.
_ld_object
def
toJSONDict
(
self
):
return
self
.
ld_object
.
toJSONDict
()
def
toJSONDict
(
self
,
complete
=
False
):
return
self
.
ld_object
.
toJSONDict
(
complete
=
complete
)
def
toJSON
(
self
):
return
self
.
ld_object
.
serialize
()
...
...
@@ -177,12 +177,10 @@ class LDObject(object):
self
.
_setattr_wrapped
(
f
,
new_val
)
def
serialize
(
self
):
d
=
self
.
toDict
()
if
self
.
USE_JSON_LD
:
d
[
'
#
'
]
=
{
'
_
'
:
'
http://heliosvoting.org/ns#
'
}
d
=
self
.
toDict
(
complete
=
True
)
return
utils
.
to_json
(
d
)
def
toDict
(
self
,
alternate_fields
=
None
):
def
toDict
(
self
,
alternate_fields
=
None
,
complete
=
False
):
val
=
{}
for
f
in
(
alternate_fields
or
self
.
FIELDS
):
# is it a structured subfield?
...
...
@@ -190,6 +188,10 @@ class LDObject(object):
val
[
f
]
=
recursiveToDict
(
self
.
structured_fields
[
f
])
else
:
val
[
f
]
=
self
.
process_value_out
(
f
,
self
.
_getattr_wrapped
(
f
))
if
complete
and
self
.
USE_JSON_LD
:
val
[
'
#
'
]
=
{
'
_
'
:
'
http://heliosvoting.org/ns#
'
}
return
val
toJSONDict
=
toDict
...
...
...
...
This diff is collapsed.
Click to expand it.
helios/models.py
+
0
−
5
View file @
e2dc41f2
...
...
@@ -26,11 +26,6 @@ from helios.datatypes.djangofield import LDObjectField
import
csv
,
copy
# global counters
GLOBAL_COUNTER_VOTERS
=
'
global_counter_voters
'
GLOBAL_COUNTER_CAST_VOTES
=
'
global_counter_cast_votes
'
GLOBAL_COUNTER_ELECTIONS
=
'
global_counter_elections
'
class
HeliosModel
(
models
.
Model
,
datatypes
.
LDObjectContainer
):
class
Meta
:
abstract
=
True
...
...
...
...
This diff is collapsed.
Click to expand it.
helios/views.py
+
1
−
1
View file @
e2dc41f2
...
...
@@ -214,7 +214,7 @@ def one_election_schedule(request, election):
def
one_election
(
request
,
election
):
if
not
election
:
raise
Http404
return
datatypes
.
LDObject
.
instantiate
(
election
,
datatype
=
'
legacy/Election
'
)
return
election
.
toJSONDict
(
complete
=
True
)
@election_view
()
def
election_badge
(
request
,
election
):
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment