[web2py] Re: import a database into web2py

2016-01-06 Thread 黄祥
there is a script included in the web2py package in folder scripts 
(extract_db_models.py) db is refer to mysql, oracle, pgsql, sqlite. doesn't 
know if the adrien python script is same or not like the included one.

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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: import a database into web2py

2016-01-06 Thread Adrien
Hi,

I don't know if web2py can do that but i have a python script which create 
the define_table statements.
You have to execute with the terminal and python (on windows : python 
yourscript.py).
And for the primary key in the table, you have to modify the type (put id 
instead of int).

#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
 mysqltoweb2py --> Import an already existing MySQL Database
 into web2py.

 Usage:
 mysqltoweb2py.py   
'''

# import the necesssary modules :)
import sys
import re
import MySQLdb

reFieldType = re.compile(r'([a-zA-Z]+)([(]\d+[)])?')
reLetter = re.compile('[a-zA-Z]')

# my args
#datab = sys.argv[1]
#user = sys.argv[2]
#passwd = sys.argv[3]

db=MySQLdb.connect(host='localhost',user= "user", passwd = "password", db = 
"database")


def error_msg(msg):
 ''' This could be implemented as an exception
 '''
 sys.stderr.write("%s\n" % msg)
 sys.exit(1)


def output_table(table):
 cursor=db.cursor()
 cursor.execute('show columns from `%s`' % table)

 print "db.define_table('%s'," % table
 # Extract table fields
 for field in cursor.fetchall():
 if field[0] == 'id':
 continue # id field ignored

 if not reLetter.match(field[0][0]):
 error_msg("Error: field name [%s] in table [%s] does not begin 
with a letter" % (field[0], table))

 ftype = reFieldType.match(field[1])
 if not ftype:
 error_msg("Error: could not parse column type")

 _type, _len = tuple(ftype.groups())
 if _type == 'varchar':
 _type = 'string'
 elif _type in ('int', 'tinyint'):
 _type = 'integer'

 print "\tField('%s'," % field[0],
 print "type = '%s'" % _type,
 if _len is not None: # Has a length?
 print ", length = %i" % int(_len[1:-1]),
 print "),"

 print "\tmigrate = False)"


cursor = db.cursor()
cursor.execute('show tables')
for table in cursor.fetchall():
 print
 output_table(table[0])


Le mercredi 6 janvier 2016 04:09:07 UTC+1, Nir Haramati a écrit :
>
> Can I import an already designed database into web2py?
>
> Put differently, can I instruct web2py to generate a model page with 
> define_table statements for existing tables in a database?
>

-- 
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.


[web2py] generic.html issue

2016-01-06 Thread Annet
In one of my controllers I send a mail. The mail has its own view. 

usermessage = response.render('mail/send/username.html', usercontext)
usermail = mail.send(to=[recipient], subject='Your username', 
message=[None, usermessage])


I put this view in a subfolder and forgot to adjust the controller, so 
web2py uses the generic.html
view to render the mail. In this case the view renders all settings of db, 
session, env et cetera.

Is there a way to disable this behaviour? When a view cannot be found I do 
not want display
all setting to the visitor.


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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: View To Controller, HTML componets

2016-01-06 Thread 黄祥
perhaps this link can help you :
http://web2py.com/books/default/chapter/29/05/the-views#INPUT
http://web2py.com/books/default/chapter/29/07/forms-and-validators#FORM

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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] how to get old version

2016-01-06 Thread Anthony
On Tuesday, January 5, 2016 at 10:09:21 PM UTC-5, Carlos Correia wrote:
>
> Hi, 
>
> To get an old version you can clone the git repo (git clone --recursive 
> https://github.com/web2py/web2py.git) and then checkout the appropriated 
> version 
> (git checkout tags/R-2.7.2, to get version 2.7.2).
>

I think he wants the Windows binary distribution, which is not available 
via github.

Anthony

-- 
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.


[web2py] Re: GRID selectable inside component

2016-01-06 Thread Anthony
On Monday, January 4, 2016 at 6:20:42 PM UTC-5, Krzysztof Socha wrote:
>
> Ok. I think I got it... I started developing my application long time ago 
> based on a welcome app. I have updated web2py regularly, but I have not 
> updated original welcome application files that are specific to web2py, 
> such as web2py.js It appears that there have been changes there as well, 
> but they are not handled properly by the update procedure... Once I 
> replaced the web2py.js for my application with a newer version, it works 
> now fine. 
>
> Perhaps these dependencies should be re-thought? Maybe they should be 
> moved out of application tree into somewhere else? Framework-wide js 
> folder, or something... It is not clear how to make sure they are up to 
> date without manually checking after every web2py update... 
>

Well, any time you upgrade the framework, you should always upgrade 
web2py.js (no need to check whether it has changed -- just do it).

This is a good point, though -- perhaps we should come up with a way to 
ensure web2py.js is easily upgraded along with the rest of the framework. 
For now, though, you could always link to the version of web2py.js that 
comes with the "welcome" app, as that will always be upgraded with the 
framework.

Anthony

-- 
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.


[web2py] Re: import a database into web2py

2016-01-06 Thread Anthony
web2py comes with scripts to do this for MySQL, Postgres, Oracle, and 
SQLite. See the scripts that start with "extract_" in 
https://github.com/web2py/web2py/tree/master/scripts.

Anthony

On Tuesday, January 5, 2016 at 10:09:07 PM UTC-5, Nir Haramati wrote:
>
> Can I import an already designed database into web2py?
>
> Put differently, can I instruct web2py to generate a model page with 
> define_table statements for existing tables in a database?
>

-- 
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.


[web2py] Re: GRID selectable inside component

2016-01-06 Thread Krzysztof Socha


On Wednesday, January 6, 2016 at 1:58:19 PM UTC+1, Anthony wrote:
>
>
> Well, any time you upgrade the framework, you should always upgrade 
> web2py.js (no need to check whether it has changed -- just do it).
>
>
I guess, this is more-less what I need to do, but this is not perfect, as I 
have several applications that I maintain and updating all of them manually 
is not great. Also - is this the only file that should be updated in this 
way? I am not sure... What about web2py_ajax.html? appadmin.html? Others?
 

> This is a good point, though -- perhaps we should come up with a way to 
> ensure web2py.js is easily upgraded along with the rest of the framework. 
> For now, though, you could always link to the version of web2py.js that 
> comes with the "welcome" app, as that will always be upgraded with the 
> framework.
>
>
I will try the linking, but not sure how this will work with git throughout 
different filesystems and OSes... (I use Linux on some development systems 
and BSD on some production servers)... git should preserve the link, but...

Anyway - thanks for your help - it allowed me to pinpoint and fix the 
problem for now.

Krzysztof.
 

-- 
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.


[web2py] Re: View To Controller, HTML componets

2016-01-06 Thread Anthony
Just to be clear regarding terminology, data do not pass from the view to 
the controller. Rather, the controller passes data to the view, which is 
then executed to generate HTML, which is sent to the browser. If there is a 
form on the page, when the user submits the form, the form data are sent 
from the browser back to the server and processed by a controller (in 
web2py, forms are typically posted back to the same controller that 
generated them). See 
http://web2py.com/books/default/chapter/29/03/overview#Postbacks.

Anyway, once a form has been submitted to a controller, the values from the 
form are available in request.vars (also in request.post_vars if submitted 
via POST or request.get_vars if submitted via GET). Furthermore, if using 
the FORM or SQLFORM helpers, after calling the .process() method, the 
post-validation form values will be available in form.vars.

Anthony

On Tuesday, January 5, 2016 at 10:09:07 PM UTC-5, Carlo Ghilardi wrote:
>
> Dear all,
> I'm trying to learn Web2py, but I'm having hard time to play with Forms, 
> link HTML components like checkbox for instance. I'm not getting how can I 
> get from the view to controller the information on the checkbox or Textbox 
> or radio button, so in controller I can work with them and generate an 
> answer.
>
> So What I'm asking is a tutorial, how web2py can pass from the view to 
> controller, and vice-versa. A trivial one.
>
> I've tried to look on google, but people only show sample collecting and 
> storing data from the DB.
>
> What I've being looking for, is a view containing some radio buttons and 
> depending on witch one is selected I do an action.
>
> A checkbot selected I do an action.
>
> A Textbox, I can seve its value and do something in controller ...
>
>
>
> Well sorry for this dumb question, hope you can help me.
>
>
>

-- 
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.


[web2py] Re: generic.html issue

2016-01-06 Thread Anthony
Generic views are disabled by default. The welcome app includes the 
following in db.py:

response.generic_patterns = ['*'] if request.is_local else []

That activates the generic views for local requests only. If a generic view 
is being executed for a non-local request, it would only be because you 
explicitly enabled it via response.generic_patterns. If that's not the 
case, perhaps something else is going on (i.e., maybe it's using a 
non-generic view, but you have included response.toolbar() in that view).

Anthony

On Wednesday, January 6, 2016 at 5:22:30 AM UTC-5, Annet wrote:
>
> In one of my controllers I send a mail. The mail has its own view. 
>
> usermessage = response.render('mail/send/username.html', usercontext)
> usermail = mail.send(to=[recipient], subject='Your username', 
> message=[None, usermessage])
>
>
> I put this view in a subfolder and forgot to adjust the controller, so 
> web2py uses the generic.html
> view to render the mail. In this case the view renders all settings of db, 
> session, env et cetera.
>
> Is there a way to disable this behaviour? When a view cannot be found I do 
> not want display
> all setting to the visitor.
>
>
> 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: web2py version reported in the admin interface does not match the git tag?

2016-01-06 Thread Massimo Di Pierro
oops. Something is broken in the build process. I will fix for the future. 
sorry.

On Tuesday, 5 January 2016 10:52:19 UTC-6, Krzysztof Socha wrote:
>
> I have been playing with git repo for web2py, and I find it very useful. 
> Especially the tags - you can easily move from the current master (trunk) 
> to a specific stable release... or so it seems.
>
> I noticed that the tag do not seem to match the version numbers reported 
> in the admin panel for some reason... Some examples:
>
> R-2.13.4 -> 2.13.3-stable+timestamp.2015.12.24.08.08.22
> R-2.13.3 -> 2.13.3-stable+timestamp.2015.12.24.08.08.22
> R-2.13.2 -> 2.12.3-stable+timestamp.2015.08.18.19.14.07
> R-2.13.1 -> 2.12.3-stable+timestamp.2015.08.18.19.14.07
> R-2.12.3 -> 2.12.3-stable+timestamp.2015.08.18.19.14.07
>
> It seems that the version information is not always updated when a new tag 
> is created... Maybe this could be automated somehow, because as it is it 
> always makes me wonder, if I checked out the right tag... 
>
> Krzysztof.
>

-- 
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.


[web2py] Re: import a database into web2py

2016-01-06 Thread Ron Chatterjee
Not sure if those scripts you are referring to Anthony works. I had some 
issues with them earlier

On Wednesday, January 6, 2016 at 7:46:05 AM UTC-5, Anthony wrote:
>
> web2py comes with scripts to do this for MySQL, Postgres, Oracle, and 
> SQLite. See the scripts that start with "extract_" in 
> https://github.com/web2py/web2py/tree/master/scripts.
>
> Anthony
>
> On Tuesday, January 5, 2016 at 10:09:07 PM UTC-5, Nir Haramati wrote:
>>
>> Can I import an already designed database into web2py?
>>
>> Put differently, can I instruct web2py to generate a model page with 
>> define_table statements for existing tables in a database?
>>
>

-- 
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.


Re: [web2py] Re: Auth extra fields

2016-01-06 Thread Anthony
On Wednesday, January 6, 2016 at 12:42:56 PM UTC-5, Mathieu Clabaut wrote:
>
> Be careful that when you update extra fields, it is your responsibility to 
> update auth.user and session.auth.user accordingly...
>

Note just "extra" fields, but any fields in db.auth_user.

Anthony

-- 
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.


[web2py] websocket messaging

2016-01-06 Thread Ron Chatterjee
Any example of chatting application someone can share?

-- 
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.


[web2py] form error with list field when using openpyxl

2016-01-06 Thread aetagothno
I am sure this is a problem with openpyxl and not web2py, although I do not 
understand exactly why it is happening. Is there a way around it or to fix 
it?

When I submit the form the error is:  
* Cannot convert['Yes'] to Excel*

Here is the code:


q = ('Yes', 'No')

def surv_excel(row):
from openpyxl import load_workbook
from openpyxl.writer.excel import save_virtual_workbook
from cStringIO import StringIO
from openpyxl.styles import PatternFill, Border, Side, Alignment, 
Protection, Font
import os
wb = load_workbook(filename= os.path.join(request.folder, 'static', 
'survey.xlsx'))
cells = wb['Sheet1']
cells['I8'] = row.n1
cells['I10'] = row.n2
cells['I12'] = row.n3
cells['I14'] = row.n4
excel_file = StringIO()
excel_file.write(save_virtual_workbook(wb))
excel_file.seek(0)
return db.mysurvey.surv_file.store(excel_file, 'surveyresult.xlsx')


db.define_table('surv',
Field('n1', 'list:string'),
Field('n2', 'list:string'),
Field('n3', 'list:string'),
Field('n4', 'list:string'), 
Field('surv_file', 'upload', compute=surv_excel),
Field('created_by', 'reference auth_user',
  default=auth.user_id, readable=False, writable=False))

db.surv.n1.requires = IS_IN_SET(q)
db.surv.n2.requires = IS_IN_SET(q)
db.surv.n3.requires = IS_IN_SET(q)
db.surv.n4.requires = IS_IN_SET(q)

-- 
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.


[web2py] Re: form error with list field when using openpyxl

2016-01-06 Thread aetagothno
I tried doing:
...
wb = load_workbook(filename= os.path.join(request.folder, 'static', 
'survey.xlsx'))
cells = wb['Sheet1']
if row.n1 == 'Yes':
cells['I8'] = 'Yes'
else:
cells['I8'] = 'No'

Doing this allows me to submit the form without error..but when I open the 
file it inserts "No" even if the selected option was Yes. :(


On Wednesday, January 6, 2016 at 11:16:28 AM UTC-8, aetag...@gmail.com 
wrote:
>
> I am sure this is a problem with openpyxl and not web2py, although I do 
> not understand exactly why it is happening. Is there a way around it or to 
> fix it?
>
> When I submit the form the error is:  
> * Cannot convert['Yes'] to Excel*
>
> Here is the code:
>
>
> q = ('Yes', 'No')
>
> def surv_excel(row):
> from openpyxl import load_workbook
> from openpyxl.writer.excel import save_virtual_workbook
> from cStringIO import StringIO
> from openpyxl.styles import PatternFill, Border, Side, Alignment, 
> Protection, Font
> import os
> wb = load_workbook(filename= os.path.join(request.folder, 'static', 
> 'survey.xlsx'))
> cells = wb['Sheet1']
> cells['I8'] = row.n1
> cells['I10'] = row.n2
> cells['I12'] = row.n3
> cells['I14'] = row.n4
> excel_file = StringIO()
> excel_file.write(save_virtual_workbook(wb))
> excel_file.seek(0)
> return db.mysurvey.surv_file.store(excel_file, 'surveyresult.xlsx')
>
>
> db.define_table('surv',
> Field('n1', 'list:string'),
> Field('n2', 'list:string'),
> Field('n3', 'list:string'),
> Field('n4', 'list:string'), 
> Field('surv_file', 'upload', compute=surv_excel),
> Field('created_by', 'reference auth_user',
>   default=auth.user_id, readable=False, writable=False))
>
> db.surv.n1.requires = IS_IN_SET(q)
> db.surv.n2.requires = IS_IN_SET(q)
> db.surv.n3.requires = IS_IN_SET(q)
> db.surv.n4.requires = IS_IN_SET(q)
>
>

-- 
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.


Re: [web2py] Re: Auth extra fields

2016-01-06 Thread Mathieu Clabaut
Be careful that when you update extra fields, it is your responsibility to
update auth.user and session.auth.user accordingly...

Le mer. 6 janv. 2016 03:42, Anthony  a écrit :

> I assume you want auth.user.store.
>
>
> Anthony
>
>
> On Tuesday, January 5, 2016 at 5:24:19 PM UTC-5, greenpoise wrote:
>>
>> if auth.is_logged_in():
>> this_store=auth_user.store
>> else:
>> this_store=None
>>
>>
>> Is there a way to extract the extra fields value in the controller like
>> the code above?
>>
>> 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.
>

-- 
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.


[web2py] Re: Problems validating SQLFORMs w/o DB IO

2016-01-06 Thread Scott Hunter
I've solved 1/2 of the problem: as per the documentation, `required` only 
applies to DB access; instead, I needed to supply appropriate validators 
via the `requires` parameter.

That still leaves the exception; I can understand it being an odd situation 
(validation against the DB when no DB IO is requested), and I don't get the 
exception once the appropriate `requires` parameter is supplied, but it 
doesn't seem like this should be raising an exception.

On Sunday, January 3, 2016 at 9:46:34 PM UTC-5, Scott Hunter wrote:
>
> If I create a SQLFORM from a table, but avoid DBIO (either by just calling 
> validate, or calling process(dbio=False).accepted), if a required field is 
> missing, instead of the form coming back w/ errors, It throws a NOT_IN_DB 
> exception.  
>
> def request_trial():
> form = SQLFORM(db.t_trial)
> if form.process(dbio=False).accepted:
> session.flash = "Trial Requested"
> redirect( URL(f="index", user_signature=True) )
> return locals()
>
>
>
> Here's the traceback:
>
> Traceback (most recent call last):
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/restricted.py", 
> line 227, in restricted
> exec ccode in environment
>   File 
> "/Users/scott_mbp/Dropbox/web2py_uki/applications/init_bkup/controllers/default.py"
> , line 494, in 
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/globals.py", line 
> 412, in 
> self._caller = lambda f: f()
>   File 
> "/Users/scott_mbp/Dropbox/web2py_uki/applications/init_bkup/controllers/default.py"
> , line 480, in request_trial
> if form.process(dbio=False).accepted:
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 2304, 
> in process
> self.validate(**kwargs)
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 2241, 
> in validate
> if self.accepts(**kwargs):
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/sqlhtml.py", line 
> 1505, in accepts
> **kwargs
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 2122, 
> in accepts
> status = self._traverse(status, hideerror)
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
> in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
> in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
> in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
> in _traverse
> newstatus = c._traverse(status, hideerror) and newstatus
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 895, 
> in _traverse
> newstatus = self._validate()
>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 1863, 
> in _validate
> raise Exception(msg)
> Exception: Validation error, field:f_UKI_ID 
>  object at 0x10e6bfa10>
>
>
> ... and the definition of the field in question:
>
> Field( 'f_UKI_ID', 'integer', label="UKI ID", unique=True, required=
> True ),
>
>
>
> (This may be due to the field also being required to be unique; when 
> unique is not required of any empty fields, I get the behavior described 
> below.)
>
> If instead I use a SQLFORM.factory, missing required fields pass 
> validation; here is the new definition of `form`:
>
> form = SQLFORM.factory( Field( 'Name', label="Name", required=True ) )
>
>
>
> Has this always been the behavior?  If so, can someone explain the 
> rationale behind it?
>
> This is using Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 
>
> - Scott Hunter
>

-- 
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.


[web2py] Re: GRID selectable inside component

2016-01-06 Thread Anthony


>
> I guess, this is more-less what I need to do, but this is not perfect, as 
> I have several applications that I maintain and updating all of them 
> manually is not great. Also - is this the only file that should be updated 
> in this way? I am not sure... What about web2py_ajax.html? appadmin.html? 
> Others?
>

The issue isn't simply whether there have been changes in the file but 
whether there have been changes in the file that are directly linked to 
changes in the core framework. web2py.js includes code that depends on 
particular HTML classes and data-* attributes generated by web2py HTML 
helpers and widgets, so sometimes changes in the core framework are coupled 
with changes in web2py.js and the two must therefore be upgraded in tandem. 
This is less likely to be the case with other app-specific files. For 
example, you can upgrade appadmin.py and appadmin.html, but the old 
versions should generally continue to work with new versions of the 
framework. It's probably worth upgrading web2py_ajax.html as well.
 

>  
>
>> This is a good point, though -- perhaps we should come up with a way to 
>> ensure web2py.js is easily upgraded along with the rest of the framework. 
>> For now, though, you could always link to the version of web2py.js that 
>> comes with the "welcome" app, as that will always be upgraded with the 
>> framework.
>>
>>
> I will try the linking, but not sure how this will work with git 
> throughout different filesystems and OSes... (I use Linux on some 
> development systems and BSD on some production servers)... git should 
> preserve the link, but...
>

I didn't mean you should create symbolic links to the web2py.js file in the 
welcome app -- I meant actually serve that file via its usual URL. So, in 
web2py_ajax.html, instead of using URL('static', 'js/web2py.js'), change it 
to URL('welcome', 'static', 'js/web2py.js').

Anthony

-- 
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.


[web2py] ITSM

2016-01-06 Thread Alex Glaros
Has anyone written an ITIL 
 ( ITSM) system in 
web2py that I could look at?

thanks

Alex Glaros

-- 
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.


[web2py] Re: Problems validating SQLFORMs w/o DB IO

2016-01-06 Thread Anthony
Could be a bug. When you set unique=True, you get a default IS_NOT_IN_DB 
validator. For some reason, when that validator is called, it is throwing 
an exception. Please open a Github issue.

Anthony

On Wednesday, January 6, 2016 at 11:58:04 AM UTC-5, Scott Hunter wrote:
>
> I've solved 1/2 of the problem: as per the documentation, `required` only 
> applies to DB access; instead, I needed to supply appropriate validators 
> via the `requires` parameter.
>
> That still leaves the exception; I can understand it being an odd 
> situation (validation against the DB when no DB IO is requested), and I 
> don't get the exception once the appropriate `requires` parameter is 
> supplied, but it doesn't seem like this should be raising an exception.
>
> On Sunday, January 3, 2016 at 9:46:34 PM UTC-5, Scott Hunter wrote:
>>
>> If I create a SQLFORM from a table, but avoid DBIO (either by just 
>> calling validate, or calling process(dbio=False).accepted), if a required 
>> field is missing, instead of the form coming back w/ errors, It throws a 
>> NOT_IN_DB exception.  
>>
>> def request_trial():
>> form = SQLFORM(db.t_trial)
>> if form.process(dbio=False).accepted:
>> session.flash = "Trial Requested"
>> redirect( URL(f="index", user_signature=True) )
>> return locals()
>>
>>
>>
>> Here's the traceback:
>>
>> Traceback (most recent call last):
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/restricted.py", 
>> line 227, in restricted
>> exec ccode in environment
>>   File 
>> "/Users/scott_mbp/Dropbox/web2py_uki/applications/init_bkup/controllers/default.py"
>> , line 494, in 
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/globals.py", line 
>> 412, in 
>> self._caller = lambda f: f()
>>   File 
>> "/Users/scott_mbp/Dropbox/web2py_uki/applications/init_bkup/controllers/default.py"
>> , line 480, in request_trial
>> if form.process(dbio=False).accepted:
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 2304
>> , in process
>> self.validate(**kwargs)
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 2241
>> , in validate
>> if self.accepts(**kwargs):
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/sqlhtml.py", line 
>> 1505, in accepts
>> **kwargs
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 2122
>> , in accepts
>> status = self._traverse(status, hideerror)
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
>> in _traverse
>> newstatus = c._traverse(status, hideerror) and newstatus
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
>> in _traverse
>> newstatus = c._traverse(status, hideerror) and newstatus
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
>> in _traverse
>> newstatus = c._traverse(status, hideerror) and newstatus
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 888, 
>> in _traverse
>> newstatus = c._traverse(status, hideerror) and newstatus
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 895, 
>> in _traverse
>> newstatus = self._validate()
>>   File "/Users/scott_mbp/Dropbox/web2py_uki/gluon/html.py", line 1863
>> , in _validate
>> raise Exception(msg)
>> Exception: Validation error, field:f_UKI_ID 
>> > object at 0x10e6bfa10>
>>
>>
>> ... and the definition of the field in question:
>>
>> Field( 'f_UKI_ID', 'integer', label="UKI ID", unique=True, required=
>> True ),
>>
>>
>>
>> (This may be due to the field also being required to be unique; when 
>> unique is not required of any empty fields, I get the behavior described 
>> below.)
>>
>> If instead I use a SQLFORM.factory, missing required fields pass 
>> validation; here is the new definition of `form`:
>>
>> form = SQLFORM.factory( Field( 'Name', label="Name", required=True ) 
>> )
>>
>>
>>
>> Has this always been the behavior?  If so, can someone explain the 
>> rationale behind it?
>>
>> This is using Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 
>>
>> - Scott Hunter
>>
>

-- 
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.


[web2py] Re: GRID selectable inside component

2016-01-06 Thread Krzysztof Socha


On Wednesday, January 6, 2016 at 5:30:25 PM UTC+1, Anthony wrote:
>
>
>> I guess, this is more-less what I need to do, but this is not perfect, as 
>> I have several applications that I maintain and updating all of them 
>> manually is not great. Also - is this the only file that should be updated 
>> in this way? I am not sure... What about web2py_ajax.html? appadmin.html? 
>> Others?
>>
>
> The issue isn't simply whether there have been changes in the file but 
> whether there have been changes in the file that are directly linked to 
> changes in the core framework. web2py.js includes code that depends on 
> particular HTML classes and data-* attributes generated by web2py HTML 
> helpers and widgets, so sometimes changes in the core framework are coupled 
> with changes in web2py.js and the two must therefore be upgraded in tandem. 
> This is less likely to be the case with other app-specific files. For 
> example, you can upgrade appadmin.py and appadmin.html, but the old 
> versions should generally continue to work with new versions of the 
> framework. It's probably worth upgrading web2py_ajax.html as well.
>

This just reinforces my point... Perhaps these files (and any others?) 
should be managed as part of the framework, and not as part of an 
application.
 

>  
>
>>  
>>
>>> This is a good point, though -- perhaps we should come up with a way to 
>>> ensure web2py.js is easily upgraded along with the rest of the framework. 
>>> For now, though, you could always link to the version of web2py.js that 
>>> comes with the "welcome" app, as that will always be upgraded with the 
>>> framework.
>>>
>>>
>> I will try the linking, but not sure how this will work with git 
>> throughout different filesystems and OSes... (I use Linux on some 
>> development systems and BSD on some production servers)... git should 
>> preserve the link, but...
>>
>
> I didn't mean you should create symbolic links to the web2py.js file in 
> the welcome app -- I meant actually serve that file via its usual URL. So, 
> in web2py_ajax.html, instead of using URL('static', 'js/web2py.js'), change 
> it to URL('welcome', 'static', 'js/web2py.js').
>
>
Ok. I see. However, in a production environment I do not exactly want to 
have the welcome app enabled... Which means that this kind of link should 
actually NOT work...

Krzysztof. 

-- 
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.


[web2py] Re: Simple left sidebar example

2016-01-06 Thread Ron Chatterjee
Just pitching in so I understand. Isn't it:

{{block right_sidebar}}

  
  
  {{=T("admin")}}

  
{{=T("Don't know what to do?")}}
  
  
{{=A(T("Online examples"), 
_href=URL('examples','default','index'))}}
http://web2py.com;>web2py.com
http://web2py.com/book;>{{=T('Documentation')}}
  

{{end}}

That creates the table in welcome app. I believe you need to add {{block 
right_sidebar}} in the layout. But right_sidebar_enabled = 
globals().get('right_sidebar_enabled', False). But right_sidebar enables 
False or True doesn't make any difference.



On Tuesday, January 5, 2016 at 6:03:18 PM UTC-5, Paul McDonald wrote:
>
>
>
> On Tuesday, January 5, 2016 at 5:03:19 PM UTC-5, Paul McDonald wrote:
>>
>> Can anyone post a simple example of a View with a left sidebar?
>> I must be missing something.  It looks so simple in the manual "5.7 
>> Blocks in views".
>> Thank you in advance.  Paul
>>
>
>
>
> Stifan,
> Thank you for your help.
> The problem seems to be that I used the Wizzard to generate a new 
> application, and that Layout.html is different from the Welcome Layout.html.
> The Wizzard Layout.html does not handle sidebars  properly.
> There seems to be a error in this code:
>
> # using sidebars need to know what sidebar you want to use
> mc0 = 'col-md-12'
> mc1 = 'col-md-9'
> mc2 = 'col-md-6'
> left_sidebar_enabled = globals().get('left_sidebar_enabled', False)
> right_sidebar_enabled = globals().get('right_sidebar_enabled', False)
> middle_column = {0: mc0, 1: mc1, 2: mc2}[
> (left_sidebar_enabled and 1 or 0)+(right_sidebar_enabled and 1 or 0)]
> }}
>  
>

-- 
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.


[web2py] Re: GRID selectable inside component

2016-01-06 Thread Anthony
O

> The issue isn't simply whether there have been changes in the file but 
>> whether there have been changes in the file that are directly linked to 
>> changes in the core framework. web2py.js includes code that depends on 
>> particular HTML classes and data-* attributes generated by web2py HTML 
>> helpers and widgets, so sometimes changes in the core framework are coupled 
>> with changes in web2py.js and the two must therefore be upgraded in tandem. 
>> This is less likely to be the case with other app-specific files. For 
>> example, you can upgrade appadmin.py and appadmin.html, but the old 
>> versions should generally continue to work with new versions of the 
>> framework. It's probably worth upgrading web2py_ajax.html as well.
>>
>
> This just reinforces my point... Perhaps these files (and any others?) 
> should be managed as part of the framework, and not as part of an 
> application.
>

I agree. It's just a matter of figuring out a good mechanism. It's tricky 
with static assets, as often we want to bundle them.
 

> Ok. I see. However, in a production environment I do not exactly want to 
> have the welcome app enabled... Which means that this kind of link should 
> actually NOT work...
>

Good point. I suppose you could use your web server or routes.py to 
redirect all "welcome" requests (except those to /static).

Anthony

-- 
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.


[web2py] Re: websocket messaging

2016-01-06 Thread Ron Chatterjee
Take back the post. 

This seems to works fine for me.

https://github.com/rpedroso/w2pchat



On Wednesday, January 6, 2016 at 1:34:02 PM UTC-5, Ron Chatterjee wrote:
>
> Any example of chatting application someone can share?
>

-- 
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.


[web2py] Re: SQLFORM security question

2016-01-06 Thread Joe
Thanks very much Massimo, I appreciate your reply. 

On Tuesday, January 5, 2016 at 9:00:03 PM UTC+8, Massimo Di Pierro wrote:
>
> form = SQLFORM(db.table) prevents again CSRF but does not limit access. 
> For that you need to decorate the page with @auth.requires_login() etc.
>
> Once SQLFORM stores data in database it is in UTF8. 
>
> If you extract data from database and you display it in a page in any way 
> other than wrapping in XML(...) it is automatically escaped and therefore 
> prevents XSS attacks. If you use XML(...) to display the data you are 
> vulnerable to XML attacks.
>
> On Monday, 4 January 2016 19:40:10 UTC-6, Joe wrote:
>>
>> Thanks very much Anthony, I appreciate the detailed explanation. This is 
>> what my understanding was as well, but I wasn't 100% sure. In my case, the 
>> input was user contact info and some text submitted by the form and  kept 
>> in the db records and not written back to a web page. But this brings up an 
>> other question, if the input is by the login form where the user name is 
>> written back out to the page "Welcome User", there Web2py of course, 
>> automatically escaping any text as well, right?
>>
>>
>> On Tuesday, January 5, 2016 at 12:30:29 AM UTC+8, Anthony wrote:
>>>
>>> By default, SQLFORM protects against cross-site request forgery attacks 
>>> (via a hidden _formkey field, with a matching formkey value in the 
>>> session). And the DAL protects against SQL injection when making database 
>>> inserts. However, at form submission/database-insert time, nothing prevents 
>>> users from entering text that can later be used in a cross-site scripting 
>>> attack. The reason is, such text is not dangerous merely by being stored in 
>>> the database, but only when written back out to a web page. Therefore, 
>>> web2py protects against cross-site scripting by automatically escaping any 
>>> text written via a template. You can only override this default escaping by 
>>> wrapping the text in the XML() helper (and if you want to make the 
>>> unescaped text relatively safe, you can pass sanitize=True to XML).
>>>
>>> So, in this case, there is nothing dangerous about that text having been 
>>> submitted and saved. However, you have to be careful what you then do with 
>>> any user-submitted data. Do not write it back out to a web page without 
>>> escaping or at least sanitizing it.
>>>
>>> Anthony
>>>
>>> On Monday, January 4, 2016 at 7:29:51 AM UTC-5, Joe wrote:

 I the db record text I had this:

 *sometext*+*www.mydomain.com *@
 *sometext.com 
 *http://*sometext*.com/?url=*www.mydomain.com 
 *=e318

 ..and more similar type of code. The input was long and it looked like 
 a cross site scripting attack with the intent to use my domain to send our 
 mass email
 * or something like that...*All of this was in the record's text area 
 for comment processed by the SQLFORM.

 My understanding is that the form allows the special characters to be 
 processed but they are harmless. At least I hope they are. I just ran a 
 test and placed a line of html
 in the form text area. This may not be the best way to test this, this 
 was the line Testing form
 It was processed and made it to the db record but the text wasn't h1 
 size and wasn't green. This should mean that it's fine.

 Please let me know your thoughts.

 On Monday, January 4, 2016 at 6:14:34 PM UTC+8, Niphlod wrote:
>
> it's the same code. 
> A call to 
> http://yoursite/yourapp/controller/function?url=something=somethingelse
>  
> would not pass validation as SQLFORM is CSRF protected.
> If you are sure that that call got a record into the db, something is 
> really wrong with your application as web2py doesn't allow it out of the 
> box.
>
> On Monday, January 4, 2016 at 11:04:49 AM UTC+1, Joe wrote:
>>
>> Thanks very much Niphlod,
>>
>> So, the special characters in the user input showing up in the table 
>> records text is basically harmless, right? That's what I though.
>>
>> Thanks for the correct code. I actually thought the code was:
>>
>> *form = SQLFORM(db.table).process() *
>> *if form.accepted:*
>> do something
>> elif form.errors:
>>#errors this is probably where that call ended 
>> So, the above is not correct?
>>
>> BTW: You mean this is where the attempt/call should have ended? It 
>> didn't end there. The form actually processed the input with the special 
>> characters. I read the entire input with the html code in it in the 
>> database table records. It shouldn't have processed it because of the 
>> special characters? I am probably misunderstanding you. Please kindly 
>> let 
>> me know.
>>
>> Thanks again.
>>
>> Cheers,
>>
>> Joe
>>
>>

[web2py] geometry field /postgis/srid conversion

2016-01-06 Thread Pierre
 

Hi all,

here is the table def:

db.define_table('geom',
Field('loc','geometry()'))


I gave up on this :

I need to convert a Point(longitude,latitude) from srid 4326 to srid 2154 
before insertion into the geometry field (or keep 2 versions of the same 
point one in each spatial system)

this does the conversion:

def trs():
q = "SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(5. 
43.1)',4326),2154));"
pt = db.executesql(q)
return locals()

   

but this brings up an error:


def tru(): 
query ="INSERT INTO geom(loc) VALUES  
(ST_GeomFromText(ST_AsText(ST_Transform(ST_GeomFromText('POINT(5. 
43.1)',4326),2154)),2154));"
result = db.executesql(query)
return locals()  


Ticket ID 

127.0.0.1.2016-01-06.23-03-36.6324202b-9fab-47da-8e52-f1bab32d87e3
 Geometry SRID (2154) does not match column 
SRID (4326) Version web2py™ Version 
2.12.3-stable+timestamp.2015.08.19.00.18.03 Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.

Traceback (most recent call last):
  File "/opt/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/opt/web2py/applications/proxima/controllers/default.py" 
, line 
118, in 
  File "/opt/web2py/gluon/globals.py", line 412, in 
self._caller = lambda f: f()
  File "/opt/web2py/applications/proxima/controllers/default.py" 
, line 
34, in trs
result = db.executesql(query)
  File "/opt/web2py/gluon/packages/dal/pydal/base.py", line 1000, in executesql
adapter.execute(query)
  File "/opt/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 360, 
in execute
return BaseAdapter.execute(self, *a, **b)
  File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1378, in 
execute
return self.log_execute(*a, **b)
  File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1372, in 
log_execute
ret = self.cursor.execute(command, *a[1:], **b)
DataError: Geometry SRID (2154) does not match column SRID (4326)



-- 
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.


Re: [web2py] Re: form error with list field when using openpyxl

2016-01-06 Thread aetagothno
I tried that, and although it allows the form to submit without any 
tickets.. it appears that it messes up something in openpyxl because it 
does not upload a file

On Wednesday, January 6, 2016 at 3:56:06 PM UTC-5, Richard wrote:
>
> What about :
>
> if row.n1.split(',') == 'Yes':
>
> Richard
>
>

-- 
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.


[web2py] Re: form error with list field when using openpyxl

2016-01-06 Thread aetagothno
Okay, I got it to work with this:


wb = load_workbook(filename= os.path.join(request.folder, 'static', 
'survey.xlsx'))
cells = wb['Sheet1']
if row.n1 ==* [*'Yes'*]*:
cells['I8'] = 'Yes'
else:
cells['I8'] = 'No'


Just needed the brackets because it is from a list..however this seems like 
a very tedious solution because if I have more options than just "Yes" or 
"No" it's going to be very long, so I still wonder if there would be a 
better way. Until then, this will do!

-- 
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.


Re: [web2py] Re: form error with list field when using openpyxl

2016-01-06 Thread Richard Vézina
What about :

if row.n1.split(',') == 'Yes':

Richard

On Wed, Jan 6, 2016 at 2:48 PM,  wrote:

> Okay, I got it to work with this:
>
>
> wb = load_workbook(filename= os.path.join(request.folder, 'static',
> 'survey.xlsx'))
> cells = wb['Sheet1']
> if row.n1 ==* [*'Yes'*]*:
> cells['I8'] = 'Yes'
> else:
> cells['I8'] = 'No'
>
>
> Just needed the brackets because it is from a list..however this seems
> like a very tedious solution because if I have more options than just "Yes"
> or "No" it's going to be very long, so I still wonder if there would be a
> better way. Until then, this will do!
>
> --
> 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.
>

-- 
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.