mango r227 - in branches/django: . mango
- From: ovitters svn gnome org
- To: svn-commits-list gnome org,gnome-sysadmin gnome org
- Subject: mango r227 - in branches/django: . mango
- Date: Sun, 22 Jun 2008 18:03:28 +0000 (UTC)
Author: ovitters
Date: Sun Jun 22 18:03:28 2008
New Revision: 227
URL: http://svn.gnome.org/viewvc/mango?rev=227&view=rev
Log:
* mango/models.py (Foundationmembers, FtpmirrorsForm,
FtpmirrorsForm.Meta, Users.groups, Users.add_to_xml): Correct the
Foundationmembers model. Add a FoundationmembersForm. Lastly, add a
add_to_xml function to the Users model.
* mango/urls.py: Change accounts URL to requests. Also add the
list_foundationmembers view.
* mango/views.py (list_foundationmembers): Show foundation member
details. Far from fully working.
Modified:
branches/django/ (props changed)
branches/django/ChangeLog
branches/django/mango/models.py
branches/django/mango/urls.py
branches/django/mango/views.py
Modified: branches/django/mango/models.py
==============================================================================
--- branches/django/mango/models.py (original)
+++ branches/django/mango/models.py Sun Jun 22 18:03:28 2008
@@ -39,10 +39,10 @@
db_table = u'account_groups'
class Foundationmembers(models.Model):
- id = models.IntegerField(primary_key=True)
- firstname = models.CharField(max_length=150, blank=True)
- lastname = models.CharField(max_length=150, blank=True)
- email = models.CharField(max_length=300, blank=True)
+ id = models.AutoField(primary_key=True)
+ firstname = models.CharField(max_length=50, blank=True)
+ lastname = models.CharField(max_length=50, blank=True)
+ email = models.EmailField(max_length=255, blank=True)
comments = models.TextField(blank=True)
first_added = models.DateField()
last_renewed_on = models.DateField(null=True, blank=True)
@@ -51,6 +51,10 @@
class Meta:
db_table = u'foundationmembers'
+class FtpmirrorsForm(ModelForm):
+ class Meta:
+ model = Foundationmembers
+
class Ftpmirrors(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=60, blank=True)
@@ -165,3 +169,20 @@
self._groups = UserGroups.search('(memberUid=%s)' % self.__dict__['uid'])
return self._groups
+
+ def add_to_xml(ET, formnode):
+ for item in ('uid', 'cn', 'mail', 'description'):
+ node = ET.SubElement(formnode, item)
+ node.text = user.__dict__.get(item, '')
+
+ for key in user.__dict__.get('authorizedKey', []):
+ # TODO:
+ # - add fingerprint of above keys
+ if key:
+ node = ET.SubElement(formnode, 'authorizedKey')
+ node.text = key
+
+ for group in user.groups:
+ node = ET.SubElement(formnode, 'group', {'cn': group.cn})
+
+
Modified: branches/django/mango/urls.py
==============================================================================
--- branches/django/mango/urls.py (original)
+++ branches/django/mango/urls.py Sun Jun 22 18:03:28 2008
@@ -1,16 +1,17 @@
from django.conf.urls.defaults import *
-from mango.views import current_datetime, list_users, test_index, list_accounts, edit_user, list_mirrors, edit_mirror
+from mango.views import current_datetime, list_users, test_index, list_accounts, edit_user, list_mirrors, edit_mirror, list_foundationmembers
import mango.settings
urlpatterns = patterns('',
(r'^%stime/$' % mango.settings.SITE_ROOT, current_datetime),
(r'^%susers/$' % mango.settings.SITE_ROOT, list_users),
+ (r'^%susers/edit/(?P<user>\w+)/$' % mango.settings.SITE_ROOT, edit_user),
(r'^%stest/$' % mango.settings.SITE_ROOT, test_index),
- (r'^%saccounts/$' % mango.settings.SITE_ROOT, list_accounts),
+ (r'^%srequests/$' % mango.settings.SITE_ROOT, list_accounts),
(r'^%smirrors/$' % mango.settings.SITE_ROOT, list_mirrors),
(r'^%smirrors/edit/(?P<pk>\d+)/$' % mango.settings.SITE_ROOT, edit_mirror),
- (r'^%susers/edit/(?P<user>\w+)/$' % mango.settings.SITE_ROOT, edit_user),
+ (r'^%sfoundationmembers/$' % mango.settings.SITE_ROOT, list_foundationmembers),
# Example:
# (r'^mango/', include('mango.foo.urls')),
Modified: branches/django/mango/views.py
==============================================================================
--- branches/django/mango/views.py (original)
+++ branches/django/mango/views.py Sun Jun 22 18:03:28 2008
@@ -176,4 +176,19 @@
return get_xmlresponse(doc, "update_ftpmirror.xsl")
+def list_foundationmembers(request):
+ doc, root = get_xmldoc('List Foundation Members', request)
+ el1 = ET.SubElement(root, 'listfoundationmembers')
+
+ members = models.Foundationmembers.objects.all()
+ for member in members:
+ membernode = ET.SubElement(el1, 'foundationmember')
+ membernode.set('id', unicode(member.id))
+ for field in ('firstname', 'lastname', 'comments', 'email'):
+ node = ET.SubElement(membernode, field)
+ node.text = getattr(member, field)
+ ET.SubElement(membernode, 'id').text = unicode(member.id)
+
+ return get_xmlresponse(doc, "list_foundationmembers.xsl")
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]