Esempio n. 1
0
 def save(self):
     from microblogging.utils import get_twitter_password
     update_other_services(self.user,
         twitter_user = self.cleaned_data['username'],
         twitter_password = get_twitter_password(settings.SECRET_KEY, self.cleaned_data['password']),
     )
     self.user.message_set.create(message=ugettext(u"Successfully authenticated."))
Esempio n. 2
0
 def save(self):
     from zwitschern.pownce_utils import get_pownce_password
     update_other_services(self.user,
         pownce_user = self.cleaned_data['usernamep'],
         pownce_password = get_pownce_password(settings.SECRET_KEY, self.cleaned_data['passwordp']),
     )
     self.user.message_set.create(message=ugettext(u"Successfully authenticated."))
Esempio n. 3
0
 def save(self):
     from microblogging.utils import get_twitter_password
     update_other_services(
         self.user,
         twitter_user=self.cleaned_data["username"],
         twitter_password=get_twitter_password(
             settings.SECRET_KEY, self.cleaned_data["password"]),
     )
Esempio n. 4
0
 def save(self):
     from zwitschern.pownce_utils import get_pownce_password
     update_other_services(
         self.user,
         pownce_user=self.cleaned_data['usernamep'],
         pownce_password=get_pownce_password(
             settings.SECRET_KEY, self.cleaned_data['passwordp']),
     )
     self.user.message_set.create(
         message=ugettext(u"Successfully authenticated."))
Esempio n. 5
0
 def save(self):
     from microblogging.utils import get_twitter_password
     update_other_services(
         self.user,
         twitter_user=self.cleaned_data['username'],
         twitter_password=get_twitter_password(
             settings.SECRET_KEY, self.cleaned_data['password']),
     )
     self.user.message_set.create(
         message=ugettext(u"Successfully authenticated."))
Esempio n. 6
0
def generate():
    for user in User.objects.all():
        account, created = Account.objects.get_or_create(user = user,
            defaults=dict(
                timezone = random.choice(COMMON_TIMEZONE_CHOICES)[0],
                language = random.choice(settings.LANGUAGES)[0],
            ),
        )
        update_other_services(user, **dict(
            blogrss=random.choice(RSS_FEEDS),
        ))
        print "Created User Account: %s" % (account,)
Esempio n. 7
0
File: views.py Progetto: braskin/pd
def authsub_login(request):    
    if "token" in request.GET:
        request.session["authsub_token"] = request.GET["token"]
        
        update_other_services(request.user, gcal=request.GET["token"])
        token = request.GET["token"]

#        calendar_service = gdata.calendar.service.CalendarService()
#        calendar_service.SetAuthSubToken(token)
#        calendar_service.auth_token = token
#        calendar_service.UpgradeToSessionToken()
#        feed = calendar_service.GetCalendarListFeed()
#        for i, a_calendar in enumerate(feed.entry):

        return render_to_response("schedule/gcal.html", RequestContext(request, { 'token':request.GET["token"]}))

    calendar_service = CalendarService()
    authsub_url = calendar_service.GenerateAuthSubURL(request.build_absolute_uri(), GOOGLE_CALENDAR_URI, False, True)

    return HttpResponseRedirect(authsub_url)
Esempio n. 8
0
def authsub_login(request):
    if "token" in request.GET:
        request.session["authsub_token"] = request.GET["token"]

        update_other_services(request.user, gcal=request.GET["token"])
        token = request.GET["token"]

        #        calendar_service = gdata.calendar.service.CalendarService()
        #        calendar_service.SetAuthSubToken(token)
        #        calendar_service.auth_token = token
        #        calendar_service.UpgradeToSessionToken()
        #        feed = calendar_service.GetCalendarListFeed()
        #        for i, a_calendar in enumerate(feed.entry):

        return render_to_response(
            "schedule/gcal.html",
            RequestContext(request, {'token': request.GET["token"]}))

    calendar_service = CalendarService()
    authsub_url = calendar_service.GenerateAuthSubURL(
        request.build_absolute_uri(), GOOGLE_CALENDAR_URI, False, True)

    return HttpResponseRedirect(authsub_url)
Esempio n. 9
0
 def save(self):
     from microblogging.utils import get_twitter_password
     update_other_services(self.user,
         twitter_user = self.cleaned_data["username"],
         twitter_password = get_twitter_password(settings.SECRET_KEY, self.cleaned_data["password"]),
     )
Esempio n. 10
0
def websites(request):
    if request.method == 'POST':
        webs = request.POST.get('websites', '')
        update_other_services(request.user, websites=webs)
    return HttpResponse(webs)
Esempio n. 11
0
def profile(request, username, template_name="profiles/profile.html", extra_context=None,t=""):
    
    if t:
	template_name= t
	print t

    if extra_context is None:
        extra_context = {}
    
    other_user = get_object_or_404(User, username=username)
    update_other_services(request.user,stalk=username)
    #area = mining.cass.get_user_field(other_user,"area")

    if request.user.is_authenticated():
        is_friend = Friendship.objects.are_friends(request.user, other_user)
        other_friends = Friendship.objects.friends_for_user(other_user)
        if request.user == other_user:
            is_me = True
        else:
            is_me = False
    else:
        other_friends = []
        is_friend = False
        is_me = False
    
    if is_friend:
        invite_form = None
        previous_invitations_to = None
        previous_invitations_from = None
        if request.method == "POST":
            if request.POST.get("action") == "remove": # @@@ perhaps the form should just post to friends and be redirected here
                Friendship.objects.remove(request.user, other_user)
                request.user.message_set.create(message=_("You have removed %(from_user)s from friends") % {'from_user': other_user})
                is_friend = False
                invite_form = InviteFriendForm(request.user, {
                    'to_user': username,
                    'message': ugettext("Let's be friends!"),
                })
    
    else:
        if request.user.is_authenticated() and request.method == "POST":
            if request.POST.get("action") == "invite": # @@@ perhaps the form should just post to friends and be redirected here
                invite_form = InviteFriendForm(request.user, request.POST)
                if invite_form.is_valid():
                    invite_form.save()
            else:
                invite_form = InviteFriendForm(request.user, {
                    'to_user': username,
                    'message': ugettext("Let's be friends!"),
                })
                invitation_id = request.POST.get("invitation", None)
                if request.POST.get("action") == "accept": # @@@ perhaps the form should just post to friends and be redirected here
                    try:
                        invitation = FriendshipInvitation.objects.get(id=invitation_id)
                        if invitation.to_user == request.user:
                            invitation.accept()
                            request.user.message_set.create(message=_("You have accepted the friendship request from %(from_user)s") % {'from_user': invitation.from_user})
                            is_friend = True
                            other_friends = Friendship.objects.friends_for_user(other_user)
                    except FriendshipInvitation.DoesNotExist:
                        pass
                elif request.POST.get("action") == "decline": # @@@ perhaps the form should just post to friends and be redirected here
                    try:
                        invitation = FriendshipInvitation.objects.get(id=invitation_id)
                        if invitation.to_user == request.user:
                            invitation.decline()
                            request.user.message_set.create(message=_("You have declined the friendship request from %(from_user)s") % {'from_user': invitation.from_user})
                            other_friends = Friendship.objects.friends_for_user(other_user)
                    except FriendshipInvitation.DoesNotExist:
                        pass
        else:
            invite_form = InviteFriendForm(request.user, {
                'to_user': username,
                'message': ugettext("Let's be friends!"),
            })
    
    previous_invitations_to = FriendshipInvitation.objects.invitations(to_user=other_user, from_user=request.user)
    previous_invitations_from = FriendshipInvitation.objects.invitations(to_user=request.user, from_user=other_user)
    
    return render_to_response(template_name, dict({
        "is_me": is_me,
        #"area": area,
        "is_friend": is_friend,
        "other_user": other_user,
        "other_friends": other_friends,
        "invite_form": invite_form,
        "previous_invitations_to": previous_invitations_to,
        "previous_invitations_from": previous_invitations_from,
    }, **extra_context), context_instance=RequestContext(request))