示例#1
0
文件: host.py 项目: timhberry/simian
  def get(self, uuid=None):
    """GET handler."""
    if uuid:
      uuid = util.UrlUnquote(uuid)
    else:
      self.response.set_status(httplib.NOT_FOUND)
      return

    computer = models.Computer.get_by_key_name(uuid)
    if not computer:
      self.response.set_status(httplib.NOT_FOUND)
      return

    self_report = bool(auth.DoUserAuthWithSelfReportFallback(
        constrain_username=computer.owner))

    self._DisplayHost(computer, self_report)
示例#2
0
 def get(self, uuid=None):
     """GET handler."""
     if uuid:
         uuid = util.UrlUnquote(uuid)
     auth.DoUserAuth()
     self._DisplayHost(uuid=uuid)
示例#3
0
 def testUrlUnquote(self):
     """Test UrlUnquote()."""
     self.assertEqual(util.UrlUnquote('foo'), 'foo')
     self.assertEqual(util.UrlUnquote('foo%2F'), 'foo/')
     self.assertEqual(util.UrlUnquote('foo<ohcrap>'), 'foo<ohcrap>')