• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revision4d0ad863410986c46e2f31a804848ea40a42722a (tree)
Zeit2012-07-10 17:30:50
AutorIgor Bondarenko <jetmind2@gmai...>
CommiterIgor Bondarenko

Log Message

[#4449] ticket:104 Fix invalid data handling.

Ändern Zusammenfassung

Diff

--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -126,7 +126,7 @@ class SiteAdminController(object):
126126 user_id=user._id,
127127 app_config_id=appconf._id,
128128 project_id=project._id)
129- return
129+ return True
130130
131131 classes = set()
132132 for depth, cls in dfs(M.Artifact, build_model_inheritance_graph()):
@@ -139,21 +139,28 @@ class SiteAdminController(object):
139139 app_config_id=appconf._id,
140140 project_id=project._id,
141141 artifact=artifact)
142- return
142+ return True
143+ return False
143144
144145 @expose('jinja:allura:templates/site_admin_add_subscribers.html')
145146 def add_subscribers(self, **data):
146147 if request.method == 'POST':
147148 url = data['artifact_url']
148149 user = M.User.by_username(data['for_user'])
149- if user is None:
150+ if not user or user == M.User.anonymous():
150151 flash('Invalid login', 'error')
151152 return data
153+
152154 try:
153- self.subscribe_artifact(url, user)
155+ ok = self.subscribe_artifact(url, user)
154156 except:
155157 log.warn("Can't subscribe to artifact", exc_info=True)
158+ ok = False
159+
160+ if ok:
161+ flash('User successfully subscribed to the artifact')
162+ return {}
163+ else:
156164 flash('Artifact not found', 'error')
157- return data
158- flash('User successfully subscribed to the artifact')
159- return {}
165+
166+ return data