Package gluon :: Module yapo_builder
[hide private]
[frames] | no frames]

Module yapo_builder

source code

Functions [hide private]
 
parse_field(f) source code
 
build_model(yapo, path='./', dbname='db') source code
 
build_crud(yapo, path='./') source code
 
build_main(yapo, path='./') source code
 
build_app(name)
>> build_app(TEST)
source code
Variables [hide private]
  CRUD = '\n\n\ndef list(table):\n a=request.vars.start or 0\n...
  MAIN_LIST_VIEW = '{{extend \'layout.html\'}}{{=XML(list(\'tabl...
  CRUD_LIST_VIEW = '\n<h1>Table %(name)s</h1>\n[{{=A(\'create ne...
  MAIN_CREATE_VIEW = '{{extend \'layout.html\'}}{{=XML(create(\'...
  CRUD_CREATE_VIEW = '\n<h1>Create new %(name)s</h1>\n{{=form}}\n'
  MAIN_READ_VIEW = '{{extend \'layout.html\'}}{{=XML(read(\'tabl...
  CRUD_READ_VIEW = '\n<h1>Read %(name)s</h1>\n<table>\n{{for fie...
  MAIN_EDIT_VIEW = '{{extend \'layout.html\'}}{{=XML(edit(\'tabl...
  CRUD_EDIT_VIEW = '<h1>Update %(name)s</h1>{{=form}}'
  MAIN_DELETE_VIEW = '{{extend \'layout.html\'}}{{=XML(delete(\'...
  CRUD_DELETE_VIEW = '\n<h1>Delete %(name)s</h1>\nare you sure y...
  TEST = '\nuri: sqlite://test.db\nname: test\nauthor: Mass...
Variables Details [hide private]

CRUD

Value:
'''


def list(table):
   a=request.vars.start or 0
   b=request.vars.stop or a+25
   orderby=request.vars.orderby or db[table].fields[0] ### UNSAFE FIX
   items=db(db[table].id>0).select(orderby=orderby,limitby=(a,b+1))
...

MAIN_LIST_VIEW

Value:
'{{extend \'layout.html\'}}{{=XML(list(\'table_%(name)s\'))}}'

CRUD_LIST_VIEW

Value:
'''
<h1>Table %(name)s</h1>
[{{=A(\'create new %(name)s\',_href=URL(r=request,f=\'create_table_%(n\
ame)s\'))}}]
[[[ add pagination ]]]
{{if not len(items):}}
<h2>No %(name)s in database yet</h2>
{{else:}}
...

MAIN_CREATE_VIEW

Value:
'{{extend \'layout.html\'}}{{=XML(create(\'table_%(name)s\'))}}'

MAIN_READ_VIEW

Value:
'{{extend \'layout.html\'}}{{=XML(read(\'table_%(name)s\',request.args\
[0]))}}'

CRUD_READ_VIEW

Value:
'''
<h1>Read %(name)s</h1>
<table>
{{for field in db.table_%(name)s.exposed:}}
  <tr>
  <td>{{=db.table_%(name)s.labels[field]}}:</td>
  <td><b>{{=item[field]}}</b></td>
  </tr>
...

MAIN_EDIT_VIEW

Value:
'{{extend \'layout.html\'}}{{=XML(edit(\'table_%(name)s\',request.args\
[0]))}}'

MAIN_DELETE_VIEW

Value:
'{{extend \'layout.html\'}}{{=XML(delete(\'table_%(name)s\',request.ar\
gs[0]))}}'

CRUD_DELETE_VIEW

Value:
'''
<h1>Delete %(name)s</h1>
are you sure you want to delete this record?
{{=A(\'yes\',_href=URL(r=request,args=request.args,vars=dict(confirm=\\
'yes\')))}} or
{{=A(\'no\',_href=URL(r=request,args=request.args,vars=dict(confirm=\'\
no\')))}}
'''

TEST

Value:
'''
uri:    sqlite://test.db
name:   test
author: Massimo Di Pierro
model:
    client:
        name unique
        email
...