Commits

Jonas Fietz  committed 1b7d684 Merge

merge branch with upstream

  • Participants
  • Parent commits fcb01df, 5298e63

Comments (0)

Files changed (3)

File zine/forms.py

         ))
 
     def context_validate(self, data):
+        if self.user.posts.count() is 0:
+            data['action'] = None
         if data['action'] == 'reassign' and not data['reassign_to']:
             raise ValidationError(_('You have to select a user to reassign '
                                     'the posts to.'))

File zine/templates/admin/delete_user.html

     <p>{% trans username=form.user.username|e %}
       Do you really want to delete the user “{{ username }}”?
     {% endtrans %}</p>
+
+    {%- if form.user.posts.count() > 0 %}
     <p>{% trans post_count=form.user.posts.count() %}
       What should happen to the {{ post_count }} post this user wrote?
     {% pluralize %}
     {% endtrans %}</p>
     {{ form.action() }}
     <p>{{ form.reassign_to.label() }}: {{ form.reassign_to() }}
+    {%- endif %}
+
     <div class="actions">
       <input type="submit" name="cancel" value="{{ _('No') }}">
       <input type="submit" name="confirm" value="{{ _('Yes') }}">

File zine/websetup/__init__.py

         value = request.values.get
         error = None
         database_uri = value('database_uri', '').strip()
+        
+        # set up the initial config
+        config_filename = path.join(self.instance_folder, 'zine.ini')
+        cfg = Configuration(config_filename)
+        t = cfg.edit()
+        t.update(
+            maintenance_mode=environment.MODE != 'development',
+            blog_url=request.url_root,
+            secret_key=gen_secret_key(),
+            database_uri=database_uri,
+            language=request.translations.language,
+            iid=new_iid(),
+            # load one plugin by default for a better theme
+            plugins='vessel_theme',
+            theme='vessel'
+        )
+        cfg._comments['[zine]'] = CONFIG_HEADER
+        try:
+            t.commit()
+        except ConfigurationTransactionError:
+            _ = request.translations.gettext
+            error = _('The configuration file (%s) could not be opened '
+                      'for writing. Please adjust your permissions and '
+                      'try again.') % config_filename
+            return render_response(request, 'error.html', {
+            'finished': False,
+            'error':    error
+            })
 
         try:
             from zine.database import init_database
                 privilege_id=privilege_id
             )
 
-            # set up the initial config
-            config_filename = path.join(self.instance_folder, 'zine.ini')
-            cfg = Configuration(config_filename)
-            t = cfg.edit()
-            t.update(
-                maintenance_mode=environment.MODE != 'development',
-                blog_url=request.url_root,
-                secret_key=gen_secret_key(),
-                database_uri=database_uri,
-                language=request.translations.language,
-                iid=new_iid(),
-                # load one plugin by default for a better theme
-                plugins='vessel_theme',
-                theme='vessel'
-            )
-            cfg._comments['[zine]'] = CONFIG_HEADER
-            try:
-                t.commit()
-            except ConfigurationTransactionError:
-                _ = request.translations.gettext
-                error = _('The configuration file (%s) could not be opened '
-                          'for writing. Please adjust your permissions and '
-                          'try again.') % config_filename
 
         # use a local variable, the global render_response could
         # be None because we reloaded zine and this module.