Просмотр исходного кода

improve user experience in case of unknown document id

damien 11 лет назад
Родитель
Сommit
7cb8de0df4
1 измененных файлов: 4 добавлений и 2 удалений
  1. 4 2
      pboard/pboard/controllers/root.py

+ 4 - 2
pboard/pboard/controllers/root.py Просмотреть файл

104
         loCurrentNode    = None
104
         loCurrentNode    = None
105
         loNodeStatusList = None
105
         loNodeStatusList = None
106
         try:
106
         try:
107
-          loCurrentNode    = loApiController.getNode(liNodeId)
108
           loNodeStatusList = pbmd.PBNodeStatus.getList()
107
           loNodeStatusList = pbmd.PBNodeStatus.getList()
108
+          loCurrentNode    = loApiController.getNode(liNodeId)
109
         except Exception, e:
109
         except Exception, e:
110
           flash(_('Document not found'), 'error')
110
           flash(_('Document not found'), 'error')
111
         
111
         
113
         # the correct behavior should be to redirect to setup page
113
         # the correct behavior should be to redirect to setup page
114
         if loCurrentNode is None:
114
         if loCurrentNode is None:
115
           loCurrentNode = loApiController.getNode(0) # try to get an item
115
           loCurrentNode = loApiController.getNode(0) # try to get an item
116
-          if loCurrentNode is None:
116
+          if loCurrentNode is not None:
117
+            flash(_('Document not found. Randomly showing item #%i')%(loCurrentNode.node_id), 'warning')
118
+          else:
117
             flash(_('Your first document has been automatically created'), 'info')
119
             flash(_('Your first document has been automatically created'), 'info')
118
             loCurrentNode = loApiController.createDummyNode()
120
             loCurrentNode = loApiController.createDummyNode()
119
             pm.DBSession.flush()
121
             pm.DBSession.flush()