diff options
author | Leif Johansson <leifj@sunet.se> | 2012-10-02 22:23:54 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2012-10-02 22:23:54 +0200 |
commit | ec839d583fff6b279c7cdec2fdf87762f81f9aa5 (patch) | |
tree | 912507bfc3353ba076ae225a8d40ba14f57d2972 /src/meetingtools | |
parent | 2346efdb58afff79fcfc1d581b0091f32ee6fac1 (diff) |
- bootstrap
- cleanup
- bugfixes
Diffstat (limited to 'src/meetingtools')
-rw-r--r-- | src/meetingtools/ac/api.py | 3 | ||||
-rw-r--r-- | src/meetingtools/apps/auth/views.py | 11 | ||||
-rw-r--r-- | src/meetingtools/apps/cluster/models.py | 4 | ||||
-rw-r--r-- | src/meetingtools/apps/room/forms.py | 13 | ||||
-rw-r--r-- | src/meetingtools/extensions/templatetags/datehumanize.py | 1 |
5 files changed, 19 insertions, 13 deletions
diff --git a/src/meetingtools/ac/api.py b/src/meetingtools/ac/api.py index f2a7fb2..5fbcfbf 100644 --- a/src/meetingtools/ac/api.py +++ b/src/meetingtools/ac/api.py @@ -3,6 +3,7 @@ Created on Jan 31, 2011 @author: leifj ''' +from StringIO import StringIO import httplib2 from urllib import quote_plus @@ -148,7 +149,7 @@ class ACPClient(): p = self._find_or_create_principal(key,value,t,d) cache[key] = etree.tostring(p) else: - p = etree.parse(cache[key]) + p = etree.parse(StringIO(cache[key])) return p def find_principal(self,key,value,t): diff --git a/src/meetingtools/apps/auth/views.py b/src/meetingtools/apps/auth/views.py index 4ce8162..e294b0c 100644 --- a/src/meetingtools/apps/auth/views.py +++ b/src/meetingtools/apps/auth/views.py @@ -120,6 +120,10 @@ def accounts_login_federated(request): #profile.lastupdated = datetime.datetime.now() profile.save() + next = request.session.get("after_login_redirect", None) + if not next and request.GET.has_key('next'): + next = request.GET['next'] + acc = acc_for_user(request.user) with ac_api_client(request) as api: # make sure the principal is created before shooting off @@ -154,12 +158,9 @@ def accounts_login_federated(request): # group = connect_api.find_or_create_principal('name',e,'group',{'type': 'group','has-children':'1','name': e}) # if group: # connect_api.add_remove_member(principal.get('principal-id'),group.get('principal-id'),True) - - next = request.session.get("after_login_redirect", None) - if not next and request.GET.has_key('next'): - next = request.GET['next'] + if next is not None: return redirect_to(next) else: pass - return redirect_to("/") + return redirect_to(next) diff --git a/src/meetingtools/apps/cluster/models.py b/src/meetingtools/apps/cluster/models.py index 7b59771..3c65d57 100644 --- a/src/meetingtools/apps/cluster/models.py +++ b/src/meetingtools/apps/cluster/models.py @@ -30,6 +30,6 @@ def acc_for_user(user): domain = "nordu.net" # testing with local accts only for acc in ACCluster.objects.all(): for regex in acc.domain_match.split(): - if re.match(regex,domain): + if re.match(regex.strip(),domain): return acc - raise Exception,"I don't know which cluster you belong to... (%s)" % user.username
\ No newline at end of file + raise Exception,"I don't know which cluster you belong to... (%s)" % user.username diff --git a/src/meetingtools/apps/room/forms.py b/src/meetingtools/apps/room/forms.py index 79daeb3..62b515b 100644 --- a/src/meetingtools/apps/room/forms.py +++ b/src/meetingtools/apps/room/forms.py @@ -5,7 +5,7 @@ Created on Feb 1, 2011 ''' from meetingtools.apps.room.models import Room -from django.forms.widgets import Select, TextInput, RadioSelect +from django.forms.widgets import Select, TextInput, RadioSelect, Textarea from django.forms.fields import BooleanField, ChoiceField, CharField from django.forms.forms import Form from form_utils.forms import BetterModelForm @@ -22,16 +22,18 @@ class PrefixTextInput(TextInput): self.prefix = prefix def render(self, name, value, attrs=None): - return mark_safe("<b>"+self.prefix+"</b> "+super(PrefixTextInput, self).render(name, value, attrs)) + return mark_safe("<div class=\"input-prepend\"><span class=\"add-on\">"+self.prefix+"</span>"+ + super(PrefixTextInput, self).render(name, value, attrs)+"</span></div>") class ModifyRoomForm(ModelForm): class Meta: model = Room fields = ['name','description','source_sco_id','self_cleaning','allow_host'] widgets = {'source_sco_id': Select(), + 'description': Textarea(attrs={'rows': 4, 'cols': 50}), 'name': TextInput(attrs={'size': '40'})} - - + + class CreateRoomForm(BetterModelForm): access = ChoiceField(choices=(('public','Public'),('private','Private'))) @@ -69,7 +71,8 @@ class CreateRoomForm(BetterModelForm): }), ] widgets = {'access': RadioSelect(), - 'urlpath': PrefixTextInput(attrs={'size': '15'}), + 'urlpath': PrefixTextInput(attrs={'size': '10'}), + 'description': Textarea(attrs={'rows': 4, 'cols': 50}), 'name': TextInput(attrs={'size': '40'})} class DeleteRoomForm(Form): diff --git a/src/meetingtools/extensions/templatetags/datehumanize.py b/src/meetingtools/extensions/templatetags/datehumanize.py index 9570612..9b75cae 100644 --- a/src/meetingtools/extensions/templatetags/datehumanize.py +++ b/src/meetingtools/extensions/templatetags/datehumanize.py @@ -15,6 +15,7 @@ def datehumanize(value): from datetime import datetime if isinstance(value, datetime): + value = value.replace(tzinfo=None) delta = datetime.now() - value if delta.days > 6: return value.strftime("on %b %d") # May 15 |