Hello

Looking at writing a front end to an AWS orchestration tool in web2py, I 
already have the functionality required coded in python defs, so just 
looking at presenting things nicely.

One thing I'll have to do a lot of, is present grids and dropdowns of data 
that have come from lists and dictionaries returned by boto module, for 
example in my controller, I tested this:

@auth.requires_login()
def stacklist():
    xadb = DAL('sqlite:memory:')
    xadb.define_table('stacks', Field('stack_name', label='Stack Name'),
                                Field('stack_status', label='Status'))
    xadb.stacks.truncate()
    awskey=auth.user['AWSKey']
    awssec=auth.user['AWSSecret']
    e2conn = boto.ec2.connect_to_region('eu-west-1',
             aws_access_key_id=awskey,
             aws_secret_access_key=awssec)
    cfconn = boto.cloudformation.connect_to_region('eu-west-1',
             aws_access_key_id=awskey,
             aws_secret_access_key=awssec)
    regions = boto.ec2.regions(aws_access_key_id=awskey, 
aws_secret_access_key=awssec)      #
    # get and populate cloudformer stacks
    #
    stackList = cfconn.list_stacks()

    for stackSummary in stackList:
        xadb.stacks.insert(stack_name=stackSummary.stack_name, stack_status=
stackSummary.stack_status)

    form = SQLFORM.grid(xadb.stacks,orderby=[xadb.stacks.stack_status,])
    return dict(form=form)

This works, but if I wanted to create a dropdown for regions instead of 
hard coding eu-west-1, I'd be doing this sort of thing again with a 
different temporary db. And then there's lists for RDS snapshots, ec2 
images, ec2 snapshots etc. Lots of lists of AWS resources to be presented.

Am I going about this the best way ? What other options exist for me to 
present lists and dropdowns of data returned from third party API calls?

Thanks

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to