Ejemplo n.º 1
0
    def GET(self):
        from util import AntiFraud
        input = web.input()
        rooms = input.get("rooms", "")
        rooms = rooms.replace(" ", "+")

        analyses = handler.filteredAnalyses(web)
        analyses = AntiFraud.getWithoutDuplicities(analyses)

        longLegend = "(%s)" % len(analyses)
        legend = ""
        if rooms:
            analyses = [a for a in analyses if a["rooms"].startswith(rooms)]
            groupCounts = viewer.getGroupCounts(analyses)
            longLegend = ", ".join("%s (%s)" % pair for pair in groupCounts)
            legend = ", ".join(pair[0] for pair in groupCounts)

        property = "price"
        unit = 100000
        minMax = (1*10**6, 4*10**6)
        dataJs1, maxCount1 = viewer.getHistogramDataJs(analyses, property,
                unit, legend=legend, minMax=minMax)

        minMax = (4*10**6, 7*10**6)
        dataJs2, maxCount2 = viewer.getHistogramDataJs(analyses, property,
                unit, legend=legend, minMax=minMax)

        maxCount = max(10, maxCount1, maxCount2)
        print formatter.page("histogram", _(u"Histogram of Prague Homes"),
            type="withFilter")(dataJs1, dataJs2, maxCount, longLegend)
Ejemplo n.º 2
0
 def GET(self):
     scale = ColorScale.unitPriceScale
     colors = []
     for x in range(ColorScale.UNIT_PRICE_SCALE_MAX,
             ColorScale.UNIT_PRICE_SCALE_MIN - 1, -10000):
         name = str(x)
         colors.append((name, "%02x%02x%02x" % scale.getRgb(x)))
     print formatter.page("scale", _(u"Color scale of prices"))(colors)
Ejemplo n.º 3
0
    def GET(self):
        from util import AntiFraud
        analyses = handler.filteredAnalyses(web)
        analyses = AntiFraud.getWithoutDuplicities(analyses)
        timeline = charter.getTimeline(analyses)
        motionDataJs = formatter.RENDER.motionData(timeline)

        print formatter.page("chart", _(u"Chart of home prices in Prague"),
            type="withFilter")(motionDataJs)
Ejemplo n.º 4
0
    def GET(self):
        input = web.input(limit=100)
        limit = handler.validN(input.limit)
        analyses = handler.filteredAnalyses(web, limit)
        days = lister.getListingByDays(analyses)

        ungettext = _.im_self.ungettext
        counting = ungettext(u"Showing one home.", u"Showing %(count)s homes.",
                    len(analyses)) % {"count": len(analyses)}
        print formatter.page("item_list", _(u"Latest home offers in Prague"),
                type="withFilter")(days, counting)
Ejemplo n.º 5
0
    def showTemplate(self, pageName, title, extraHead=None):
        pageTemplate = formatter.page(pageName, title, extraHead)

        def outputer(*args, **kwargs):
            self.show(pageTemplate(*args, **kwargs))

        return outputer
Ejemplo n.º 6
0
    def GET(self):
        sight = None
        input = web.input()
        homeUrl = input.get("byt")
        if homeUrl:
            homeUrl = homeUrl.replace(" ", "+")
            analyses = handler.filteredAnalyses(web)
            for analysis in analyses:
                if analysis["url"] == homeUrl:
                    sight = MapFormatter.createSight(analysis)
                    break
            else:
                logging.info("No such home: %r", homeUrl)

        print formatter.page("map", _(u"Map of Prague homes"),
                type="withFilter toggleFilter")(
                        config.MAP_KEY, locality.GEO_BOUNDS, sight)
Ejemplo n.º 7
0
    def GET(self):
        input = web.input(path="/byty")
        path = input.path
        handler.knowParsedFilter(web)

        perColumn = 5
        localityColumns = []
        index = 0
        ncols = len(locality.LOCALITY_CHOICES) // perColumn
        if len(locality.LOCALITY_CHOICES) % perColumn != 0:
            ncols += 1
        for col in range(ncols):
            localityColumns.append([])
            for choice in locality.LOCALITY_CHOICES[index:index+perColumn]:
                localityColumns[-1].append((index, choice))
                index += 1

        print formatter.page("preferences", _(u"Preferences"))(
                path, localityColumns)
Ejemplo n.º 8
0
 def GET(self):
     print formatter.page("index", _(u"Search for preferred home in Prague"))()
Ejemplo n.º 9
0
 def GET(self):
     print formatter.page("info", _(u"About the website"))()
Ejemplo n.º 10
0
 def _producePage(self):
     dataJs1, lastCounts = viewer.getTimeAvgsDataJs()
     dataJs2, lastCounts = viewer.getTimeAvgsDataJs(showCounts=True)
     return formatter.page("view", _(u"Exploratory Visualization")
             )(dataJs1, dataJs2, lastCounts)