mango r225 - in branches/django: . mango
- From: ovitters svn gnome org
- To: svn-commits-list gnome org,gnome-sysadmin gnome org
- Subject: mango r225 - in branches/django: . mango
- Date: Sun, 22 Jun 2008 18:03:24 +0000 (UTC)
Author: ovitters
Date: Sun Jun 22 18:03:24 2008
New Revision: 225
URL: http://svn.gnome.org/viewvc/mango?rev=225&view=rev
Log:
* mango/views.py (get_xmldoc): Hard code the logged in user to me for
now.
Modified:
branches/django/ (props changed)
branches/django/ChangeLog
branches/django/mango/views.py
Modified: branches/django/mango/views.py
==============================================================================
--- branches/django/mango/views.py (original)
+++ branches/django/mango/views.py Sun Jun 22 18:03:24 2008
@@ -14,20 +14,32 @@
def get_xmldoc(title, request):
- doc = ET.ElementTree(ET.Element('page', {
+ pagenode = ET.Element('page', {
'title': title,
'mode': settings.MANGO_CFG['mode'],
'baseurl': settings.MANGO_CFG['base_url'],
'thisurl': request.path,
'token': "afd0e0d9eab69ab904c7a43f6bd3810156f0afc9", # TODO: generate token
'support': settings.MANGO_CFG['support_email'],
- }))
+ })
+ doc = ET.ElementTree(pagenode)
# TODO:
# - determine if user is logged in, if so:
# add user details to XML
+ filter = ldap.filter.filter_format('(&(objectClass=posixAccount)(uid=%s))', ('ovitters',))
+ users = models.Users.search(filter)
+ if len(users) == 1:
+ user = users[0]
+
+ usernode = ET.SubElement(pagenode, 'user')
+ node = ET.SubElement(usernode, 'cn')
+ node.text = user.cn
+
+ for group in user.groups:
+ node = ET.SubElement(pagenode, 'group', {'cn': group.cn})
- return doc, doc.getroot()
+ return doc, pagenode
def get_xmlresponse(doc, template, response=None):
if response is None:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]