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. 3


From: Sylvain Beucler
Subject: [Savannah-cvs] [SCM] Savane-cleanup framework branch, master, updated. 3d51ca4b7b923ca59eff8ff2cf94d38d91d3e2ce
Date: Sun, 26 Jul 2009 22:02:08 +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  3d51ca4b7b923ca59eff8ff2cf94d38d91d3e2ce (commit)
       via  3fff1c757759412ed9ff778f9e28d20aa68d43b8 (commit)
       via  c194d8b1e63484dbb7dbbb53a03c0e335a34e959 (commit)
       via  e9c149f910b3289dab4811174f2d8f2b383b41d9 (commit)
       via  51d6c09e92f5ce921e54cf0d3db44102686cd654 (commit)
       via  6ca0b6f460550ae080cd9be12a713ad5b097bd3f (commit)
      from  b00545631859ee4c85a1ee5a0a16971101d9ce7e (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=3d51ca4b7b923ca59eff8ff2cf94d38d91d3e2ce

commit 3d51ca4b7b923ca59eff8ff2cf94d38d91d3e2ce
Author: Sylvain Beucler <address@hidden>
Date:   Sun Jul 26 23:54:52 2009 +0200

    - Clean-up in the login code to reuse Django 'auth' app; if I removed
      useful code, please add it back :)
    
    - Renamed 'User' to 'ExtendedUser', and 'savane_user' to 'my';
      eventually we could have a 'savane.frontend.my' app
    
    - Fixed issues in SSH/GPG code where ExtendedUser fields were
      requested on a User object
    
    - Improved INSTALL documentation
    
    - Added copyright/license notices
    
    - Clarified Savane import script (still need to check why there's a
      latin1 conversion)
    
    - Converted trivial views by generic views

diff --git a/INSTALL b/INSTALL
index ea2ced8..251d760 100644
--- a/INSTALL
+++ b/INSTALL
@@ -30,17 +30,19 @@ You can test your install using:
  $ python manage.py runserver
 
 
-* Run with Apache (to be tested):
+* Run with Apache:
 
 ** Dedicated server:
 
-  <Location "/">
+apt-get install libapache2-mod-python
+
+ <Location "/">
     SetHandler python-program
     PythonHandler django.core.handlers.modpython
-    SetEnv DJANGO_SETTINGS_MODULE savane.settings
+    SetEnv DJANGO_SETTINGS_MODULE settings
     #PythonOption django.root /myapp
     PythonDebug On
-    PythonPath "['/var/www/framework/savane/'] + sys.path"
+    PythonPath "['/var/www/framework/savane'] + sys.path"
   </Location>
   <Location "/media">
     SetHandler None
@@ -52,13 +54,15 @@ You can test your install using:
     SetHandler None
   </Location>
   Alias /media 
/usr/share/python-support/python-django/django/contrib/admin/media
+  #Alias /media /usr/share/pyshared/django/contrib/admin/media
   Alias /css /var/www/framework/media/css
   Alias /images /var/www/framework/media/images
- 
+
 ** FCGI + suExec (shared hosting):
+http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/
 
-apt-get install libapache2-mod-fcgid
-(_not_ mod-fastcgi which is non-free)
+apt-get install libapache2-mod-fcgid  # _not_ mod-fastcgi which is non-free
+apt-get install python-flup
 
 httpd.conf:
 
@@ -66,17 +70,17 @@ httpd.conf:
   SuexecUserGroup myuser mygroup
  
   Alias /media 
/usr/share/python-support/python-django/django/contrib/admin/media
+  #Alias /media /usr/share/pyshared/django/contrib/admin/media
   Alias /css /var/www/framework/media/css
   Alias /images /var/www/framework/media/images
  
   <Directory "/var/www/framework/savane">
     RewriteEngine On
-    RewriteRule ^/(media.*)$ /$1 [QSA,L]
     RewriteCond %{REQUEST_FILENAME} !-f
-    RewriteRule ^(.*)$ savane.fcgi/$1 [QSA,L]
+    RewriteRule ^(.*)$ savane.fcgi/$1 [qsappend,last]
   </Directory>
  
- 
+
 savane.fcgi:
 
 #!/usr/bin/python
@@ -89,7 +93,7 @@ sys.path.insert(0, "/var/www/framework/savane")
 # os.chdir("/home/user/myproject")
  
 # Set the DJANGO_SETTINGS_MODULE environment variable.
-os.environ['DJANGO_SETTINGS_MODULE'] = "savane.settings"
+os.environ['DJANGO_SETTINGS_MODULE'] = "settings"
  
 from django.core.servers.fastcgi import runfastcgi
 runfastcgi(method="threaded", daemonize="false")
diff --git a/migrate_old_savane.sql b/migrate_old_savane.sql
index acd8050..1bb91a2 100644
--- a/migrate_old_savane.sql
+++ b/migrate_old_savane.sql
@@ -1,3 +1,22 @@
-insert into auth_user (id, username, first_name, email, password, last_login, 
date_joined) select user_id, user_name, trim(convert(realname using latin1)), 
email, user_pw, now(), from_unixtime(add_date) from savane_old.user;
+-- USE savane;
 
-insert into user (user_ptr_id, status,spamscore, confirm_hash, 
authorized_keys, authorized_keys_count, people_view_skills, people_resume, 
timezone, theme, email_hide, gpg_key, gpg_key_count) select user_id, 
status,spamscore, confirm_hash, authorized_keys, authorized_keys_count, 
people_view_skills, convert(people_resume using latin1), timezone, theme, 
email_hide, gpg_key, gpg_key_count from  savane_old.user;
+-- Import all users except for the 'None' user (#100)
+INSERT INTO auth_user
+    (id, username, first_name, last_name, email,
+     password, last_login, date_joined, is_active)
+  SELECT user_id, user_name, trim(convert(realname using latin1)), '', email,
+      CONCAT('md5$$', user_pw), now(), FROM_UNIXTIME(add_date), status='A'
+    FROM savane_old.user
+    WHERE user_id != 100;
+
+-- Import all extended information except for the 'None' user (#100)
+INSERT INTO my_extendeduser
+    (user_ptr_id, status, spamscore, authorized_keys,
+     authorized_keys_count, people_view_skills, people_resume,
+     timezone, theme, email_hide, gpg_key, gpg_key_count)
+  SELECT user_id, status, spamscore, authorized_keys,
+      authorized_keys_count, people_view_skills,
+      CONVERT(people_resume USING latin1), timezone, theme,
+      email_hide, gpg_key, gpg_key_count
+    FROM savane_old.user
+    WHERE user_id != 100;
diff --git a/savane/main/models.py b/savane/main/models.py
deleted file mode 100644
index 71a8362..0000000
--- a/savane/main/models.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.db import models
-
-# Create your models here.
diff --git a/savane/main/urls.py b/savane/main/urls.py
index 4fc2dc4..c42dcaa 100644
--- a/savane/main/urls.py
+++ b/savane/main/urls.py
@@ -1,12 +1,30 @@
-from django.conf.urls.defaults import *
-from main import views
+# URL dispatching for presentation pages
+# Copyright (C) 2009  Sylvain Beucler
+# Copyright (C) 2009  Jonathan Gonzalez V.
+#
+# This file is part of Savane.
+# 
+# Savane is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+# 
+# Savane is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+from django.conf.urls.defaults import *
 
 urlpatterns = patterns ('',
-                        url('^$',
-                            views.index,
-                            ),
-                        url('^contact$',
-                            views.contact,
-                            ),
-                        )
+  url(r'^$', 'django.views.generic.simple.direct_to_template',
+      { 'template' : 'index.html',
+        'extra_context' : { 'has_left_menu': False } },
+      name='homepage'),
+  url(r'^contact$', 'django.views.generic.simple.direct_to_template',
+      { 'template' : 'contact.html' },
+      name='contact'),
+)
diff --git a/savane/main/views.py b/savane/main/views.py
deleted file mode 100644
index a511878..0000000
--- a/savane/main/views.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from django.template import RequestContext
-from django.shortcuts import render_to_response
-from django.http import HttpResponse
-
-def index(request):
-    return render_to_response( 'index.html',
-                               RequestContext( request, {'has_left_menu': 
False},
-                                               ) )
-
-def contact( request ):
-    return render_to_response( 'contact.html',
-                               RequestContext( request,
-                                               ))
diff --git a/savane/savane_user/__init__.py b/savane/my/__init__.py
similarity index 100%
rename from savane/savane_user/__init__.py
rename to savane/my/__init__.py
diff --git a/savane/savane_user/admin.py b/savane/my/admin.py
similarity index 58%
rename from savane/savane_user/admin.py
rename to savane/my/admin.py
index 366a188..97dad87 100644
--- a/savane/savane_user/admin.py
+++ b/savane/my/admin.py
@@ -1,4 +1,4 @@
-from savane.savane_user.models import User
 from django.contrib import admin
+from models import User
 
 admin.site.register(User)
diff --git a/savane/my/models.py b/savane/my/models.py
new file mode 100644
index 0000000..f37fdb8
--- /dev/null
+++ b/savane/my/models.py
@@ -0,0 +1,53 @@
+# User extra attributes
+# Copyright (C) 2009  Sylvain Beucler
+# Copyright (C) 2009  Jonathan Gonzalez V.
+#
+# This file is part of Savane.
+# 
+# Savane is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+# 
+# Savane is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from django.db import models
+from django.contrib.auth.models import User, UserManager
+
+class ExtendedUser(User):
+    # Migrated to 'firstname' in auth.User
+    #realname = models.CharField(max_length=96)
+
+    # Old Savane can be Active/Deleted/Pending/Suspended/SQuaD
+    status = models.CharField(max_length=48)
+
+    # Used by trackers only but it could be used more widely
+    spamscore = models.IntegerField(null=True, blank=True)
+    # Previously used for e-mail changes and password recovery, Django
+    # does it different with a auth.tokens
+    #confirm_hash = models.CharField(max_length=96, blank=True, null=True)
+
+    # Keys
+    authorized_keys = models.TextField(blank=True, null=True)
+    authorized_keys_count = models.IntegerField(null=True, blank=True)
+    gpg_key = models.TextField(blank=True, null=True)
+    gpg_key_count = models.IntegerField(null=True, blank=True)
+
+    # Personal info
+    people_resume = models.TextField()
+
+    # Preferences - /!\ some are also in the user_preferences table
+    people_view_skills = models.IntegerField(null=True)
+    timezone = models.CharField(max_length=192, blank=True, null=True)
+    theme = models.CharField(max_length=45, blank=True, null=True)
+    email_hide = models.CharField(max_length=9, blank=True, null=True)
+
+
+    # Inherit specialized models.Manager with convenience functions
+    objects = UserManager()
diff --git a/savane/my/urls.py b/savane/my/urls.py
new file mode 100644
index 0000000..edccc5e
--- /dev/null
+++ b/savane/my/urls.py
@@ -0,0 +1,43 @@
+# Accounts URLs
+# Copyright (C) 2009  Sylvain Beucler
+# Copyright (C) 2009  Jonathan Gonzalez V.
+#
+# This file is part of Savane.
+# 
+# Savane is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+# 
+# Savane is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from django.conf.urls.defaults import *
+from django.contrib.auth.decorators import login_required
+from django.views.generic.simple import direct_to_template
+import views
+
address@hidden
+def direct_to_template__login_required(*args, **kwargs):
+    return direct_to_template(*args, **kwargs)
+
+
+urlpatterns = patterns ('',
+  url(r'^$', direct_to_template__login_required,
+      { 'template' : 'savane_user/index.html' },
+      name='my.views.index'),
+  url('^conf/$',
+      views.sv_conf,
+      ),
+  url('^conf/resume_skill$',
+      views.sv_resume_skill,
+      ),
+  url('^conf/ssh_gpg$',
+      views.sv_ssh_gpg,
+      ),
+)
diff --git a/savane/savane_user/views.py b/savane/my/views.py
similarity index 82%
rename from savane/savane_user/views.py
rename to savane/my/views.py
index 1d7834b..1ca2a5e 100644
--- a/savane/savane_user/views.py
+++ b/savane/my/views.py
@@ -1,41 +1,29 @@
+# Manage user attributes
+# Copyright (C) 2009  Sylvain Beucler
+# Copyright (C) 2009  Jonathan Gonzalez V.
+#
+# This file is part of Savane.
+# 
+# Savane is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+# 
+# Savane is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 from django.template import RequestContext
 from django.shortcuts import render_to_response
 from django.http import HttpResponseRedirect
 from django.contrib.auth import authenticate, login, logout
 from django.contrib.auth.decorators import login_required
 from django import forms
-from savane_user.models import User
-
-def index( request ):
-    return render_to_response( 'savane_user/index.html',
-                               RequestContext( request,
-                                               ) )
-def sv_login( request ):
-
-    if request.method == 'POST':
-        username = request.POST['username']
-        password = request.POST['password']
-
-        if username != '' and password != '':
-            user = authenticate( username=username, password=password )
-        else:
-            user = None
-
-        if user is not None:
-            login( request, user )
-        else:
-            login_error = u"User or password didn't match"
-            return render_to_response( 'error.html',
-                                       {'error' : login_error
-                                        } )
-
-    return HttpResponseRedirect ( '/user/' )
-
address@hidden()
-def sv_logout( request ):
-    logout( request )
-
-    return HttpResponseRedirect( '/' )
+from models import ExtendedUser
 
 @login_required()
 def sv_conf( request ):
@@ -98,6 +86,7 @@ def sv_resume_skill( request ):
                                                ) )
 @login_required()
 def sv_ssh_gpg( request ):
+    eu = ExtendedUser.objects.get(pk=request.user.pk)
 
     error_msg = None
     success_msg = None
@@ -124,15 +113,15 @@ def sv_ssh_gpg( request ):
                         keys.append( key )
                 keys_str = str('###').join( keys )
 
-                request.user.authorized_keys = keys_str
-                request.user.save()
+                eu.authorized_keys = keys_str
+                eu.save()
                 success_msg = 'Authorized keys stored.'
             elif action == 'update_gpg':
                 pass
     else:
-        if request.user.authorized_keys != '':
+        if eu.authorized_keys != '':
             keys_data = dict({'action':'update_ssh'})
-            keys = request.user.authorized_keys.split('###')
+            keys = (eu.authorized_keys or '').split('###')
             i = 1
             for key in keys:
                 key_str = 'key_'+str(i)
@@ -142,8 +131,8 @@ def sv_ssh_gpg( request ):
         else:
             form_ssh = SSHForm()
 
-        if request.user.gpg_key != '':
-            gpg_data = dict({'action':'update_gpg', 
'gpg_key':request.user.gpg_key})
+        if eu.gpg_key != '':
+            gpg_data = dict({'action':'update_gpg', 'gpg_key':eu.gpg_key})
             form_gpg = GPGForm( gpg_data )
         else:
             form_gpg = GPGForm()
diff --git a/savane/savane_user/backend.py b/savane/savane_user/backend.py
deleted file mode 100644
index 6a76f7a..0000000
--- a/savane/savane_user/backend.py
+++ /dev/null
@@ -1,20 +0,0 @@
-from savane_user.models import User
-from django.contrib.auth.backends import ModelBackend
-
-class SavaneAuthBackend( ModelBackend ):
-    """
-    Authenticate against the savane_user model
-    """
-    def authenticate( self, username, password ):
-        try:
-            user = User.objects.get(username=username)
-            if user.check_password(password):
-                return user
-        except User.DoesNotExist:
-            return None
-
-    def get_user(self, user_id):
-        try:
-            return User.objects.get(pk=user_id)
-        except User.DoesNotExist:
-            return None
diff --git a/savane/savane_user/models.py b/savane/savane_user/models.py
deleted file mode 100644
index 0b23042..0000000
--- a/savane/savane_user/models.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from django.db import models
-from django.contrib.auth.models import User, UserManager
-
-class User(User):
-#    realname = models.CharField(max_length=96)
-    status = models.CharField(max_length=48)
-    spamscore = models.IntegerField(null=True, blank=True)
-    confirm_hash = models.CharField(max_length=96, blank=True, null=True)
-    authorized_keys = models.TextField(blank=True, null=True)
-    authorized_keys_count = models.IntegerField(null=True, blank=True)
-    people_view_skills = models.IntegerField(null=True)
-    people_resume = models.TextField()
-    timezone = models.CharField(max_length=192, blank=True, null=True)
-    theme = models.CharField(max_length=45, blank=True, null=True)
-    email_hide = models.CharField(max_length=9, blank=True, null=True)
-    gpg_key = models.TextField(blank=True, null=True)
-    gpg_key_count = models.IntegerField(null=True, blank=True)
-    objects = UserManager()
-
-    class Meta():
-        db_table = u'user'
-
-
diff --git a/savane/savane_user/urls.py b/savane/savane_user/urls.py
deleted file mode 100644
index 2d958fa..0000000
--- a/savane/savane_user/urls.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from django.conf.urls.defaults import *
-from savane_user import views
-
-
-urlpatterns = patterns ('',
-                        url('^$',
-                            views.index,
-                            ),
-                        url('^login$',
-                            views.sv_login,
-                            ),
-                        url('^logout$',
-                            views.sv_logout,
-                            ),
-                        url('^conf/$',
-                            views.sv_conf,
-                            ),
-                        url('^conf/resume_skill$',
-                            views.sv_resume_skill,
-                            ),
-                        url('^conf/ssh_gpg$',
-                            views.sv_ssh_gpg,
-                            ),
-                        )
diff --git a/savane/settings.py b/savane/settings.py
index 51e6876..6fd882e 100644
--- a/savane/settings.py
+++ b/savane/settings.py
@@ -84,11 +84,7 @@ TEMPLATE_DIRS = (
 )
 STATIC_ROOT = '../media/'
 
-AUTHENTICATION_BACKENDS = (
-    'savane.savane_user.backend.SavaneAuthBackend',
-)
-
-LOGIN_URL = '/user/'
+LOGIN_URL = '/accounts/login/'
 
 INSTALLED_APPS = (
     'django.contrib.auth',
@@ -96,5 +92,7 @@ INSTALLED_APPS = (
     'django.contrib.sessions',
     'django.contrib.sites',
 #    'django.contrib.admin',
-    'savane.savane_user',
+    'savane.my',
 )
+
+LOGIN_REDIRECT_URL = '/my/'
diff --git a/savane/urls.py b/savane/urls.py
index 259b1d2..0595a6e 100644
--- a/savane/urls.py
+++ b/savane/urls.py
@@ -1,18 +1,38 @@
+# URL dispatching
+# Copyright (C) 2009  Sylvain Beucler
+# Copyright (C) 2009  Jonathan Gonzalez V.
+#
+# This file is part of Savane.
+# 
+# Savane is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+# 
+# Savane is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 from django.conf.urls.defaults import *
 from django.conf import settings
 
-# Uncomment the next two lines to enable the admin:
-# from django.contrib import admin
-# admin.autodiscover()
-
+# Home/presentation pages
 urlpatterns = patterns('',
-#                       (r'^$', "main.views.index"),
-                       (r'', include('main.urls')),
-                       (r'^user/', include('savane_user.urls')),
+  (r'', include('main.urls')),
+)
 
-                       # Uncomment the next line to enable the admin:
-                       # (r'^admin/(.*)', admin.site.root),
-                       )
+# User account
+urlpatterns += patterns('',
+  (r'^my/', include('my.urls')),
+  # Generic login/logout/change_pass/etc.
+  (r'^accounts/logout/$', 'django.contrib.auth.views.logout',
+    {'next_page' : '/'}),  # redirect to '/' instead of login page
+  (r'^accounts/', include('django.contrib.auth.urls')),
+)
 
 # Static content
 if settings.DEBUG:
@@ -22,3 +42,10 @@ if settings.DEBUG:
         (r'^images/(?P<path>.*)$', 'serve',
          {'document_root' : settings.STATIC_ROOT + 'images/', 'show_indexes' : 
True}),
     )
+
+# Uncomment the next lines to enable the admin:
+# from django.contrib import admin
+# admin.autodiscover()
+# urlpatterns += patterns(
+#   (r'^admin/(.*)', admin.site.root),
+# )
diff --git a/template/base.html b/template/base.html
index 59b758e..37cc021 100644
--- a/template/base.html
+++ b/template/base.html
@@ -39,13 +39,12 @@
     <div class="fast_menu_user">
 <!--      <a href="">Items</a> -->
 <!--      <a href="">Groups</a> -->
-      <a href="/user/conf">Account Conf</a>
-      <a href="/user/logout">Logout</a>
+      <a href="{% url my.views.sv_conf %}">Account Conf</a>
+      | <a href="{% url django.contrib.auth.views.logout %}">Logout</a>
     </div>
     {% else %}
     <div class="menu_login">
-      <form action="{% url savane_user.views.sv_login %}" method="post">
-        <input type="hidden" name="uri" value="/" />
+      <form action="{% url django.contrib.auth.views.login %}" method="post">
         <dl>
           <dt>Login Name:</dt>
           <dd><input type="text" name="username" value="" size="12" /></dd>
@@ -65,7 +64,7 @@
             <li><a>User Docs: Cookbook</a></li>
             <li><a>User Docs: In Depth Guide</a></li>
             <li><a>Get Support</a></li>
-            <li><a href="{% url main.views.contact %}">Contact Us</a></li>
+            <li><a href="{% url contact %}">Contact Us</a></li>
             <li><a href="http://savannah.gnu.org/maintenance/CvsAnonymous";>CVS 
Instructions</a></li>
             <li><a href="http://savannah.gnu.org/maintenance/FaQ";>FAQ</a></li>
           </ul>
diff --git a/template/error.html b/template/error.html
new file mode 100644
index 0000000..a0730c9
--- /dev/null
+++ b/template/error.html
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+
+{% block content %}
+<p style='color: red'>{{error}}</p>
+{% endblock content %}
diff --git a/template/savane_user/index.html b/template/registration/login.html
similarity index 80%
copy from template/savane_user/index.html
copy to template/registration/login.html
index b9f76cf..2cfe5a8 100644
--- a/template/savane_user/index.html
+++ b/template/registration/login.html
@@ -2,7 +2,8 @@
 {% extends "base.html" %}
 
 {% block content %}
-<form action="login" method="post">
+Please login:
+<form action="{% url django.contrib.auth.views.login %}" method="post">
 <dl>
   <dt>Login Name:</dt>
   <dd><input type="text" name="username" value="" size="12" /></dd>
diff --git a/template/savane_user/conf.html b/template/savane_user/conf.html
index 46be9c3..f87a00f 100644
--- a/template/savane_user/conf.html
+++ b/template/savane_user/conf.html
@@ -2,9 +2,9 @@
 
 {% block content %}
 <ul class="section">
-  <li><a href="{% url savane_user.views.sv_conf %}">General 
Configuration</a></li>
-  <li><a href="{% url savane_user.views.sv_resume_skill %}">Resume &amp; 
Skill</a></li>
-  <li><a href="{% url savane_user.views.sv_ssh_gpg %}">SSH/GPG Keys</a></li>
+  <li><a href="{% url my.views.sv_conf %}">General Configuration</a></li>
+  <li><a href="{% url my.views.sv_resume_skill %}">Resume &amp; Skill</a></li>
+  <li><a href="{% url my.views.sv_ssh_gpg %}">SSH/GPG Keys</a></li>
 </ul>
 
 <div class="box">
diff --git a/template/savane_user/index.html b/template/savane_user/index.html
index b9f76cf..df6e09f 100644
--- a/template/savane_user/index.html
+++ b/template/savane_user/index.html
@@ -2,13 +2,5 @@
 {% extends "base.html" %}
 
 {% block content %}
-<form action="login" method="post">
-<dl>
-  <dt>Login Name:</dt>
-  <dd><input type="text" name="username" value="" size="12" /></dd>
-  <dt>Password:</dt>
-  <dd><input type="password" name="password" size="12" /></dd>
-  <dd><input type="submit" name="login" value="Login" /></dd>
-</dl>
-</form>
+My nice personal page.
 {% endblock %}
diff --git a/template/savane_user/resume_skill.html 
b/template/savane_user/resume_skill.html
index a4595f4..f0a1548 100644
--- a/template/savane_user/resume_skill.html
+++ b/template/savane_user/resume_skill.html
@@ -2,9 +2,9 @@
 
 {% block content %}
 <ul class="section">
-  <li><a href="{% url savane_user.views.sv_conf %}">General 
Configuration</a></li>
-  <li><a href="{% url savane_user.views.sv_resume_skill %}">Resume &amp; 
Skill</a></li>
-  <li><a href="{% url savane_user.views.sv_ssh_gpg %}">SSH/GPG Keys</a></li>
+  <li><a href="{% url my.views.sv_conf %}">General Configuration</a></li>
+  <li><a href="{% url my.views.sv_resume_skill %}">Resume &amp; Skill</a></li>
+  <li><a href="{% url my.views.sv_ssh_gpg %}">SSH/GPG Keys</a></li>
 </ul>
 
 
diff --git a/template/savane_user/ssh_gpg.html 
b/template/savane_user/ssh_gpg.html
index df7ef64..d541298 100644
--- a/template/savane_user/ssh_gpg.html
+++ b/template/savane_user/ssh_gpg.html
@@ -2,9 +2,9 @@
 
 {% block content %}
 <ul class="section">
-  <li><a href="{% url savane_user.views.sv_conf %}">General 
Configuration</a></li>
-  <li><a href="{% url savane_user.views.sv_resume_skill %}">Resume &amp; 
Skill</a></li>
-  <li><a href="{% url savane_user.views.sv_ssh_gpg %}">SSH/GPG Keys</a></li>
+  <li><a href="{% url my.views.sv_conf %}">General Configuration</a></li>
+  <li><a href="{% url my.views.sv_resume_skill %}">Resume &amp; Skill</a></li>
+  <li><a href="{% url my.views.sv_ssh_gpg %}">SSH/GPG Keys</a></li>
 </ul>
 
 <h3>SSH Keys</h3>

http://git.savannah.gnu.org/cgit/savane-cleanup/framework.git/commit/?id=3fff1c757759412ed9ff778f9e28d20aa68d43b8

commit 3fff1c757759412ed9ff778f9e28d20aa68d43b8
Merge: c194d8b b005456
Author: Sylvain Beucler <address@hidden>
Date:   Sun Jul 26 17:31:18 2009 +0200

    Merge branch 'master' of address@hidden:/srv/git/savane-cleanup/framework


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

commit c194d8b1e63484dbb7dbbb53a03c0e335a34e959
Merge: e9c149f 1dfeb3d
Author: Sylvain Beucler <address@hidden>
Date:   Mon Jun 22 20:44:59 2009 +0200

    Merge branch 'master' of address@hidden:/srv/git/savane-cleanup/framework


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

commit e9c149f910b3289dab4811174f2d8f2b383b41d9
Merge: 51d6c09 0d73775
Author: Sylvain Beucler <address@hidden>
Date:   Tue Jun 16 20:29:30 2009 +0200

    Merge branch 'master' of address@hidden:/srv/git/savane-cleanup/framework


http://git.savannah.gnu.org/cgit/savane-cleanup/framework.git/commit/?id=51d6c09e92f5ce921e54cf0d3db44102686cd654

commit 51d6c09e92f5ce921e54cf0d3db44102686cd654
Merge: 6ca0b6f 4eea87f
Author: Sylvain Beucler <address@hidden>
Date:   Sat Jun 13 18:40:42 2009 +0200

    Merge branch 'master' of address@hidden:/srv/git/savane-cleanup/framework


http://git.savannah.gnu.org/cgit/savane-cleanup/framework.git/commit/?id=6ca0b6f460550ae080cd9be12a713ad5b097bd3f

commit 6ca0b6f460550ae080cd9be12a713ad5b097bd3f
Author: Sylvain Beucler <address@hidden>
Date:   Mon May 25 00:00:42 2009 +0200

    Complete setup instructions and add Apache draft

diff --git a/INSTALL b/INSTALL
index 3da0766..ea2ced8 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,35 +1,95 @@
 * Directory Description
 
-savane directory containts all the python(django) code.
+- 'savane/' directory containts all the python(django) code.
 
-media all the css and images
+- 'media/' all the css and images
 
-template all the templates that are necessary to run savane
+- 'template/' all the templates that are necessary to run savane
 
 
 * Debian Packages
 
-mysql-server
-python-mysqldb
-python-django
+apt-get install mysql-server python-django python-mysqldb 
+
 
 * Install process
 
+You will need to create the mysql user:
 
-You will need to create the mysql user (fill? )
+  mysql -e "CREATE DATABASE savane DEFAULT CHARACTER SET utf8;"
+  mysql -e "GRANT ALL PRIVILEGES ON savane.* TO 'savane' IDENTIFIED BY 
'yourpass';"
 
 Edit the the file savane/settings.py and edit:
-
-SAVANE_ROOT to the proper absolute path of your savane installed
-
 DATABASE_USER, DATABASE_PASSWORD, DATABASE_HOST to the proper data
 needed to connect to the MySQL database.
 
 
-* Run
+* Run for testing:
 
 You can test your install using:
  $ python manage.py runserver
 
 
-
+* Run with Apache (to be tested):
+
+** Dedicated server:
+
+  <Location "/">
+    SetHandler python-program
+    PythonHandler django.core.handlers.modpython
+    SetEnv DJANGO_SETTINGS_MODULE savane.settings
+    #PythonOption django.root /myapp
+    PythonDebug On
+    PythonPath "['/var/www/framework/savane/'] + sys.path"
+  </Location>
+  <Location "/media">
+    SetHandler None
+  </Location>
+  <Location "/css">
+    SetHandler None
+  </Location>
+  <Location "/images">
+    SetHandler None
+  </Location>
+  Alias /media 
/usr/share/python-support/python-django/django/contrib/admin/media
+  Alias /css /var/www/framework/media/css
+  Alias /images /var/www/framework/media/images
+ 
+** FCGI + suExec (shared hosting):
+
+apt-get install libapache2-mod-fcgid
+(_not_ mod-fastcgi which is non-free)
+
+httpd.conf:
+
+  DocumentRoot /var/www/framework/savane
+  SuexecUserGroup myuser mygroup
+ 
+  Alias /media 
/usr/share/python-support/python-django/django/contrib/admin/media
+  Alias /css /var/www/framework/media/css
+  Alias /images /var/www/framework/media/images
+ 
+  <Directory "/var/www/framework/savane">
+    RewriteEngine On
+    RewriteRule ^/(media.*)$ /$1 [QSA,L]
+    RewriteCond %{REQUEST_FILENAME} !-f
+    RewriteRule ^(.*)$ savane.fcgi/$1 [QSA,L]
+  </Directory>
+ 
+ 
+savane.fcgi:
+
+#!/usr/bin/python
+import sys, os
+ 
+# Add a custom Python path.
+sys.path.insert(0, "/var/www/framework/savane")
+ 
+# Switch to the directory of your project. (Optional.)
+# os.chdir("/home/user/myproject")
+ 
+# Set the DJANGO_SETTINGS_MODULE environment variable.
+os.environ['DJANGO_SETTINGS_MODULE'] = "savane.settings"
+ 
+from django.core.servers.fastcgi import runfastcgi
+runfastcgi(method="threaded", daemonize="false")

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

Summary of changes:
 INSTALL                                            |   88 +++++++++++++++++---
 migrate_old_savane.sql                             |   23 +++++-
 savane/main/models.py                              |    3 -
 savane/main/urls.py                                |   36 ++++++--
 savane/main/views.py                               |   13 ---
 savane/{savane_user => my}/__init__.py             |    0
 savane/{savane_user => my}/admin.py                |    2 +-
 savane/my/models.py                                |   53 ++++++++++++
 savane/my/urls.py                                  |   43 ++++++++++
 savane/{savane_user => my}/views.py                |   65 ++++++---------
 savane/savane_user/backend.py                      |   20 -----
 savane/savane_user/models.py                       |   23 -----
 savane/savane_user/urls.py                         |   24 ------
 savane/settings.py                                 |   10 +--
 savane/urls.py                                     |   47 ++++++++--
 template/base.html                                 |    9 +-
 template/error.html                                |    5 +
 .../index.html => registration/login.html}         |    3 +-
 template/savane_user/conf.html                     |    6 +-
 template/savane_user/index.html                    |   10 +--
 template/savane_user/resume_skill.html             |    6 +-
 template/savane_user/ssh_gpg.html                  |    6 +-
 22 files changed, 310 insertions(+), 185 deletions(-)
 delete mode 100644 savane/main/models.py
 delete mode 100644 savane/main/views.py
 rename savane/{savane_user => my}/__init__.py (100%)
 rename savane/{savane_user => my}/admin.py (58%)
 create mode 100644 savane/my/models.py
 create mode 100644 savane/my/urls.py
 rename savane/{savane_user => my}/views.py (82%)
 delete mode 100644 savane/savane_user/backend.py
 delete mode 100644 savane/savane_user/models.py
 delete mode 100644 savane/savane_user/urls.py
 create mode 100644 template/error.html
 copy template/{savane_user/index.html => registration/login.html} (80%)


hooks/post-receive
-- 
Savane-cleanup framework




reply via email to

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