parameters: (self, path=None, getsize=true, req=None)
docstring: Returns a JSON object containing information about the given file.
docstring_summary: Returns a JSON object containing information about the given file.
docstring_tokens: Returns a JSON object containing information about the given file .
function: def getinfo(self, path=None, getsize=true, req=None):
          """Returns a JSON object containing information about the given file."""
  
          if not self.isvalidrequest(path,req):
              return (self.patherror, None, 'application/json')
  
          thefile = {
              'Filename' : split_path(path)[-1],
              'File Type' : '',
              'Preview' : path if split_path(path)[-1] else 'images/fileicons/_Open.png',
              'Path' : path,
              'Error' : '',
              'Code' : 0,
              'Properties' : {
                      'Date Created' : '',
                      'Date Modified' : '',
                      'Width' : '',
                      'Height' : '',
                      'Size' : ''
                  }
              }
              
          imagetypes = set('gif','jpg','jpeg','png')
          
      
          if not path_exists(path):
              thefile['Error'] = 'File does not exist.'
              return (encode_json(thefile), None, 'application/json')
          
          
          if split_path(path)[-1]=='/':
              thefile['File Type'] = 'Directory'
          else:
              thefile['File Type'] = split_ext(path)
              
              if ext in imagetypes:
                  img = Image(path).size()
                  thefile['Properties']['Width'] = img[0]
                  thefile['Properties']['Height'] = img[1]
                  
              else:
                  previewPath = 'images/fileicons/' + ext.upper + '.png'
                  thefile['Preview'] = previewPath if path_exists('../../' + previewPath) else 'images/fileicons/default.png'
          
          thefile['Properties']['Date Created'] = os.path.getctime(path) 
          thefile['Properties']['Date Modified'] = os.path.getmtime(path) 
          thefile['Properties']['Size'] = os.path.getsize(path)
  
          req.content_type('application/json')
          req.write(encode_json(thefile))
function_tokens: def getinfo ( self , path = None , getsize = true , req = None ) : if not self . isvalidrequest ( path , req ) : return ( self . patherror , None , 'application/json' ) thefile = { 'Filename' : split_path ( path ) [ - 1 ] , 'File Type' : '' , 'Preview' : path if split_path ( path ) [ - 1 ] else 'images/fileicons/_Open.png' , 'Path' : path , 'Error' : '' , 'Code' : 0 , 'Properties' : { 'Date Created' : '' , 'Date Modified' : '' , 'Width' : '' , 'Height' : '' , 'Size' : '' } } imagetypes = set ( 'gif' , 'jpg' , 'jpeg' , 'png' ) if not path_exists ( path ) : thefile [ 'Error' ] = 'File does not exist.' return ( encode_json ( thefile ) , None , 'application/json' ) if split_path ( path ) [ - 1 ] == '/' : thefile [ 'File Type' ] = 'Directory' else : thefile [ 'File Type' ] = split_ext ( path ) if ext in imagetypes : img = Image ( path ) . size ( ) thefile [ 'Properties' ] [ 'Width' ] = img [ 0 ] thefile [ 'Properties' ] [ 'Height' ] = img [ 1 ] else : previewPath = 'images/fileicons/' + ext . upper + '.png' thefile [ 'Preview' ] = previewPath if path_exists ( '../../' + previewPath ) else 'images/fileicons/default.png' thefile [ 'Properties' ] [ 'Date Created' ] = os . path . getctime ( path ) thefile [ 'Properties' ] [ 'Date Modified' ] = os . path . getmtime ( path ) thefile [ 'Properties' ] [ 'Size' ] = os . path . getsize ( path ) req . content_type ( 'application/json' ) req . write ( encode_json ( thefile ) )