예제 #1
0
 def GET_check_inventory(self, responder, sr, location, start, end):
     sr = sr or Frontpage
     if not location or not location.country:
         available = inventory.get_available_pageviews(sr, start, end,
                                                       datestr=True)
     else:
         available = inventory.get_available_pageviews_geotargeted(sr,
                         location, start, end, datestr=True)
     return {'inventory': available}
예제 #2
0
 def GET_check_inventory(self, responder, sr, location, start, end):
     sr = sr or Frontpage
     if not location or not location.country:
         available = inventory.get_available_pageviews(sr, start, end,
                                                       datestr=True)
     else:
         available = inventory.get_available_pageviews_geotargeted(sr,
                         location, start, end, datestr=True)
     return {'inventory': available}
예제 #3
0
 def GET_check_inventory(self, responder, sr, location, start, end):
     sr = sr or Frontpage
     if not location or not location.country:
         available = inventory.get_available_pageviews(sr, start, end,
                                                       datestr=True)
     elif sr == Frontpage or c.user_is_sponsor:
         available = inventory.get_available_pageviews_geotargeted(sr,
                         location, start, end, datestr=True)
     else:
         return abort(403, 'forbidden')
     return {'inventory': available}
예제 #4
0
 def GET_check_inventory(self, responder, sr, location, start, end):
     sr = sr or Frontpage
     if not location or not location.country:
         available = inventory.get_available_pageviews(sr, start, end,
                                                       datestr=True)
     elif sr == Frontpage or c.user_is_sponsor:
         available = inventory.get_available_pageviews_geotargeted(sr,
                         location, start, end, datestr=True)
     else:
         return abort(403, 'forbidden')
     return {'inventory': available}
예제 #5
0
    def GET_check_inventory(self, responder, sr, collection, location, start,
                            end):
        if collection:
            target = Target(collection)
            sr = None
        else:
            sr = sr or Frontpage
            target = Target(sr.name)

        if not allowed_location_and_target(location, target):
            return abort(403, 'forbidden')

        available = inventory.get_available_pageviews(
                        target, start, end, location=location, datestr=True)

        return {'inventory': available}
예제 #6
0
    def GET_check_inventory(self, responder, sr, collection, location, start,
                            end):
        if collection:
            target = Target(collection)
            sr = None
        else:
            sr = sr or Frontpage
            target = Target(sr.name)

        if not allowed_location_and_target(location, target):
            return abort(403, 'forbidden')

        available = inventory.get_available_pageviews(
                        target, start, end, location=location, datestr=True)

        return {'inventory': available}
예제 #7
0
    def GET_check_inventory(self, responder, sr, collection, location, start, end):
        if collection:
            target = Target(collection)
            sr = None
        else:
            sr = sr or Frontpage
            target = Target(sr.name)

        if not location or not location.country:
            available = inventory.get_available_pageviews(target, start, end, datestr=True)
        elif not collection and (sr == Frontpage or c.user_is_sponsor):
            # geotargeting is available on the Frontpage for all users or on
            # individual subreddits for sponsors
            available = inventory.get_available_pageviews_geotargeted(sr, location, start, end, datestr=True)
        else:
            return abort(403, "forbidden")
        return {"inventory": available}
예제 #8
0
    def GET_check_inventory(self, responder, sr, collection, location, start,
                            end):
        if collection:
            target = Target(collection)
            sr = None
        else:
            sr = sr or Frontpage
            target = Target(sr.name)

        if not location or not location.country:
            available = inventory.get_available_pageviews(
                target, start, end, datestr=True)
        elif not collection and (sr == Frontpage or c.user_is_sponsor):
            # geotargeting is available on the Frontpage for all users or on
            # individual subreddits for sponsors
            available = inventory.get_available_pageviews_geotargeted(sr,
                            location, start, end, datestr=True)
        else:
            return abort(403, 'forbidden')
        return {'inventory': available}
예제 #9
0
 def GET_check_inventory(self, responder, sr, start, end):
     sr = sr or Frontpage
     available_by_datestr = inventory.get_available_pageviews(sr, start, end,
                                                              datestr=True)
     return {'inventory': available_by_datestr}