diff pylons_app/model/forms.py @ 367:a26f48ad7a8a

fixes issue #16 reimplementation of database repository, for using generic pk instead of repo naming as pk. Which caused to many problems. Fixed issue when redirecting after repo name change to 404. Removed update hook from basic app setup
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 27 Jul 2010 14:53:22 +0200
parents 98abf8953b87
children 55377fdc1fc6
line wrap: on
line diff
--- a/pylons_app/model/forms.py	Tue Jul 27 14:48:13 2010 +0200
+++ b/pylons_app/model/forms.py	Tue Jul 27 14:53:22 2010 +0200
@@ -164,10 +164,9 @@
             if slug in ['_admin']:
                 raise formencode.Invalid(_('This repository name is disallowed'),
                                          value, state)
-            
             if old_data.get('repo_name') != value or not edit:    
                 sa = meta.Session
-                if sa.query(Repository).get(slug):
+                if sa.query(Repository).filter(Repository.repo_name == slug).scalar():
                     raise formencode.Invalid(_('This repository already exists') ,
                                              value, state)
                 meta.Session.remove()