Beispiel #1
0
 def get(self):
     upload_url = blobstore.create_upload_url("/upload")
     render_html(self,
                 "add_form.html",
                 u"Nahrát vědce",
                 u"",
                 template_values={"upload_url": upload_url})
Beispiel #2
0
    def get(self):
        idlist = self.request.arguments()
        if len(idlist) == 1:
            id = int(idlist[0])
            dbrec = ResultItem.get_by_id(id)
            if type(dbrec) is ResultItem:
                benchinfo = json.loads(dbrec.benchInfo)
                glinfo = json.loads(dbrec.glInfo)
                glcontext = json.loads(dbrec.glContextInfo)
                gllimits = collections.OrderedDict(sorted(glinfo['Limits'].items()))
                deviceInfo = json.loads(dbrec.deviceInfo)

                render_html(self, "detail.html", get_platform_css(self.request.headers['User-Agent']),
                            u"gles3mark result detail", u'',
                            template_values={
                                "db": dbrec,
                                "bench": benchinfo,
                                "gl": glinfo,
                                "gllimits": gllimits,
                                "glcontext": glcontext,
                                "device": deviceInfo})
            else:
                self.response.write("Result with this id does not exist")
        else:
            self.response.write("No id specified")
Beispiel #3
0
 def get(self):
     scientists = Scientist.query().order(Scientist.birth_date).fetch()
     render_html(self, "list.html", u"Česká věda",
                 u"Zde je seznam. Pokud jste tu kvůli "
                 u"<a href='https://www.youtube.com/watch?v=WesbPh601dc'>videu</a>, "
                 u"možná vás bude zajímat "
                 u"<a href='https://github.com/filiph/app-engine-ukazka'>kód</a>.",
                 template_values={"scientists": scientists})
Beispiel #4
0
 def get(self):
     scientists = Scientist.query().order(Scientist.birth_date).fetch()
     render_html(
         self,
         "list.html",
         u"Česká věda", u"Zde je seznam. Pokud jste tu kvůli "
         u"<a href='https://www.youtube.com/watch?v=WesbPh601dc'>videu</a>, "
         u"možná vás bude zajímat "
         u"<a href='https://github.com/filiph/app-engine-ukazka'>kód</a>.",
         template_values={"scientists": scientists})
Beispiel #5
0
    def get(self):
        result = u"<p>Behold autocomplete stuff:</p>"
        autocompleter = Autocompleter()
        query = self.request.get('q', default_value=u"Tolkien")
        suggestions = autocompleter.get_results(query)
        result += u"<pre>"
        for suggestion in suggestions:
            assert isinstance(suggestion, BookRecord)
            result += u"{} - {} ({})\n".format(suggestion.author, suggestion.title, suggestion.year)
        result += u"</pre>"

        render_html(self, "admin_generic.html", u"Testing BQ",
                    result)
Beispiel #6
0
    def get(self):
        result = u"<p>Behold autocomplete stuff:</p>"
        autocompleter = Autocompleter()
        query = self.request.get('q', default_value=u"Tolkien")
        suggestions = autocompleter.get_results(query)
        result += u"<pre>"
        for suggestion in suggestions:
            assert isinstance(suggestion, BookRecord)
            result += u"{} - {} ({})\n".format(suggestion.author,
                                               suggestion.title,
                                               suggestion.year)
        result += u"</pre>"

        render_html(self, "admin_generic.html", u"Testing BQ", result)
Beispiel #7
0
 def get(self):
     render_html(self, "admin_welcome.html", u"Tisíc knih admin",
                 u"<p>Vítej, poutníče!</p>",
                 template_values={"links": [
                     ("Test BigQuery", "/admin/test/bq/"),
                     ("Test Autocomplete", "/admin/test/autocomplete/"),
                     ("Update Autocomplete From BigQuery",
                      '/admin/update_autocomplete/'),
                     ("Consolidate data downloaded from BigQuery",
                      '/admin/update_autocomplete/consolidate_only'),
                     ("Delete all books", '/admin/delete/books'),
                     ("Delete all suggestions", '/admin/delete/suggestions'),
                     ("Delete index", '/admin/delete/index'),
                     ("Update annotations from CSV", '/admin/update_annotations/')
                 ]})
Beispiel #8
0
    def get(self):
        result = u"<p>Behold a query from BigQuery:</p>"
        bq = BigQueryClient()
        job = bq.create_query_job("SELECT author FROM [mlp.tituly] "
                                  "WHERE NOT author CONTAINS '0' LIMIT 1000")
        json = job.execute()
        result += u"<pre>"
        result += u"{}".format(json)
        result += u"</pre>"
        table = BigQueryTable(json)
        for row in table.data:
            result += u"<p>{}</p>".format(row[0])
        # for row in json['rows']:
        #     result += u"<p>{}</p>".format(row['f'][0]['v'])

        render_html(self, "admin_generic.html", u"Testing BQ", result)
Beispiel #9
0
 def get(self):
     fragment = self.request.get('_escaped_fragment_')
     if not fragment:
         # TODO: put into memory
         with open(
                 os.path.join(os.path.dirname(__file__),
                              "templates/index.html"), "r") as f:
             while True:
                 output = f.read()
                 if output == "":
                     break
                 self.response.write(output)
         return
     item_ids = None
     fragment = urllib.unquote(fragment)
     if not '=' in fragment:
         fragment = urllib.unquote(fragment)
         if not '=' in fragment:
             self.error(400)
             self.response.out.write(u"Bad request")
             return
     item_ids = fragment.split('=')[1]
     item_ids = item_ids.replace('-', '|')
     if not VALID_ITEM_IDS.match(item_ids):
         self.error(400)
         logging.info("Tried to get escaped fragment for item_id={}".format(
             item_ids))
         return
     key = ndb.Key(SuggestionsRecord, item_ids)
     suggestions = key.get()
     if not suggestions or not suggestions.completed:
         self.redirect('/')
         return
     values = get_jinja_template_values(suggestions)
     # This is hacky. Should encode/decode path after hash bang?
     values["url"] = self.request.url.replace("?_escaped_fragment_=", "#!")
     # TODO: add the following when whe know that the book has image @ mlp.cz
     # first_id_string = "{:010d}".format(int(item_ids.split("|")[0]))
     # values["img"] = "http://web2.mlp.cz/koweb/{}/{}/{}/{}/Small.{}.jpg"\
     #     .format(
     #         first_id_string[0:2],
     #         first_id_string[2:4],
     #         first_id_string[4:6],
     #         first_id_string[6:8],
     #         first_id_string[8:],
     #     )
     render_html(self, "crawler.html", "", "", template_values=values)
Beispiel #10
0
 def get(self):
     fragment = self.request.get('_escaped_fragment_')
     if not fragment:
         # TODO: put into memory
         with open(os.path.join(os.path.dirname(__file__), "templates/index.html"), "r") as f:
             while True:
                 output = f.read()
                 if output == "":
                     break
                 self.response.write(output)
         return
     item_ids = None
     fragment = urllib.unquote(fragment)
     if not '=' in fragment:
         fragment = urllib.unquote(fragment)
         if not '=' in fragment:
             self.error(400)
             self.response.out.write(u"Bad request")
             return
     item_ids = fragment.split('=')[1]
     item_ids = item_ids.replace('-', '|')
     if not VALID_ITEM_IDS.match(item_ids):
         self.error(400)
         logging.info("Tried to get escaped fragment for item_id={}"
                      .format(item_ids))
         return
     key = ndb.Key(SuggestionsRecord, item_ids)
     suggestions = key.get()
     if not suggestions or not suggestions.completed:
         self.redirect('/')
         return
     values = get_jinja_template_values(suggestions)
     # This is hacky. Should encode/decode path after hash bang?
     values["url"] = self.request.url.replace("?_escaped_fragment_=", "#!")
     # TODO: add the following when whe know that the book has image @ mlp.cz
     # first_id_string = "{:010d}".format(int(item_ids.split("|")[0]))
     # values["img"] = "http://web2.mlp.cz/koweb/{}/{}/{}/{}/Small.{}.jpg"\
     #     .format(
     #         first_id_string[0:2],
     #         first_id_string[2:4],
     #         first_id_string[4:6],
     #         first_id_string[6:8],
     #         first_id_string[8:],
     #     )
     render_html(self, "crawler.html", "", "", template_values=values)
Beispiel #11
0
    def get(self):
        result = u"<p>Behold a query from BigQuery:</p>"
        bq = BigQueryClient()
        job = bq.create_query_job("SELECT author FROM [mlp.tituly] "
                                  "WHERE NOT author CONTAINS '0' LIMIT 1000")
        json = job.execute()
        result += u"<pre>"
        result += u"{}".format(json)
        result += u"</pre>"
        table = BigQueryTable(json)
        for row in table.data:
            result += u"<p>{}</p>".format(row[0])
        # for row in json['rows']:
        #     result += u"<p>{}</p>".format(row['f'][0]['v'])


        render_html(self, "admin_generic.html", u"Testing BQ",
                    result)
Beispiel #12
0
 def get(self):
     render_html(self,
                 "admin_welcome.html",
                 u"Tisíc knih admin",
                 u"<p>Vítej, poutníče!</p>",
                 template_values={
                     "links":
                     [("Test BigQuery", "/admin/test/bq/"),
                      ("Test Autocomplete", "/admin/test/autocomplete/"),
                      ("Update Autocomplete From BigQuery",
                       '/admin/update_autocomplete/'),
                      ("Consolidate data downloaded from BigQuery",
                       '/admin/update_autocomplete/consolidate_only'),
                      ("Delete all books", '/admin/delete/books'),
                      ("Delete all suggestions",
                       '/admin/delete/suggestions'),
                      ("Delete index", '/admin/delete/index'),
                      ("Update annotations from CSV",
                       '/admin/update_annotations/')]
                 })
Beispiel #13
0
 def get(self):
     results = ResultItem.query().order(-ResultItem.score).order(ResultItem.date).fetch()
     render_html(self, 'main.html', get_platform_css(self.request.headers['User-Agent']), u"gles3mark result database",
                 self.request.headers['User-Agent'], template_values={"results": results})
Beispiel #14
0
 def get(self):
     upload_url = blobstore.create_upload_url("/upload")
     render_html(self, "add_form.html", u"Nahrát vědce", u"",
                 template_values={"upload_url": upload_url})