def forms():
 from s3 import S3XForms
 if (request.env.request_method != 'GET'):
  raise HTTP(405, current.ERROR.BAD_METHOD)
 args = request.args
 if len(args):
  tablename = args[0]
  if ('.' in tablename):
   (tablename, extension) = tablename.split('.', 1)
  else:
   extension = 'xhtml'
  try:
   (prefix, name) = tablename.split('_', 1)
  except ValueError:
   raise HTTP(404, current.error.BAD_RESOURCE)
  method = [('xform.%s' % extension)]
  if (len(args) > 1):
   method.insert(0, args[1])
  r = s3_request(prefix, name, args=method, extension=None)
  r.set_handler('xform', S3XForms)
  output = r()
 else:
  xforms = S3XForms.formlist()
  if (not xforms):
   raise HTTP(404, current.T('No XForms configured on this server'))
  formlist = TAG.forms()
  for (url, title) in xforms:
   formlist.append(TAG.form(title, _url=url))
  response.headers['Content-Type'] = 'text/xml'
  response.view = 'xforms/formlist.xml'
  output = {'formlist': formlist}
 return output

def forms ( ) : from s3 import S3XForms if ( request . env . request_method != 'GET' ) : raise HTTP ( 405 , current . ERROR . BAD_METHOD ) args = request . args if len ( args ) : tablename = args [ 0 ] if ( '.' in tablename ) : ( tablename , extension ) = tablename . split ( '.' , 1 ) else : extension = 'xhtml' try : ( prefix , name ) = tablename . split ( '_' , 1 ) except ValueError : raise HTTP ( 404 , current . error . BAD_RESOURCE ) method = [ ( 'xform.%s' % extension ) ] if ( len ( args ) > 1 ) : method . insert ( 0 , args [ 1 ] ) r = s3_request ( prefix , name , args = method , extension = None ) r . set_handler ( 'xform' , S3XForms ) output = r ( ) else : xforms = S3XForms . formlist ( ) if ( not xforms ) : raise HTTP ( 404 , current . T ( 'No XForms configured on this server' ) ) formlist = TAG . forms ( ) for ( url , title ) in xforms : formlist . append ( TAG . form ( title , _url = url ) ) response . headers [ 'Content-Type' ] = 'text/xml' response . view = 'xforms/formlist.xml' output = { 'formlist' : formlist } return output
controller to download a list of available forms .