savannah-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Savannah-cvs] [SCM] Savane-cleanup framework branch, master, updated. 7


From: Sylvain Beucler
Subject: [Savannah-cvs] [SCM] Savane-cleanup framework branch, master, updated. 7978c3a5c08edfc51b004817691e047b789268f5
Date: Fri, 14 May 2010 14:46:28 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Savane-cleanup framework".

The branch, master has been updated
       via  7978c3a5c08edfc51b004817691e047b789268f5 (commit)
      from  89119385117ecf9db5b7240a519cce199a1d3b3e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/savane-cleanup/framework.git/commit/?id=7978c3a5c08edfc51b004817691e047b789268f5

commit 7978c3a5c08edfc51b004817691e047b789268f5
Author: Sylvain Beucler <address@hidden>
Date:   Fri May 14 16:46:21 2010 +0200

    Update code for Django 1.2

diff --git a/doc/DJANGO b/doc/DJANGO
index 4fe358b..b60f492 100644
--- a/doc/DJANGO
+++ b/doc/DJANGO
@@ -19,8 +19,3 @@ Stuff of interest:
   "get_object_or_404(ExtendedUser, pk=request.user.pk)" calls with
   something that actually creates the ExtendedUser if the user is just
   a basic user.
-
-- As for 2010-02 Django 1.1 does not have a messaging framework for
-  anonymous users (only for logged-in users), but this will change in
-  Django 1.2, planned for 2010-03:
-  http://docs.djangoproject.com/en/dev/ref/contrib/messages/
diff --git a/savane/tracker/models.py b/savane/tracker/models.py
index 0e6b073..0d097fe 100644
--- a/savane/tracker/models.py
+++ b/savane/tracker/models.py
@@ -21,6 +21,8 @@ from django.db import models
 # TODO: default '100' (aka 'nobody' or 'None', depending on
 # fields) -> change to NULL?
 
+# Date fields: use default=... rather than auto_now_add=...; indeed,
+# auto_now_add cannot be overriden, hence it would mess data imports.
 
 RESTRICTION_CHOICES = (('2', 'anonymous'),
                        ('3', 'logged-in user'),
@@ -252,7 +254,7 @@ class Item(models.Model):
     spamscore = models.IntegerField(default=0)
     ip = IPAddressField(blank=True, null=True)
     submitted_by = models.ForeignKey('auth.User', default=100)
-    date = models.DateTimeField()
+    date = models.DateTimeField(default=datetime.date.today)
     close_date = models.DateTimeField(blank=True, null=True)
 
     # Forward dependencies
@@ -350,8 +352,8 @@ class Item(models.Model):
 
 class ItemMsgId(models.Model):
     """
-    Idenfier for in 'Message-Id' and 'References' e-mail fields, used
-    to group messages by conversation
+    Identifier for in 'Message-Id' and 'References' e-mail fields,
+    used to group messages by conversation
     """
     item = models.ForeignKey('Item')
     msg_id = models.CharField(max_length=255)
@@ -372,7 +374,7 @@ class ItemHistory(models.Model):
     old_value= models.TextField(blank=True, null=True)
     new_value= models.TextField()
     mod_by = models.ForeignKey('auth.User')
-    date = models.DateTimeField()
+    date = models.DateTimeField(default=datetime.date.today)
     ip = IPAddressField(blank=True, null=True)
 
     # Specific (bad!) field for 'details'
@@ -393,7 +395,7 @@ class ItemCc(models.Model):
     email = models.EmailField(max_length=255)
     added_by = models.ForeignKey('auth.User')
     comment = models.TextField()
-    date = models.DateTimeField()
+    date = models.DateTimeField(default=datetime.date.today)
 
 #class ItemDependencies:
 # => cf. Item.dependencies
@@ -404,7 +406,7 @@ class ItemFile(models.Model):
     """
     item = models.ForeignKey('Item')
     submitted_by = models.ForeignKey('auth.User')
-    date = models.DateTimeField()
+    date = models.DateTimeField(default=datetime.date.today)
     description = models.TextField()
     filename = models.TextField()
     filesize = models.IntegerField(default=0)
diff --git a/settings_default.py b/settings_default.py
index 5e2cf6c..1ee7c75 100644
--- a/settings_default.py
+++ b/settings_default.py
@@ -12,12 +12,14 @@ ADMINS = (
 
 MANAGERS = ADMINS
 
-DATABASE_ENGINE = 'mysql'           # 'postgresql_psycopg2', 'postgresql', 
'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = 'savane'             # Or path to database file if using 
sqlite3.
-DATABASE_USER = 'root'             # Not used with sqlite3.
-DATABASE_PASSWORD = ''         # Not used with sqlite3.
-DATABASE_HOST = 'localhost'             # Set to empty string for localhost. 
Not used with sqlite3.
-DATABASE_PORT = ''             # Set to empty string for default. Not used 
with sqlite3.
+DATABASES = {
+    'default': {
+        'NAME': 'savane',
+        'ENGINE': 'django.db.backends.mysql',
+        'USER': 'root',
+        'PASSWORD': '',
+    }
+}
 
 # Local time zone for this installation. Choices can be found here:
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
@@ -34,9 +36,14 @@ SITE_ID = 1
 
 # If you set this to False, Django will make some optimizations so as not
 # to load the internationalization machinery.
-USE_I18N = False
+USE_I18N = True
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_L10N=True
 
 # Make this unique, and don't share it with anybody.
+# TODO: re-generate this on first install, or something
 SECRET_KEY = 'r0u=mcmr$46vf6y3x4!lti5pza)address@hidden)ie)address@hidden'
 
 # List of callables that know how to import templates from various sources.
@@ -53,7 +60,10 @@ TEMPLATE_CONTEXT_PROCESSORS = 
global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
 MIDDLEWARE_CLASSES = (
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+
     'savane.middleware.debug.DebugFooter',
 )
 
@@ -66,28 +76,16 @@ TEMPLATE_DIRS = (
     os.path.join(os.path.dirname(__file__), 'templates'),
 )
 
-
-# Applications media
-STATIC_MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'static_media/')
-STATIC_MEDIA_URL = '/static_media/'
-
-# Media for Django auto-admin
-ADMIN_MEDIA_PREFIX = '/admin_media/'
-
-# User-uploaded media (with trailing slashes)
-MEDIA_ROOT = ''
-MEDIA_URL = ''
-
-
-LOGIN_URL = '/accounts/login/'
-LOGIN_REDIRECT_URL = '/my/'
-
 # Used by syncdb, etc.
 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
+    'django.contrib.messages',
+
     'django.contrib.admin',
+    'django.contrib.admindocs',
+
     'savane.svmain',
     'savane.my',
     'savane.register',
@@ -95,3 +93,26 @@ INSTALLED_APPS = (
 # login when no site is defined
 #    'django.contrib.sites',
 )
+
+
+LOGIN_URL = '/accounts/login/'
+LOGIN_REDIRECT_URL = '/my/'
+
+# Applications media
+STATIC_MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'static_media/')
+STATIC_MEDIA_URL = '/static_media/'
+
+# Media for Django auto-admin
+ADMIN_MEDIA_PREFIX = '/admin_media/'
+
+# User-uploaded media (with trailing slashes)
+MEDIA_ROOT = os.path.dirname(__file__) + '/upload/'
+MEDIA_URL = '/upload/'
+
+# For a subdir:
+#subdir = '/savane'
+#LOGIN_URL          = subdir + '/accounts/login/'
+#LOGIN_REDIRECT_URL = subdir + '/'
+#REQUIRE_LOGIN_PATH = LOGIN_URL
+#STATIC_MEDIA_URL   = subdir + '/static_media/'
+#MEDIA_URL          = subdir + '/upload/'
diff --git a/templates/base.html b/templates/base.html
index abced1e..10168bc 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -45,7 +45,7 @@
     </div>
     {% else %}
     <div class="menu_login">
-      <form action="{% url django.contrib.auth.views.login %}" method="post">
+      <form action="{% url django.contrib.auth.views.login %}" 
method="post">{% csrf_token %}
         <dl>
           <dt>Login Name:</dt>
           <dd><input type="text" name="username" value="" size="12" /></dd>
diff --git a/templates/my/conf.html b/templates/my/conf.html
index 7e7e36c..e7d8e8b 100644
--- a/templates/my/conf.html
+++ b/templates/my/conf.html
@@ -10,7 +10,7 @@
 <div class="box">
   <div class="boxtitle">Change Password</div>
   <div class="boxitem">
-    <form method="post">
+    <form method="post">{% csrf_token %}
       <dl>
         {% for field in form_pass %}
         {% if field.is_hidden %}
@@ -29,7 +29,7 @@
 <div class="box">
   <div class="boxtitle">Change E-Mail</div>
   <div class="boxitem">
-    <form method="post">
+    <form method="post">{% csrf_token %}
       <dl>
         <dt>Current</dt>
         <dd>{{ user.email }}</dd>
@@ -50,7 +50,7 @@
 <div class="box">
   <div class="boxtitle">Change Name</div>
   <div class="boxitem">
-    <form method="post">
+    <form method="post">{% csrf_token %}
       <dl>
         {% for field in form_identity %}
         {% if field.is_hidden %}
diff --git a/templates/my/ssh_gpg.html b/templates/my/ssh_gpg.html
index 8de124c..4d4f717 100644
--- a/templates/my/ssh_gpg.html
+++ b/templates/my/ssh_gpg.html
@@ -16,13 +16,13 @@
 {% endfor %}
 
 <h3>SSH Keys</h3>
-<form method="post" enctype="multipart/form-data">
+<form method="post" enctype="multipart/form-data">{% csrf_token %}
   {{ form_ssh.as_p }}
   <br /><input type="submit" value="Add" name="Add" />
 </form>
 
 <h3>GPG Key</h3>
-<form method="post">
+<form method="post">{% csrf_token %}
   {{ form_gpg.as_p }}
   <br /><input type="submit" value="Update" name="Update" />
 </form>
diff --git a/templates/register/register.html b/templates/register/register.html
index 0c72fd3..59e9033 100644
--- a/templates/register/register.html
+++ b/templates/register/register.html
@@ -1,7 +1,7 @@
 {% extends "base.html" %}
 
 {% block content %}
-<form action="{% url savane.register.views.register %}" method="post">
+<form action="{% url savane.register.views.register %}" method="post">{% 
csrf_token %}
 <dl>
   {% for field in form %}
   {% if field.is_hidden %}
diff --git a/templates/registration/login.html 
b/templates/registration/login.html
index 2002264..9d49c96 100644
--- a/templates/registration/login.html
+++ b/templates/registration/login.html
@@ -3,7 +3,7 @@
 {% block content %}
 Login:
 
-<form action="{% url django.contrib.auth.views.login %}" method="post">
+<form action="{% url django.contrib.auth.views.login %}" method="post">{% 
csrf_token %}
 {{form.as_p}}
 <input type="submit" name="login" value="Login" />
 </form>

-----------------------------------------------------------------------

Summary of changes:
 doc/DJANGO                        |    5 ---
 savane/tracker/models.py          |   14 ++++---
 settings_default.py               |   67 ++++++++++++++++++++++++-------------
 templates/base.html               |    2 +-
 templates/my/conf.html            |    6 ++--
 templates/my/ssh_gpg.html         |    4 +-
 templates/register/register.html  |    2 +-
 templates/registration/login.html |    2 +-
 8 files changed, 60 insertions(+), 42 deletions(-)


hooks/post-receive
-- 
Savane-cleanup framework



reply via email to

[Prev in Thread] Current Thread [Next in Thread]