mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Changed Conditional Expressions
This commit is contained in:
parent
913bfd8e0c
commit
1436989b6b
@ -142,4 +142,9 @@ def safe_relpath(path, start=None):
|
||||
return path
|
||||
|
||||
def find_catalog(docname, compaction):
|
||||
return docname.split(SEP, 1)[0] if compaction else docname
|
||||
if compaction:
|
||||
ret = docname.split(SEP, 1)[0]
|
||||
else:
|
||||
ret = docname
|
||||
|
||||
return ret
|
||||
|
@ -77,7 +77,10 @@ class Node(Base):
|
||||
comments = []
|
||||
list_stack = [comments]
|
||||
for r in results:
|
||||
comment, vote = r if username else (r, 0)
|
||||
if username:
|
||||
comment, vote = r
|
||||
else:
|
||||
comment, vote = (r, 0)
|
||||
|
||||
inheritance_chain = comment.path.split('.')[1:]
|
||||
|
||||
@ -176,7 +179,10 @@ class Comment(Base):
|
||||
|
||||
path = self.path.split('.')
|
||||
node = path[0]
|
||||
parent = path[-2] if len(path) > 2 else None
|
||||
if len(path) > 2:
|
||||
parent = path[-2]
|
||||
else:
|
||||
parent = None
|
||||
|
||||
return {'text': self.text,
|
||||
'username': self.username or 'Anonymous',
|
||||
@ -201,8 +207,16 @@ class Comment(Base):
|
||||
minutes = seconds / 60
|
||||
|
||||
if days == 0:
|
||||
dt = (minutes, 'minute') if hours == 0 else (hours, 'hour')
|
||||
if hours == 0:
|
||||
dt = (minutes, 'minute')
|
||||
else:
|
||||
dt = (hours, 'hour')
|
||||
else:
|
||||
dt = (days, 'day')
|
||||
|
||||
return '%s %s ago' % dt if dt[0] == 1 else '%s %ss ago' % dt
|
||||
if dt[0] == 1:
|
||||
ret = '%s %s ago' % dt
|
||||
else:
|
||||
ret = '%s %ss ago' % dt
|
||||
|
||||
return ret
|
||||
|
Loading…
Reference in New Issue
Block a user