Example #1
0
    def post(self):
        cw_profile = ExUserInfo.gql('WHERE user_id = :1', self.user.user_id).get()
        self.user.firstname = self.request.get('firstname').capitalize()
        self.user.lastname = self.request.get('lastname').capitalize()
        self.user.realname = self.user.firstname + ' ' + self.user.lastname
#
#        
#        cw_profile.email = self.request.get('email')
        cw_profile.website = self.request.get('website')
        cw_profile.location = self.request.get('location')
        cw_profile.expertise = self.request.get_all('expertise')
        
        photo = self.request.get('photo')
        if photo:
            if conf.WEB_SERVER == 'http://credibleweb.appspot.com':
                photo = images.resize(photo, 100, 100)
            cw_profile.photo = db.Blob(photo)
            self.user.picture = '/img?img_id=%s' % cw_profile.key()
        
        self.user.put()
        cw_profile.put()
        
#       retrieve social network profiles
        fb_profile = None
        if self.user.facebook_id:
            fb_profile = FacebookProfile.gql('WHERE facebook_id = :1', self.user.facebook_id).get()
        tw_profile = None
        if self.user.twitter_id:
            tw_profile = TwitterProfile.gql('WHERE twitter_id = :1', self.user.twitter_id).get()
        self.render('profile.html',
                    cw_profile = cw_profile,
                    fb_profile = fb_profile,
                    tw_profile = tw_profile,
                    success = True)
Example #2
0
 def get(self):
     cw_profile = ExUserInfo.gql('WHERE user_id = :1', self.user.user_id).get()
     fb_profile = None
     if self.user.facebook_id:
         fb_profile = FacebookProfile.gql('WHERE facebook_id = :1', self.user.facebook_id).get()
     tw_profile = None
     if self.user.twitter_id:
         tw_profile = TwitterProfile.gql('WHERE twitter_id = :1', self.user.twitter_id).get()
     self.render('profile.html',
                 cw_profile = cw_profile,
                 fb_profile = fb_profile,
                 tw_profile = tw_profile,
                 success = False)
Example #3
0
 def get(self, id):
     m_user =  User.gql('WHERE user_id = :1', id).get()
     cw_profile = ExUserInfo.gql('WHERE user_id = :1', m_user.user_id).get()
     fb_profile = None
     if m_user.facebook_id:
         fb_profile = FacebookProfile.gql('WHERE facebook_id = :1', m_user.facebook_id).get()
     tw_profile = None
     if m_user.twitter_id:
         tw_profile = TwitterProfile.gql('WHERE twitter_id = :1', m_user.twitter_id).get()
     self.render('user_profile.html',
                 user = m_user,
                 cw_profile = cw_profile,
                 fb_profile = fb_profile,
                 tw_profile = tw_profile,
                 is_friend = self.is_friend(id))
Example #4
0
    def post(self):
        cw_profile = ExUserInfo.gql('WHERE user_id = :1',
                                    self.user.user_id).get()
        self.user.firstname = self.request.get('firstname').capitalize()
        self.user.lastname = self.request.get('lastname').capitalize()
        self.user.realname = self.user.firstname + ' ' + self.user.lastname
        #
        #
        #        cw_profile.email = self.request.get('email')
        cw_profile.website = self.request.get('website')
        cw_profile.location = self.request.get('location')
        cw_profile.expertise = self.request.get_all('expertise')

        photo = self.request.get('photo')
        if photo:
            if conf.WEB_SERVER == 'http://credibleweb.appspot.com':
                photo = images.resize(photo, 100, 100)
            cw_profile.photo = db.Blob(photo)
            self.user.picture = '/img?img_id=%s' % cw_profile.key()

        self.user.put()
        cw_profile.put()

        #       retrieve social network profiles
        fb_profile = None
        if self.user.facebook_id:
            fb_profile = FacebookProfile.gql('WHERE facebook_id = :1',
                                             self.user.facebook_id).get()
        tw_profile = None
        if self.user.twitter_id:
            tw_profile = TwitterProfile.gql('WHERE twitter_id = :1',
                                            self.user.twitter_id).get()
        self.render('profile.html',
                    cw_profile=cw_profile,
                    fb_profile=fb_profile,
                    tw_profile=tw_profile,
                    success=True)