示例#1
0
 def _create_error(self, keys):
     if not c.solarSystem:
         c.solarSystem = c.eve.solarsystem_name
     if isinstance(c.solarSystem, m.SolarSystem):
         c.solarSystem = c.solarSystem.solarSystemName
     
     return render('/reports/new.mako')
示例#2
0
    def plot(self):
        c.from_system = self._get_system(request.GET.get("fr"))
        c.to_system = self._get_system(request.GET.get("to"))
        c.avoid = list()
        c.systems = system_names
        
        for a in request.GET.get("avoid", "").split(","):
            s = self._get_system(a)
            if not s: continue
            c.avoid.append(s.solarSystemID)

        c.sec_low = None
        c.sec_high = None

        if "lowest" in request.GET:
            try:
                c.sec_low = float(request.GET.get("lowest"))
            finally:
                pass
        
        if "highest" in request.GET:
            try:
                c.sec_high = float(request.GET.get("highest"))
            finally:
                pass
        
        if c.from_system and c.to_system:
            c.route = list(find_route(c.from_system, c.to_system, c.avoid, c.sec_low, c.sec_high))
            c.no_route = (len(c.route) == 0)
        else:
            c.route = []
            c.no_route = True

        return render('/travel/plot.mako')
示例#3
0
    def new(self):
        if not c.solarSystem:
            c.solarSystem = c.eve.solarsystem_name
        else:
            c.solarSystem = c.solarSystem.solarSystemName

        return render('/reports/new.mako')
示例#4
0
 def index(self, format='html'):
     """GET /hashes: All items in the collection"""
     # url('hashes')
     c.hashes = m.Session.query(m.Hash)
     if c.q:
         c.hashes = c.hashes.filter(m.Hash.name.like(c.q + "%"))
     c.page = paginate.Page(c.hashes, page=c.page, items_per_page=c.c, c=c.c)
     return render("/hashes/index.mako")
示例#5
0
 def index(self, format='html'):
     """GET /solarsystems: All items in the collection"""
     # url('solarsystems')
     c.solarsystems = m.Session.query(m.SolarSystem).order_by(m.SolarSystem.solarSystemName)
     if c.q:
         c.solarsystems = c.solarsystems.filter(m.SolarSystem.solarSystemName.like(c.q + "%"))
     c.page = paginate.Page(c.solarsystems, page=c.page, items_per_page=c.c, c=c.c, q=c.q)
     return render("/solarsystems/index.mako")
示例#6
0
    def show(self, id, format='html'):
        """GET /hashes/id: Show a specific item"""
        # url('hash', id=ID)
        c.hash = m.Hash.get(id).first()
        if not c.hash:
            c.hash = m.Hash.by_name(id).first()
        if not c.hash:
            return abort(404)

        return render('/hashes/show.mako')
示例#7
0
 def show(self, id, format='html'):
     """GET /solarsystems/id: Show a specific item"""
     if id == "current" and c.eve.trusted:
         c.solarsystem = m.SolarSystem.by_name(c.eve.solarsystem_name).first()
         if c.solarsystem:
             return redirect(url.current(id=c.solarsystem.solarSystemID))
     
     c.solarsystem = m.SolarSystem.get(id).first()
     
     if not c.solarsystem:
         abort(404)
     
     c.reports = m.Report.by_solarsystem(c.solarsystem).all()
     return render('/solarsystems/show.mako')
示例#8
0
    def travel(self):
        query = request.GET.get("q", "None")

        try:
            c.ts = model.Session.query(model.SolarSystem).filter(solarSystemID=int(query)).first()
        except:
            pass
        
        if not hasattr(c, "ts"):
            c.ts = model.Session.query(model.SolarSystem).filter(model.SolarSystem.solarSystemName.like(query + "%")).first()
        
        if c.ts:
            c.route = list(find_route(c.ss, c.ts))
            c.systems = systems
            return render('/travel.mako')
        
        return "Travel to " + str(c.ts);
示例#9
0
    def show(self, id):
        c.report = m.Report.get(id).first();

        if not c.report:
            return abort(404)

        c.text = ""
        
        for t,p in reports.tokenize_report(c.report.text):
            if t == reports.Map:
                s = m.SolarSystem.by_name(p).first()
                if not s:
                    c.text += "[no such system '" + p + "']"
                else:
                    c.text += h.link_to(s.solarSystemName, url('solarsystem',id=s.solarSystemID))
            elif t == reports.Hash:
                c.text += h.link_to("#" + p, url('hash', id=p))
            else:
                c.text += p
        
        return render('/reports/show.mako')
示例#10
0
 def help(self):
     return render('/main/help.mako')
示例#11
0
 def index(self):
     return render('/main/index.mako')
示例#12
0
 def signin(self):
     c.alliances = self._py_object.app_globals.alliances
     if not c.name: c.name = c.eve.char_name;
     c.path_before_login = session.get("path_before_login", self.default_path)
     return render('/auth/signin.mako')
示例#13
0
 def index(self):
     c.reports = m.Report.by_created().limit(25).all()
     return render('/reports/index.mako')
示例#14
0
 def index(self):
     # Return a rendered template
     #return render('/where.mako')
     # or, return a string
     return render('/where.mako')
示例#15
0
 def index(self):
     return render('/travel/index.mako')