|
@@ -1,6 +1,7 @@
|
1
|
1
|
# -*- coding: utf-8 -*-
|
2
|
2
|
"""Main Controller"""
|
3
|
3
|
|
|
4
|
+import tg
|
4
|
5
|
from tg import expose, flash, require, url, lurl, request, redirect, tmpl_context
|
5
|
6
|
from tg.i18n import ugettext as _, lazy_ugettext as l_
|
6
|
7
|
from tg import predicates
|
|
@@ -123,14 +124,19 @@ class RootController(BaseController):
|
123
|
124
|
|
124
|
125
|
# FIXME - D.A - 2013-11-07 - Currently, the code build a new item if no item found for current user
|
125
|
126
|
# the correct behavior should be to redirect to setup page
|
|
127
|
+ if loCurrentNode is not None and "%s"%loCurrentNode.node_id!=node:
|
|
128
|
+ redirect(tg.url('/document/%i'%loCurrentNode.node_id))
|
|
129
|
+
|
126
|
130
|
if loCurrentNode is None:
|
127
|
131
|
loCurrentNode = loApiController.getNode(0) # try to get an item
|
128
|
132
|
if loCurrentNode is not None:
|
129
|
133
|
flash(_('Document not found. Randomly showing item #%i')%(loCurrentNode.node_id), 'warning')
|
|
134
|
+ redirect(tg.url('/document/%i'%loCurrentNode.node_id))
|
130
|
135
|
else:
|
131
|
136
|
flash(_('Your first document has been automatically created'), 'info')
|
132
|
137
|
loCurrentNode = loApiController.createDummyNode()
|
133
|
138
|
pm.DBSession.flush()
|
|
139
|
+ redirect(tg.url('/document/%i'%loCurrentNode.node_id))
|
134
|
140
|
|
135
|
141
|
return dict(root_node_list=loRootNodeList, current_node=loCurrentNode, node_status_list = loNodeStatusList)
|
136
|
142
|
|