예제 #1
0
def get_businesses(owner = cousers.get_current_user(), limit = None):
    results = Business.all()
    results.filter("owner =", owner)
    
    if limit:
        results.filter("limit", limit)
    
    return results
예제 #2
0
파일: auth.py 프로젝트: alexhughson/copilot
 def check_auth(self, *args, **kwargs):
     user = cousers.get_current_user()
     if user:
         return fn(self, user=user, *args, **kwargs)
     elif required:
         forward_to = self.request.url
         self.redirect(clean_redirect(AUTH_LOGIN_URI + "?forward_to=" + forward_to))
         return False
     else:
         return fn(self, user=None, *args, **kwargs)
예제 #3
0
파일: auth.py 프로젝트: alexhughson/copilot
    def receive_from_google(self):
        """Page called after logging in through Google"""

        forward_to = self.request.get("forward_to")
        if not forward_to:
            forward_to = DEFAULT_PAGE

        user = cousers.get_current_user()
        if not user:
            self.redirect(AUTH_LOGIN_URI)

        self.redirect(clean_redirect(forward_to))
예제 #4
0
def get_messages(to = cousers.get_current_user(), limit = None, send_date_start = None, send_date_end = None, unread_only = False):
    
    results = Messages.all()
    results.filter("to =", to)

    #TODO return to fill out filters once messages are being sent.
    if limit:
        pass

    if send_date_start:
        pass
        
    if send_date_end:
        pass
    
    if unread_only == True:
        results.filter("read =", not unread_only)
        
    return results
예제 #5
0
def create_business():
    owner = cousers.get_current_user()
    new_business = Business(owner = owner, registered_date = int(time.time()))
    new_business.put()
    return new_business
예제 #6
0
def send_message(to, body, send_date = time.time(), sender = cousers.get_current_user(), subject = None):
    #msg = Messages(to, sender, body, send_date, subject)
    #msg.put()
    return ""#msg
예제 #7
0
파일: auth.py 프로젝트: alexhughson/copilot
 def get_current_user(self):
     """AJAX request to get the current user details"""
     user = cousers.get_current_user()
     self.response.out.write(cousers.to_json(user))