def get(self,img_key):
     
     images_store = ImagesStore()
     images_store = images_store.get_by_key_name(img_key)
     images_store.display = False
     images_store.put()
     self.redirect("/")
     self.response.out.write(True)
 def get(self):
     images_store = ImagesStore()
     all_digits = {}
     for j in range(10):
         all_digits[j] = self.getnumbers(images_store.all().filter("digit =", j).filter("display =", True))
     result = simplejson.dumps(all_digits)
     
     self.response.headers['Content-Type'] = 'application/json'
     self.response.out.write(result)
 def get(self):
     self.response.out.write("<html><body>")
     self.response.out.write("<p>Loading all numbers from Exquisite Clock</p>")
     self.response.out.write("</body></html>")
     
     images_store = ImagesStore()
     jsonobject = jsonfetcher.get_json()
     
     for n in range(0, 10):
         for x in jsonobject[str(n)]:
             if len(x.get("URL")) != 0: 
                 keyname = x.get("URL")[:-4]
                 images_store.get_or_insert(keyname, display=True,new=False,digit= n,url=x.get("URL"))             
    def get(self):
        #print ""
        #print settings.env_vars["JSON_PATH"]
        
        images_store = ImagesStore()

        # get page
        curr_page = self.request.get('page')
        display_digit = self.request.get('digit')
        
        # page var
        if curr_page == '':
            curr_page = 1
        else:
            curr_page = int(curr_page)

        # handle digit var
        if display_digit == '':
            display_digit = 0
        else:
            display_digit = int(display_digit)

        next_page = int(curr_page) + 1
        prev_page = int(curr_page) + 1
                    
        # new numbers  
        new_numbers = images_store.all().filter('new =', True)
        
        # old numbers
        old_numbers_query = images_store.all().filter('new =', False).filter('digit =',display_digit)
        old_numbers_pagedQuery = PagedQuery(old_numbers_query,PAGESIZE)
        old_numbers = old_numbers_pagedQuery.fetch_page(curr_page)
        
        template_values = {
            'curr_digit' : display_digit,
            'has_nextpage' : old_numbers_pagedQuery.has_page(next_page),
            'curr_page' : curr_page,
            'prev_page' : prev_page,
            'next_page' : next_page,
            'total_pages' : xrange(1,old_numbers_pagedQuery.page_count()+1,1),
            'new_numbers' : new_numbers,
            'base_url' : settings.env_vars["IMAGE_PATH"],
            'preview_url' : settings.env_vars["LARGE_IMAGE_PATH"],
            'current_domain' : settings.env_vars["BASE_URL"],
            'old_numbers' : old_numbers,
        }
        
        path = os.path.join(os.path.dirname(__file__), 'index.html')
        self.response.out.write(template.render(path, template_values))
 def get(self):
     self.response.out.write("<html><body>")
     self.response.out.write("<p>Loading recent numbers from Exquisite Clock !</p>")
     self.response.out.write("</body></html>")
     
     new_numbers = 0
     
     images_store = ImagesStore() 
     
     response = urllib.urlopen(settings.env_vars["JSON_PATH"])
     content = response.read()
     json_output = simplejson.loads(content)
     
     print ''
     # Parse JSON and populate datastore
     for n in range(0, 10):
         for x in json_output[str(n)]:
             if x.has_key("N"):
                 print "One New Number",x
                 new_numbers = new_numbers+1
                 keyname = x.get("URL")[:-4]
                 images_store.get_or_insert(keyname, display=False,new=True,digit= n,url=x.get("URL"))
     if new_numbers > 0:
         send_mail()