def get(self):
        user = users.get_current_user()
        if user:
            subscriptions = CompanySubscription.all()
            logoutUrl = users.create_logout_url("/")

            appUser = User.all()\
                .filter('openid =', user.federated_identity()).get()
            if appUser == None:
                appUser = User.all()\
                    .filter('email =', user.email()).get()
            if appUser:
                sub = appUser.subscription
                appUsers = User.all().filter('subscription = ', sub)
                template_values = { 'appUser' : appUser, \
                                        'companyName' : sub.name, \
                                        'edition' : sub.edition, \
                                        'appUsers' : appUsers, \
                                        'logoutUrl' : logoutUrl }
                path = os.path.join(os.path.dirname(__file__), 'index.html')
                self.response.out.write(template.render(path, template_values))
            else:
                # Send the user to AppDirect to purchase the app
                self.redirect(appDirectLink)
        else:
            # Log this user in
            self.redirect(
                users.create_login_url("https://www.appdirect.com/openid/id"))
 def get(self):
     user = users.get_current_user()
     if user:
         subscriptions = CompanySubscription.all()
         logoutUrl = users.create_logout_url("/")
         
         appUser = User.all()\
             .filter('openid =', user.federated_identity()).get()
         if appUser == None:
             appUser = User.all()\
                 .filter('email =', user.email()).get()
         if appUser:
             sub = appUser.subscription
             appUsers = User.all().filter('subscription = ', sub)
             template_values = { 'appUser' : appUser, \
                                     'companyName' : sub.name, \
                                     'edition' : sub.edition, \
                                     'appUsers' : appUsers, \
                                     'logoutUrl' : logoutUrl }
             path = os.path.join(os.path.dirname(__file__), 'index.html')
             self.response.out.write(template.render(path, template_values))
         else:
             # Send the user to AppDirect to purchase the app
             self.redirect(appDirectLink)
     else:
         # Log this user in
         self.redirect(users.create_login_url("https://www.appdirect.com/openid/id"))
示例#3
0
def GetSubscription(accountIdentifier):
    subscription = None
    try:
        subscription = CompanySubscription.get_by_id(int(accountIdentifier))
        logging.info("Found subscription: %s", accountIdentifier)
    except ValueError:
        logging.error("Bad account identifier %s" % accountIdentifier)
    except BadArgumentError:
        logging.error("Bad account identifier %s" % accountIdentifier)
    return subscription
def GetSubscription(accountIdentifier):
    subscription = None
    try:
        subscription = CompanySubscription.get_by_id(int(accountIdentifier))
        logging.info("Found subscription: %s", accountIdentifier)
    except ValueError:
        logging.error("Bad account identifier %s" % accountIdentifier)
    except BadArgumentError:
        logging.error("Bad account identifier %s" % accountIdentifier)
    return subscription
示例#5
0
文件: main.py 项目: sweis/fake-isv
 def get(self):
     user = users.get_current_user()
     if user:
         subscriptions = CompanySubscription.all()
         logoutUrl = users.create_logout_url("/")
         appUsers = User.all()
         template_values = { 'subscriptions' : subscriptions, \
                                 'users' : appUsers, \
                                 'logoutUrl' : logoutUrl }
         path = os.path.join(os.path.dirname(__file__), 'index.html')
         self.response.out.write(template.render(path, template_values))
     else:
         self.redirect(users.create_login_url("https://www.appdirect.com/openid/id"))
 def CreateSubscription(self):
     companySubscription = CompanySubscription()
     companySubscription.edition = self.order.edition
     companySubscription.name = self.company.name
     companySubscription.website = self.company.website
     return companySubscription
 def CreateSubscription(self):
     companySubscription = CompanySubscription()
     companySubscription.edition = self.order.edition
     companySubscription.name = self.company.name
     companySubscription.website = self.company.website
     return companySubscription