Skip to content
This repository has been archived by the owner on Feb 20, 2018. It is now read-only.

Commit

Permalink
Merge pull request #122 from 2gis/id-instead-of-empty-names
Browse files Browse the repository at this point in the history
id instead of empty names of sessions
  • Loading branch information
z00sts committed Oct 5, 2015
2 parents df886b2 + 522f1ec commit bc7bfe8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,12 @@ def set_user(self, username):
def __init__(self, name=None, dc=None):
if name:
self.name = name
else:
self.name = str(self.id)

if dc:
self.dc = json.dumps(dc)
self.platform = dc["platform"]
if dc.get("name", None):
if dc.get("name", None) and not self.name:
self.name = dc["name"]
else:
self.name = str(self.id)

if dc.get("user", None):
self.set_user(dc["user"])
Expand All @@ -132,6 +128,10 @@ def __init__(self, name=None, dc=None):

self.add()

if not self.name:
self.name = "Unnamed session " + str(self.id)
self.save()

def add_session_step(self, control_line, body=None, milestone=True):
return SessionLogStep(control_line=control_line,
body=body,
Expand Down

0 comments on commit bc7bfe8

Please sign in to comment.