Index: main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 7659)
+++ main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 7660)
@@ -187,61 +187,4 @@
         return
 
-class SetPasswordPage(SIRPPage):
-    grok.context(ISIRPObject)
-    grok.name('setpassword')
-    grok.require('waeup.Anonymous')
-    grok.template('setpassword')
-    label = 'Set password for first-time login'
-    ac_prefix = 'PWD'
-    pnav = 0
-
-    def update(self, SUBMIT=None):
-        self.reg_number = self.request.form.get('reg_number', None)
-        self.ac_series = self.request.form.get('ac_series', None)
-        self.ac_number = self.request.form.get('ac_number', None)
-
-        if SUBMIT is None:
-            return
-        hitlist = search(query=self.reg_number,
-            searchtype='reg_number', view=self)
-        if not hitlist:
-            self.flash('No student found.')
-            return
-        if len(hitlist) != 1:   # Cannot happen but anyway
-            self.flash('More than one student found.')
-            return
-        student = hitlist[0].context
-        self.student_id = student.student_id
-        student_pw = student.password
-        pin = '%s-%s-%s' % (self.ac_prefix, self.ac_series, self.ac_number)
-        code = get_access_code(pin)
-        if not code:
-            self.flash('Access code is invalid.')
-            return
-        if student_pw and pin == student.adm_code:
-            self.flash('Password has already been set. Your Student Id is %s'
-                % self.student_id)
-            return
-        elif student_pw:
-            self.flash(
-                'Password has already been set. You are using the '
-                'wrong Access Code.')
-            return
-        # Mark pin as used (this also fires a pin related transition)
-        # and set student password
-        if code.state == USED:
-            self.flash('Access code has already been used.')
-            return
-        else:
-            comment = u"AC invalidated for %s" % self.student_id
-            # Here we know that the ac is in state initialized so we do not
-            # expect an exception
-            invalidate_accesscode(pin,comment)
-            IUserAccount(student).setPassword(self.ac_number)
-            student.adm_code = pin
-        self.flash('Password has been set. Your Student Id is %s'
-            % self.student_id)
-        return
-
 class StudentsContainerManagePage(SIRPPage):
     """The manage page for student containers.
@@ -1848,2 +1791,58 @@
         return
 
+class SetPasswordPage(SIRPPage):
+    grok.context(ISIRPObject)
+    grok.name('setpassword')
+    grok.require('waeup.Anonymous')
+    grok.template('setpassword')
+    label = 'Set password for first-time login'
+    ac_prefix = 'PWD'
+    pnav = 0
+
+    def update(self, SUBMIT=None):
+        self.reg_number = self.request.form.get('reg_number', None)
+        self.ac_series = self.request.form.get('ac_series', None)
+        self.ac_number = self.request.form.get('ac_number', None)
+
+        if SUBMIT is None:
+            return
+        hitlist = search(query=self.reg_number,
+            searchtype='reg_number', view=self)
+        if not hitlist:
+            self.flash('No student found.')
+            return
+        if len(hitlist) != 1:   # Cannot happen but anyway
+            self.flash('More than one student found.')
+            return
+        student = hitlist[0].context
+        self.student_id = student.student_id
+        student_pw = student.password
+        pin = '%s-%s-%s' % (self.ac_prefix, self.ac_series, self.ac_number)
+        code = get_access_code(pin)
+        if not code:
+            self.flash('Access code is invalid.')
+            return
+        if student_pw and pin == student.adm_code:
+            self.flash('Password has already been set. Your Student Id is %s'
+                % self.student_id)
+            return
+        elif student_pw:
+            self.flash(
+                'Password has already been set. You are using the '
+                'wrong Access Code.')
+            return
+        # Mark pin as used (this also fires a pin related transition)
+        # and set student password
+        if code.state == USED:
+            self.flash('Access code has already been used.')
+            return
+        else:
+            comment = u"AC invalidated for %s" % self.student_id
+            # Here we know that the ac is in state initialized so we do not
+            # expect an exception
+            invalidate_accesscode(pin,comment)
+            IUserAccount(student).setPassword(self.ac_number)
+            student.adm_code = pin
+        self.flash('Password has been set. Your Student Id is %s'
+            % self.student_id)
+        return
