António Ramos | 29 May 21:04 2016
Picon
Gravatar

Off Topic - no-more-mvc-frameworks

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Pierre | 29 May 20:43 2016
Picon

auth_user boolean extrafield odd behavior

Hi,

I defined an auth_user  boolean extra field which default value is False then I updated its value to True
Now if I login with this user and try to access the boolean value via auth.user.extraField it's still False
here is the controller.function:

def auser():
    u= auth.user.username
    m = auth.user.email
    g= auth.user.geolocated
    r= db.auth_user(id=auth.user_id)
    gg = r.geolocated
    return locals()

this gives : g=False and  gg=True  


here is the field definition in db.py:

auth = Auth(db)

auth.settings.extra_fields['auth_user']=[Field('geolocated','boolean', default=False)]

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Sammy | 28 May 01:39 2016
Picon

Output format of an SQL query

I am a python/web2py newbie. I am trying to create a user friendly web search form for clients  that connects to our existing Oracle DB and executes a query based on search criteria put in the form by users.

For example, user will fill out the form saying first_name = "John" , last_name="Smith" and when they submit, it will output for them all the information in the database for John Smith.

I am using DAL to connect to the existing external Oracle DB

my_db = DAL('oracle://username/password <at> Database')

I am using simple FORM to create the form as I could not figure out how to use SQLFORM etc. because those seem to want me to create/define tables which I do not want to do as the table already exists and which do not want to modify. This is purely a query program.


My display_form is something like this

def display_form():
    form = FORM('First Name' INPUT(_name='first_name'),
                           'Last Name' INPUT (_name='last_name'),    
                INPUT(_type='submit'))

if form.accepts(request,session):
session.first_name = request.vars.first_name
session.last_name = request.vars.last_name
redirect(URL('next'))
return dict (form=form)


def next():
    sql = "SELECT * from Table 1  where field1 = session.first_name and field2 = session.last_name "
   
    rows = my_db.executesql(sql)
    return locals()

Then the next.html is

{{extend 'layout.html'}}
<h1>Here is your query results.</h1>
{{=rows}}


This works fine except that output is in this format:

[(field1:value1,field2:value2)] etc.

What is the easiest way to output this in a html table output?

I would also like to provide xls output option.

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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
'Annet' via web2py-users | 28 May 19:57 2016

nginx and uploads


I installed Web2py at Webfaction. In Web2py I have an application dbmodel that contains my models,
static files and uploads. I created two static only applications one two serve the content of static and one
to serve the content form uploads.

So any request starting with http://www.domain.com/dbmodel/static/ will be serve files from ~leonexus/webapps/staticonly/
and So any request starting with http://www.domain.com/dbmodel/uploads/ will be serve files from ~leonexus/webapps/imageonly/

The problem is that, when trying to serve http://www.domain.com/dbmodel/static/css/global.css for example, the
nginx will try to serve file ~domain/webapps/staticonly/css/global.css, but the ~domain/webapps/staticonly/
directory is currently empty so a 404 error is being shown.

 At Webfaction they say I will need to copy my files from ~domain/webapps/w2p/web2py/applications/dbmodel/static/ to ~domain/webapps/staticonly/ for nginx to find them.

In case of the static files this is no problem, however, in case of the files in the uploads directory this is not possible. Has anyone solved this issue?


Kind regards,

Annet

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
黄祥 | 28 May 07:47 2016
Picon

show map on grid view

let say i have a table definition with latitude and longitude as double, and want to show it in SQLFORM.grid view. is it possible to achieve it using web2py?
i've tested it before and an error occured said :
Traceback (most recent call last):
File "/Users/MacBookPro/site/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/Users/MacBookPro/site/web2py/applications/op/views/report/report_check_point.html", line 77, in <module>
NameError: name 'row' is not defined
e.g.
views/report/report_check_point.html
{{extend 'layout.html'}}

{{=grid}}

<style>
#map {
width: 500px;
height: 400px;
}
</style>

<div id="map"></div>

<script>
function initMap() {
var mapDiv = document.getElementById('map');

var latlon = new google.maps.LatLng( {{=row.id.lat}}, {{=row.id.lon}} );

var mapOptions = {
        center: latlon,
        zoom: 15
        };

        var map = new google.maps.Map(mapDiv, mapOptions);

        var marker = new google.maps.Marker({
   position: latlon, 
   map: map
  });
}
</script>

<script src="https://maps.googleapis.com/maps/api/js?callback=initMap" async defer></script>

thanks and best regards,
stifan

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Ron Chatterjee | 27 May 23:22 2016
Picon

Append fields within form, iteratively add fields inside form, List:string append, custom forms

Running into some issues and hoping community help out with thoughts. How do I append to list:string and using form inside a form (custom form). 

Question: How do I append skill_and_experience  as a list:string into the field added_term as 'English': '1 year', 'Math':'2 years',...etc. 

May be there is a better way to do this, but this is how I started out with. 


Model.py:

db.define_table( 'Experience',Field('Experience_level'), format = '%(Experience_level)s')
db.define_table( 'teaching',Field('teach_string'), format = '%(teach_string)s')


db.define_table( 'add_list_item',
                Field('skill_list', db.teaching, label='Enter Your Skills sets', comment = 'Enter skills'),
                Field('Experience_list', db.Experience, label='Enter Your Experience',  comment = 'Enter years'))
                

db.define_table( 'Project', 
                Field("Title", "string", requires=IS_NOT_EMPTY(),default=None),
                Field("added_term", "list:string", requires=IS_NOT_EMPTY()),)



Controller:
def create_table():
    a_list = 'My skills and experience:'
    skill_and_experience = [];
 
    form1 = SQLFORM(db.Project)
    form2 = SQLFORM(db.add_list_item, submit_button=' + Add',).process()
    form2.element('input[type=submit]').update(_class='btn btn-custom')
    
    if form2.accepted:
        a = db(db.add_list_item.id == form2.vars.id).select().first()
        skills = db(db.teaching.id == a.skill_list).select().first()
        experience = db(db.Experience.id == a.Experience_list).select().first()
        skill_and_experience = skills.teach_string+':' +''+ experience.Experience_level
        added_term.append(skill_and_experience)
        response.flash = T("Added Experience")
    
    if form1.accepted:
        response.flash = T("success!")
        
    return dict(form1 = form1, form2 = form2, a_list = a_list)


View:

{{extend 'layout.html'}}

<center>

{{=form1.custom.begin}}


<div class="input-title">
    {{=form1.custom.widget.Title}}
     <br>
    
{{=form2.custom.begin}}    

<h4>{{=a_list}}</h4>



<table>
<thead>
  <tr>
     <div class="skill_list"> 
 
  <td> {{=form2.custom.widget.skill_list}}   </td>
          <div class="exp_list"> 
    <td>{{=form2.custom.widget.Experience_list}}   </td>    
              
                <div class="add_button"> 
              <td> {{=form2.custom.submit}} </td>   
      
</tr>
</thead>
</table> 
<br>
<br>
{{=form2.custom.end}}
      
 {{=form1.custom.submit}}
    
    
        </div> 
      </div>
      </div>  
   </div> 
{{=form1.custom.end}}
</center>

<style>
.input-title{
    height: 100px;
    width: 400px;
}

#add_list_item_skill_list{
     width: 200px;
#add_list_item_Experience_list{
     width: 200px;


.btn-custom { text-align:right;color: blue;width:50px; padding:20%;position: relative;top: -4px;left: 4px;height 20px;}   
</style>



The idea is to basically add experience and training using form2 and add that to form1 and then process both. But I am having problem in appending data into list:string like I would for project. 

Project.idProject.Title2Project.added_term2
1 test1 test1
2 test2 test1, test2, test3
3 test3 test23, test32

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Cynthia Butler | 27 May 19:18 2016
Picon

How was DePy 2016? Any videos of talks?

I really wanted to attend DePy 2016, but could not. 
How did it go?
I hope videos of talks will be available soon, like last year.

Thanks,
Cindy

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Tom Øyvind Hogstad | 27 May 10:02 2016
Picon

LOAD with ajax=True not working with SSL

Hi I enabled SSL on my site and a web2py form.grid embedded in a page using LOAD ajax=True ended up only spinning.
Works fine without SSL. 


--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Roman Molotkovski | 27 May 00:46 2016
Picon

web2py 1.89.5


I've been looking for old versions of python and but I can't find anything older than 2.0.2 (on github).
A previous thread in this group mentioned this link : http://code.google.com/p/web2py/source/list which was supposedly referring to older versions, but it just refers to the github repository.

I'm specifically interested in version 1.89.5. 
Any ideas where can I get it?

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Andre Kozaczka | 27 May 03:56 2016
Picon

Error during scheduled job

I'm seeing this error occasionally from my scheduler:

 
File "/usr/lib/python2.7/ssl.py", line 341, in recv
   
return self.read(buflen)
 
File "/usr/lib/python2.7/ssl.py", line 260, in read
   
return self._sslobj.read(len)
 
File "/home/andre/web2py/gluon/scheduler.py", line 702, in <lambda>
    signal
.signal(signal.SIGTERM, lambda signum, stack_frame: sys.exit(1))
SystemExit: 1


After the error I'll then see a
OperationalError: (2006, 'MySQL server has gone away')

Not quite sure what's going on... seems to happen when I'm running a longer (5 minutes or so) task. Perhaps an issue with PythonAnywhere?

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.
Scott Hunter | 27 May 01:37 2016
Picon

Scheduler menu empty (on purpose?)

In the latest stable release (2.14.6), the Scheduler menu is empty.  When I looked in widget.py, I see this:

    def update_schedulers(self, start=False):
        applications_folder = os.path.join(self.options.folder, 'applications')
        apps = []
        ##FIXME - can't start scheduler in the correct dir from Tk
        if self.options.folder:
            return

and self.options.folder is not empty, even though I did not pass it as a command line option.  If I remove this test, I get the Scheduler menu properly populated, but when I try to start a scheduler, it immediately fails.  Note that the scheduler process also fails when I try to start it along with the server, using -K, -X and -a.  But if I start it as a separate process using -K, it seems to work fine.

This is on OS X 10.11.5

- Scott

--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Gmane