def post(self): hunt_name = self.request.get('hunt-name') hunt = Hunt.all().filter('name =', hunt_name).get() if not hunt: hunt = Hunt(name=hunt_name, owner=self.user) hunt.put() self.redirect('/hunt/%s' % hunt.key().id())
def post(self): hunt_name = self.request.get("hunt-name") hunt = Hunt.all().filter("name =", hunt_name).filter("owner =", self.user).get() if not hunt: hunt = Hunt(name=hunt_name, owner=self.user) hunt.put() self.redirect("/hunt/%s" % hunt.key().id())
def main(argv): hunt = Hunt() try: opts, args = getopt.getopt(argv, "t:", ["type="]) except getopt.GetoptError: printHelpAndExit() requests = {} log_type = "apache_access" # Iterate through options for opt, arg in opts: if opt == "-h": printHelpAndExit() elif opt in ("-t", "--type"): log_type = arg for line in sys.stdin: event = parseLine(line, log_type) if event != None: event_obj = Event(event['remote_host'], event['time_received'], event['request_header_user_agent'], event['request_url'], event['status'], event['response_bytes_clf'], event['request_method'], event['request_http_ver']) hunt.addEvent(event_obj) hunt.start() hunt.displayResults()
def get_hunt_by_id(hunt_id): '''Fetch the hunt given an id string''' try: hunt_id = int(hunt_id) except ValueError: return None return Hunt.get_by_id(hunt_id)
def get(self): hunts = list(Hunt.all().filter('owner =', self.user)) self.response.out.write(utils.render('templates/index.html', {'hunts': hunts}))
from Hunt import Hunt urlHunting = Hunt() urlHunting.hunt()
def get(self): user = users.get_current_user() hunts = [] if user: hunts = list(Hunt.all().filter('owner =', user)) self.response.out.write(utils.render('templates/index.html', {'hunts': hunts}))
def get(self): hunts = list(Hunt.all().filter("owner =", self.user)) self.response.out.write(utils.render("templates/index.html", {"hunts": hunts}))