def accessory_crud():
    """ Create a simple form using the CRUD function of web2py. """

    from gluon.tools import Crud
    crud = Crud(db)
    accessory_crud = crud.create(db.accessory)
    return locals()
def update():
    index = request.args(0)
    report = db.reports(index)
    
    if(not report):
        redirect(URL('default' , 'index'))
           
    #if(report.created_by != auth.user_id):
        #redirect(URL('default' , 'index'))
    #Initialize the widget
    add_option = SelectOrAdd(form_title="Add new Category",
                             controller="reports", 
                             function="add_category",
                             button_text = "Add New")
    #assign widget to field
    db.reports.category.widget = add_option.widget
    
    from gluon.tools import Crud
    crud = Crud(db)
    
    form = crud.update(db.reports, report)  
    form.add_button('Delete', URL('delete' , args=request.args) )
    
    if form.process().accepted:
        report = db.reports(index)
        if(not report):
            redirect(URL('default' , 'index'))
        response.flash = 'form accepted' 
    elif form.errors:
        response.flash = 'form has errors' 
    return dict(form=form, report=report)
def update_attendance():
    crud = Crud(globals(), db)
    db.attendance.patient.default = request.args(0)
    db.attendance.patient.writable = db.attendance.patient.readable = False
    db.attendance.treatment.default = request.args(1)
    db.attendance.treatment.writable = db.attendance.treatment.readable = False

    form = crud.update(db.attendance, request.args(0),
            labels={
                #'patient':'Paciente',
                #'treatment':'Tratamento',
                'care_date':'Data de atendimento',
                'pa_start':'PA Inicial',
                'spo2_start':'SPO2 Inicial',
                'bpm_start':'BPM Inicial',
                'pa_end':'PA Final',
                'spo_end':'SPO2 Final',
                'bpm_end':'BPM Final',
                'patient_owner':'Fisioterapeuta',
		'conduct':'Conduta',
                'notes':'Observações:'
                }
            )

    return dict(title='Atualizar tratamento', form=form)
def admin():

    args = request.args

    title = 'administration'

    if not args:
        link = UL(*[LI(A(tab,_href=URL(args=tab))) for tab in db.tables])
        return dict(items=link,title=title)

    if not args(1):
        i = 0
    else:
        i =1

    for tab in db.tables:
        if tab==args(i):
            tb = db[tab]

    crud = Crud(db)

    if args(0)=='edit':
        form = crud.update(tb, args(2),next=URL(f='admin',args=args(1)))
        items = None
        title = 'Edit %s ' % args(i)
    else:
        form = crud.create(tb)
        rows = db().select(tb.ALL)
        items = SQLTABLE(rows,linkto='edit')
        title = 'Insert %s ' % args(i)


    return dict(form=form,items=items,title=title)
Exemple #5
0
def add_log():
	import re
	from datetime import datetime
	from gluon.tools import Crud
	pattern = re.compile(r"""
			\[(?P<time>.*?)\]
			\s(?P<mac>[0-9A-F]{2}[:][0-9A-F]{2}[:][0-9A-F]{2}[:][0-9A-F]{2}[:][0-9A-F]{2}[:][0-9A-F]{2})
			\s(?P<more>.*)
			\s*"""
			, re.VERBOSE)
	crud = Crud(db)
	form = crud.create(db.log)
	if form.process(dbio=False).accepted:
		form.vars.log_id = db.log.insert(**dict(form.vars))
		request.vars.log_file.file.seek(0)
		count=0
		for line in request.vars.log_file.file:
			#print 'l', line
			match = pattern.findall(line)	
			if match:
				d = datetime.strptime(match[0][0], '%m/%d/%y %H:%M:%S')
				db.record.insert(log_id=form.vars.log_id, 
						station_id=form.vars.station_id,
						mac=match[0][1], 
						gathered_on=d)			
				count += 1
		session.flash = 'Inserted %s record' % count
		redirect(URL(f='index', vars={'id':form.vars.station_id}))
	return response.render('default/index.html', dict(form=form))
Exemple #6
0
def create():
	from gluon.tools import Crud

	#Hide the fields that should not be accessable by the user
	hideFields (db.game, ['host_id', 'game_status', 'password'])

	#Run the form
	#form = SQLFORM(db.game)
	#form.add_class('assassins-form')
	#form.vars.host_id=auth.user.id

	#Create the form
	crud = Crud(db)
	crud.messages.submit_button = 'Create Game'
	form = crud.create(db.game)
	form.add_class('assassins-form')
	form.vars.host_id=auth.user.id

	#When the form is submitted, add the creator as a player and go to new game
	if form.process().accepted:
		addPlayer(form.vars.id, auth.user)
		resizeImage(db.game, form.vars.id)
		redirect(URL('game', 'detail', args=form.vars.id))

	return dict(form=form)
def update_person():
    crud = Crud(globals(), db)
    form = crud.update(db.person, request.args(0),
            labels={'name':'Nome Completo',
            'born':'Data de Nascimento',
            'address':'Endereço',
            'phone':'Telefone',
            'mobile':'Celular',
            'other_phone':'Telefone (outro)',
            'doc_type':'Tipo de Documento',
            'doc_id':'Número do documento',
            'type_person':'Tipo Cadastro',
            'health_care':'Plano de Saúde',
            'doctor':'Médico ',
            'doctor_doc':'CRM do Médico',
            'name_responsable':'[Responsável] Nome',
            'born_responsable':'[Responsável] Data Nascimento',
            'phone_responsable':'[Responsável] Telefone',
            'mobile_responsable':'[Responsável] Celular',
            'email_responsable':'[Responsável] E-mail',
            'address_responsable':'[Responsável] Endereço',
            'doc_type_responsable':'[Responsável] Tipo documento (N/A se no existir responsável)',
            'doc_id_responsable':'[Responsável] Número documento',
            'notes':'Anotacoes diversas'}
            )
    return dict(title="Atualizar cadastro", form=form)
Exemple #8
0
def add_station():
	from gluon.tools import Crud
	crud = Crud(db)
	form = crud.create(db.station)
	if form.process(dbio=True).accepted:
		session.flash = 'Station added correctly'
		redirect(URL(f='index'))
	return response.render('default/index.html', dict(form=form))
def people():

    from gluon.tools import Crud
    crud = Crud(db)

    form = crud.create(db.client, next=URL('people'),message=T("record created"))
    persons = crud.select(db.client, fields=['name'],headers={'client.name': 'Name'})

    return dict(form=form, persons=persons)
def autocomplet():

    from gluon.tools import Crud
    crud = Crud(db)

    form = crud.create(db.product2, next=URL('autocomplet'),message=T("record created"))
    persons = crud.select(db.product2, fields=['category'],headers={'product2.category': 'Tipo'})

    return dict(form=form, persons=persons)
Exemple #11
0
def accessory_crud():
    """ Create a simple form using the CRUD function of web2py. """

    #aqui ele formata tudo sozinho e ainda envia para o banco sozinho também
    #mostra a mensagem de falha sozinho
    from gluon.tools import Crud
    crud = Crud(db)
    accessory_crud = crud.create(db.accessory)
    return locals()
Exemple #12
0
def crud():
    
    tablename = request.args(0)
    action = request.args(1)
    event_id = request.get_vars['eid']
    record_id = request.get_vars['id']
    
    if session.crud and session.crud.return_page:
        return_page = URL(session.crud.return_page)
        
    else:
        return_page = URL('table/' + tablename)
     
    crud = Crud(shotdb)
    crud.settings.auth = auth   # ensures access control via permissions
    crud.settings.controller = 'staff'
    crud.settings.create_next = return_page
    crud.settings.update_next = return_page
    crud.settings.update_deletable = True
    crud.settings.showid = True

    if session.crud and session.crud.fix_ref_id:
        for ref_table, ref_id in session.crud.fix_ref_id.iteritems():
            if ref_id > 0 and ref_table in shotdb[tablename]:
                    shotdb[tablename][ref_table].default = ref_id
                    shotdb[tablename][ref_table].writable = False
    
    # add event filter to drop down selectors
    if event_id != None and event_id > 0:
        if tablename == 'help':
            shotdb.help.shift.requires = IS_IN_DB(shotdb(shotdb.shift.event == event_id), 'shift.id', '%(activity)s, %(day)s, %(time)s')
        elif tablename == 'bring':
            shotdb.bring.donation.requires = IS_IN_DB(shotdb(shotdb.donation.event == event_id), 'donation.id', '%(item)s')
    
    if tablename == 'person':
        crud.settings.create_onvalidation = __create_person_onvalidation
        crud.settings.update_onvalidation = __update_person_onvalidation
        crud.settings.update_onaccept     = __update_person_onaccept
        crud.settings.update_ondelete     = __update_person_ondelete
        shotdb.person.code.writable = False
        shotdb.person.verified.writable = False
        crud.messages.record_created = None
    else:
        # default flash messages
        crud.messages.record_created = None
        crud.messages.record_updated = None
        crud.messages.record_deleted = 'Der Datenbankeintrag wurde gelöscht.'
    
    if(action == 'add'):            
        crud_response = crud.create(tablename)
    elif(action == 'edit' and record_id != None):
        crud_response = crud.update(tablename, record_id)
    else:
        crud_response = 'Nothing selected!'
    
    return dict(crud_response = crud_response)
Exemple #13
0
def index():
    """
    example action using the internationalization operator T and flash
    rendered by views/default/index.html or views/generic.html
    """
    from gluon.tools import Crud

    crud = Crud(db)

    form = crud.create(db.userskill)
    return dict(form=form)
def update_profile():
    from gluon.tools import Crud
    crud=Crud(db)
    x=auth.user.email
    table=db(db.Profile_for_others_to_see).select()
    for i in table:
        if x==i.e_mail:
            y=i.id
            break
    name=auth.user.first_name+" "+auth.user.last_name
    db.Profile_for_others_to_see.student_name.default=name
    db.Profile_for_others_to_see.student_name.writable=False
    update=crud.update(db.Profile_for_others_to_see,y)
    return locals()
def update_treatment():
    crud = Crud(globals(), db)
    db.treatment.patient.writable = db.treatment.patient.readable = False
    form = crud.update(db.treatment, request.args(0),
            labels={
                #'patient':'Paciente',
                'treatment':'Tratamento',
                'diagnosis':'Diagnóstico',
                'pathologies':'Patologias',
                'medications':'Medicamentos',
                'start_date':'Data início',
                }
            )
    return dict(title="Atualizar tratamento", form=form)
Exemple #16
0
def zuoye():
    zuozhe=auth.user_id
    keshi_id=request.args[0]
    crud=Crud(db)
    if db.zuoye((db.zuoye.zuozhe==zuozhe)&(db.zuoye.keshi==keshi_id)):
        db.zuoye.defen.writable=False
        zuoye_id=db.zuoye((db.zuoye.zuozhe==zuozhe)&(db.zuoye.keshi==keshi_id)).id
        form=crud.update(db.zuoye,zuoye_id,deletable=False,next=request.url)
        db.zuoye.defen.writable=True
    else:
        db.zuoye.zuozhe.default=zuozhe
        db.zuoye.keshi.default=keshi_id
        db.zuoye.defen.writable=False
        form=crud.create(db.zuoye,next=request.url)
      #  db.zuoye.zuozhe.default=None
        db.zuoye.keshi.default=None
        db.zuoye.defen.writable=True
    return dict(form=form)
def crudeGeral():

    from gluon.tools import Crud
    crud = Crud(db)

    form = crud.create(db.client)

    id=1

    form2 = crud.read(db.client, id)

    form3 = crud.update(db.client, id)

    form4 = crud.search(db.client)

    #form5 = SQLFORM(db.client, myrecord).process(onsuccess=auth.archive)

    #form5 = crud.update(db.mytable, myrecord, onaccept=auth.archive)

    return dict(form=form,form2=form2,form3=form3,form4=form4)
Exemple #18
0
def crud():
    tablename = request.args(0)
    action = request.args(1)
    record_id = request.get_vars['id']
    
    crud_ = Crud(shotdb)
    crud_.settings.controller  = 'config'
    crud_.settings.create_next = URL('config_event')
    crud_.settings.update_next = URL('config_event')
    crud_.settings.update_deletable = False
    crud_.settings.showid = True  
    
    if(action == 'add'):            
        crud_response = crud_.create(tablename)
    elif(action == 'edit' and record_id != None):
        crud_response = crud_.update(tablename, record_id)
    else:
        crud_response = 'Nothing selected!'
    
    return dict(crud_response = crud_response)
Exemple #19
0
def crud():
    tablename = request.args(0)
    action = request.args(1)
    id_ = request.args(2)
    
    if session.crud and session.crud.return_page:
        return_page = session.crud.return_page
    else:
        return_page = URL('admin_', 'manage_users')
    
    crud = Crud(shotdb)
    crud.settings.controller = 'admin_'
    crud.settings.create_next = return_page
    crud.settings.update_next = return_page
    crud.settings.update_deletable = True
    crud.settings.showid = True   
    
    if(action == 'add'):
        crud_response = crud.create(tablename)
        
    elif(action == 'edit' and id_ != None):
        onaccept = None
        if tablename == 'auth_user':
            shotdb['auth_user']['registration_key'].writable = True
            
        elif tablename == 'config':
            crud.settings.update_deletable = False
            shotdb['config']['name'].writable = False
            
            # update the configuration object, drop the passed argument form
            onaccept = lambda form: config.update(shotdb)

        crud_response = crud.update(tablename, id_, onaccept = onaccept)    
            
    else:
        crud_response = 'Nothing selected!'
    
    return dict(crud_response = crud_response)
Exemple #20
0
def update():
    index = request.args(0)
    report = db.reports(index)
    
    if(not report):
        redirect(URL('default' , 'index'))
           
    #if(report.created_by != auth.user_id):
        #redirect(URL('default' , 'index'))
    
    from gluon.tools import Crud
    crud = Crud(db)
    
    form = crud.update(db.reports, report)  
    form.add_button('Delete', URL('delete' , args=request.args) )
    
    if form.process().accepted:
        report = db.reports(index)
        if(not report):
            redirect(URL('default' , 'index'))
        response.flash = 'form accepted' 
    elif form.errors:
        response.flash = 'form has errors' 
    return dict(form=form, report=report)
# response.optimize_css = 'concat,minify,inline'
# response.optimize_js = 'concat,minify,inline' 

#########################################################################
## Here is sample code if you need for
## - email capabilities
## - authentication (registration, login, logout, ... )
## - authorization (role based authorization)
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
## - old style crud actions
## (more options discussed in gluon/tools.py)
#########################################################################

from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db)
crud, service, plugins = Crud(db), Service(), PluginManager()

## create all tables needed by auth if not custom tables
auth.define_tables(username=True, signature=False)

response.generic_patterns = ['*'] if request.is_local else []
response.generic_patterns = ['load']
## configure email
mail = auth.settings.mailer
mail.settings.server = 'logging' or 'mail.darwish-group.com:143'
mail.settings.sender = '*****@*****.**'
mail.settings.login = '******'

## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
Exemple #22
0
def createpost():
    from gluon.tools import Crud
    crud = Crud(db)
    form = crud.create(db.blogpost) if auth.user else None
    return dict(form=form)
Exemple #23
0
def editpage():
    this_page = db.page(request.args(0,cast=int)) or redirect(URL('index'))
    from gluon.tools import Crud
    crud = Crud(db)
    form = crud.update(db.page, this_page.id) if auth.user else None
    return dict(form=form)
Exemple #24
0
def update_test():
    from gluon.tools import Crud
    crud = Crud(db)
    return dict(form=crud.update(db.balise, request.args(0)))
Exemple #25
0
def editcomment():
    this_comment = db.comment(request.args(0,cast=int)) or redirect(URL('index'))
    from gluon.tools import Crud
    crud = Crud(db)
    form = crud.update(db.comment, this_comment.id) if auth.user else None
    return dict(form=form)
Exemple #26
0
# (more options discussed in gluon/tools.py)
# -------------------------------------------------------------------------

# host names must be a list of allowed host names (glob syntax allowed)
AUTH = Auth(DB, host_names=MYCONF.get('host.names'))
SERVICE = Service()
PLUGINS = PluginManager()

# -------------------------------------------------------------------------
# create all tables needed by AUTH if not custom tables
# -------------------------------------------------------------------------

# Auth Table Creation code moved to db_wizard.py
# because it contains references other tables

CRUD = Crud(DB)

CRUD.settings.auth = AUTH

# -------------------------------------------------------------------------
# configure email
# -------------------------------------------------------------------------
MAIL = AUTH.settings.mailer
# if request.is_local:
#     MAIL.settings.server = 'logging'
# else:
#     MAIL.settings.server = MYCONF.get('smtp.server')

MAIL.settings.server = MYCONF.get('smtp.server')

MAIL.settings.sender = MYCONF.get('smtp.sender')
Exemple #27
0
# response.optimize_css = 'concat,minify,inline'
# response.optimize_js = 'concat,minify,inline'

#########################################################################
## Here is sample code if you need for
## - email capabilities
## - authentication (registration, login, logout, ... )
## - authorization (role based authorization)
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
## - old style crud actions
## (more options discussed in gluon/tools.py)
#########################################################################

from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db)
crud, service, plugins = Crud(db), Service(), PluginManager()

auth.settings.extra_fields['auth_user'] = [
    Field('bio', 'text'),
    Field('avatar', 'reference images', default=2)
]
## create all tables needed by auth if not custom tables
auth.define_tables(username=True, signature=False)

## configure email
mail = auth.settings.mailer
mail.settings.server = 'logging' or 'smtp.gmail.com:587'
mail.settings.sender = '*****@*****.**'
mail.settings.login = '******'

## configure auth policy
Exemple #28
0
response.generic_patterns = ['*'] if request.is_local else []

#########################################################################
## Here is sample code if you need for
## - email capabilities
## - authentication (registration, login, logout, ... )
## - authorization (role based authorization)
## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss)
## - crud actions
## (more options discussed in gluon/tools.py)
#########################################################################

from gluon.tools import Mail, Auth, Crud, Service, PluginManager, prettydate
mail = Mail()                                  # mailer
auth = Auth(db)                                # authentication/authorization
crud = Crud(db)                                # for CRUD helpers using auth
service = Service()                            # for json, xml, jsonrpc, xmlrpc, amfrpc
plugins = PluginManager()                      # for configuring plugins

mail.settings.server = 'logging' or 'smtp.gmail.com:587'  # your SMTP server
mail.settings.sender = '*****@*****.**'         # your email
mail.settings.login = '******'      # your credentials or None

auth.settings.hmac_key = '<your secret key>'   # before define_tables()
auth.define_tables()                           # creates all needed tables
auth.settings.mailer = mail                    # for user email verification
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.messages.verify_email = 'Click on the link http://'+request.env.http_host+URL('default','user',args=['verify_email'])+'/%(key)s to verify your email'
auth.settings.reset_password_requires_verification = True
auth.messages.reset_password = '******'+request.env.http_host+URL('default','user',args=['reset_password'])+'/%(key)s to reset your password'
Exemple #29
0
def search_members():
    crud = Crud(db)
    form, table=crud.search(db.members)
    return dict(form=form, table=table)
Exemple #30
0
 def __init__(self, db):
     Crud.__init__(db)
     self.settings.auth = None
     self.settings.formstyle = self.db.config.crud.formstyle
Exemple #31
0
# coding: utf8
db = DAL('sqlite://storage.sqlite')

from gluon.tools import Crud, Auth
crud=Crud(globals(), db)
auth=Auth(globals(), db)
auth.define_tables()

#auth.settings.actions_disabled.append('register')

e_m={
    'empty':'This is a required Field',
    'in_db':'This already exists in database',
    'not_in_db':'This does not exists in database',
    'email':'You have to insert a valid mail address',
    'image':'The file need to be an image',
    'not_in_set':'You need to chose a valid value',
    'not_in_range':'Type a number between %(min)s and %(max)s',
    }
            
config=dict(nmsite='Car Store', dscsite='The best car for your needs')

statuses =('New', 'Used')

colors=('Blue', 'Yellow', 'Green', 'Red',\
    'Silver', 'White', 'Black', 'Purple')
    
    

Exemple #32
0
 def __init__(self, db):
     Crud.__init__(db)
     self.settings.auth = None
     self.settings.formstyle = "divs"
Exemple #33
0

def check_reseller_gateways(form):
    if len(form.vars.gateways) == 0:
        form.errors.gateways = T('please eneter at least one gateway')
    gws = form.vars.gateways if isinstance(form.vars.gateways,
                                           list) else [form.vars.gateways]
    for gw in gws:
        value, error = IS_IPV4()(gw)
        if error:
            form.errors.gateways = error
            return


from gluon.tools import Crud
crud = Crud(db)
crud.settings.auth = auth
crud.settings.formstyle = myconf.get('forms.formstyle')
crud.settings.create_onvalidation.client.append(check_client_prefix_uniqueness)
crud.settings.update_onvalidation.client.append(check_client_prefix_uniqueness)
crud.settings.create_onvalidation.reseller.append(check_reseller_gateways)
crud.settings.update_onvalidation.reseller.append(check_reseller_gateways)

# -------------------------------------------------------------------------
# create all tables needed by auth if not custom tables
# -------------------------------------------------------------------------
auth.define_tables(username=False, signature=True)

# -------------------------------------------------------------------------
# configure email
# -------------------------------------------------------------------------
Exemple #34
0
 def __init__(self):
     """ Initialise parent class & make any necessary modifications """
     Crud.__init__(self, current.db)
Exemple #35
0
 def __init__(self, environment, db=None):
     """ Initialise parent class & make any necessary modifications """
     Crud.__init__(self, environment, db)
 def __init__(self, db):
     Crud.__init__(db)
     self.settings.auth = None
     self.settings.formstyle = self.db.config.crud.formstyle
Exemple #37
0
 def __init__(self):
     """ Initialise parent class & make any necessary modifications """
     Crud.__init__(self, current.db)
Exemple #38
0
def comments():
    """ Function accessed by AJAX from discuss() to handle Comments """

    try:
        resourcename = request.args[0]
    except:
        raise HTTP(400)

    try:
        id = request.args[1]
    except:
        raise HTTP(400)

    if resourcename == "problem":
        problem_id = id
        solution_id = None
    elif resourcename == "solution":
        stable = s3db.delphi_solution
        query = (stable.id == id)
        solution = db(query).select(stable.problem_id, limitby=(0, 1)).first()
        if solution:
            problem_id = solution.problem_id
            solution_id = id
        else:
            raise HTTP(400)
    else:
        raise HTTP(400)

    table = s3db.delphi_comment
    field = table.problem_id
    field.default = problem_id
    field.writable = field.readable = False
    sfield = table.solution_id
    if solution_id:
        sfield.default = solution_id
        sfield.writable = sfield.readable = False
    else:
        sfield.label = T("Related to Solution (optional)")
        sfield.requires = IS_EMPTY_OR(
            IS_ONE_OF(db,
                      "delphi_solution.id",
                      s3.delphi_solution_represent,
                      filterby="problem_id",
                      filter_opts=(problem_id, )))

    # Form to add a new Comment
    from gluon.tools import Crud
    form = Crud(db).create(table, formname="delphi_%s/%s" % (resourcename, id))

    # List of existing Comments
    if solution_id:
        comments = db(sfield == solution_id).select(table.id, table.parent,
                                                    table.body,
                                                    table.created_by,
                                                    table.created_on)
    else:
        comments = db(field == problem_id).select(table.id, table.parent,
                                                  table.solution_id,
                                                  table.body, table.created_by,
                                                  table.created_on)

    output = UL(_id="comments")
    for comment in comments:
        if not comment.parent:
            # Show top-level threads at top-level
            thread = comment_parse(comment, comments, solution_id=solution_id)
            output.append(thread)

    # Also see the outer discuss()
    script = \
'''$('#comments').collapsible({xoffset:'-5',yoffset:'50',imagehide:img_path+'arrow-down.png',imageshow:img_path+'arrow-right.png',defaulthide:false})
$('#delphi_comment_parent__row1').hide()
$('#delphi_comment_parent__row').hide()
$('#delphi_comment_body').ckeditor(ck_config)
$('#submit_record__row input').click(function(){$('#comment-form').hide();$('#delphi_comment_body').ckeditorGet().destroy();return true;})'''

    # No layout in this output!
    #s3.jquery_ready.append(script)

    output = DIV(
        output,
        DIV(H4(T("New Post"), _id="comment-title"),
            form,
            _id="comment-form",
            _class="clear"), SCRIPT(script))

    return XML(output)
Exemple #39
0
# Dummy code to enable code completion in IDE's. Can be removed at production apps
if 0:
    datasource = DAL()

current.datasource = datasource
current.db = db

auth = Auth(globals(), db)  # authentication/authorization
auth.settings.login_methods = [
    ldap_auth(mode='uid',
              server='ldap.unirio.br',
              base_dn='ou=people,dc=unirio,dc=br')
]

crud = Crud(globals(), db)  # for CRUD helpers using auth
service = Service(globals())  # for json, xml, jsonrpc, xmlrpc, amfrpc

# # create all tables needed by auth if not custom tables
auth.define_tables(username=True)
auth.settings.everybody_group_id = 6
auth.settings.create_user_groups = False

auth.settings.actions_disabled = [
    'register', 'retrieve_username', 'profile', 'lost_password'
]
db.auth_user.username.label = 'CPF'

db.define_table("api_request_type", Field("group_id", db.auth_group),
                Field("max_requests", "integer"),
                Field("max_entries", "integer"))
Exemple #40
0
 def __init__(self, db):
     Crud.__init__(db)
     self.settings.auth = None
     self.settings.formstyle = 'divs'