[web2py] Help Needed: 403 Error on File Upload in web2py Application on Windows Server with IIS

2024-08-22 Thread Silvian Cedru


Hello everyone,

I’m encountering a persistent issue with my web2py application running on a 
Windows Server with IIS, and I’m hoping someone here might be able to help.
*Issue:*

Whenever I try to upload a file trough the FE of the application, I receive 
a 403 Forbidden error. I’ve gone through various troubleshooting steps but 
haven't been able to resolve the issue.
*Configuration:*
   
   - *Server:* Windows Server
   - *Web Server:* IIS
   - *Python:* Installed with wfastcgi
   - *web2py:* Running through IIS with FastCGI

Best Regards,
Silvian

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/dd2d237e-bafc-46af-9fdc-a14654b99aa1n%40googlegroups.com.


[web2py] Help on macos

2022-12-22 Thread Ian W. Scott
I've just moved to mac for my development and am trying to rebuild my 
(formerly Linux) web2py dev environment. But I've hit a complete dead end:
- web2py is generating 500 errors in the browser
- there's no log output in the apache logs at all (so no error messages)
- none of the db table files are being created in the databases folder
- a ticket number is being generated, but I can't access any tickets (get a 
500 error there too)

Since I can't see any logging output I'm at a complete loss how to debug 
this! 

I'm using apache (homebrew httpd) with mod_wsgi and postgresql (psycopg2) 
and they both seem to be working fine apart from web2py. I'm pretty sure 
apache is configured properly and I can access files from the "static" 
folder. But anything that goes through the db seems not to be working at 
all.

Any thoughts about how to start tackling this?


 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bb0c33d9-18d6-464c-b744-2734601895a9n%40googlegroups.com.


Re: [web2py] Help: Dynamic Chart.js issue

2022-10-16 Thread Silvian “Top 10 Answers” Cedru
Thanks a lot will have a look

muratkas...@gmail.com schrieb am Donnerstag, 13. Oktober 2022 um 19:27:16 
UTC+7:

> Hi,
>
> There is a good explanation on these links: 
> https://www.chartjs.org/docs/latest/developers/updates.html
>
> https://stackoverflow.com/questions/17354163/dynamically-update-values-of-a-chartjs-chart
>  
> and  https://codepen.io/statuswoe/pen/kQMLom
>
> I think you can call your function with ajax inside from "updateData":
>
> setInterval(function(){
> *updateData*(data);
> myNewChart.Line(data, optionsNoAnimation)
> ;}, 2000
>
> --
> Murat.
>
>
> Silvian “Top 10 Answers” Cedru , 3 Eki 2022 Pzt, 
> 06:59 tarihinde şunu yazdı:
>
>> Hello everyone,
>>
>> I want to create a dynamic chart using Chart.js with data from the 
>> database but I am not really sure how to do that . I have manager to create 
>> predefined and filled arrays but I dont know how to make it dynamic I have 
>> here my controller code
>>
>> def calc():
>> 
>> teams =  db(db.projects).select(orderby=db.projects.id)
>> rows1 = db(db.projects).select(orderby=db.projects.id)
>> rows = db(db.projects).select(orderby=db.projects.id)
>> 
>> # Calculation for total project by Teams in different 
>> developmentphases
>> construct = db(db.projects.project_devlopment_phase).select()
>> identification = 
>> db(db.projects.project_devlopment_phase=='0').select()
>> 
>> pre_feasibility= db(db.projects.project_devlopment_phase=='1' 
>> ).select()
>> feasibility= db(db.projects.project_devlopment_phase=='2' ).select()
>> understudy = pre_feasibility + feasibility
>>
>> financing = db(db.projects.project_devlopment_phase=='3' ).select()
>> implementation = db(db.projects.project_devlopment_phase=='4' 
>> ).select() 
>> under_construction = financing + implementation
>>
>> wp = db(db.projects.technology=='WP').select()
>> sp=  db(db.projects.technology=='SP').select()
>> hp = db(db.projects.technology=='HP').select()
>> bi = db(db.projects.technology=='BI').select()
>>
>> re = wp + sp + hp + bi
>>   
>> data2d = [[100, 12, 5, 2, 5], [5, 100, 10,4,1 ], [5, 8, 100, 5,6], 
>> [12,15,8,6,100]]
>> data1d = [11,5, 12,6, 5,100, 2,100]
>>
>> mylist = list(dict.fromkeys(data1d))
>>
>> return dict(mylist=mylist, team=team, datatest=datatest,  data2d=data2d 
>> ,data1d = data1d,construct=construct,rows1= rows1 ,teams=teams, rows=rows, 
>> identification=identification, understudy=understudy, 
>> under_construction=under_construction, 
>> re=re)
>>
>> -- 
>> 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+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/84192b23-cc7c-4553-ae42-baea1b88b4ben%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/097663b3-610a-4186-bc8a-50051ba630fdn%40googlegroups.com.


Re: [web2py] Help: Dynamic Chart.js issue

2022-10-13 Thread Murat KAŞIKÇIOĞLU
Hi,

There is a good explanation on these links:
https://www.chartjs.org/docs/latest/developers/updates.html
https://stackoverflow.com/questions/17354163/dynamically-update-values-of-a-chartjs-chart

and  https://codepen.io/statuswoe/pen/kQMLom

I think you can call your function with ajax inside from "updateData":

setInterval(function(){
*updateData*(data);
myNewChart.Line(data, optionsNoAnimation)
;}, 2000

--
Murat.


Silvian “Top 10 Answers” Cedru , 3 Eki 2022 Pzt,
06:59 tarihinde şunu yazdı:

> Hello everyone,
>
> I want to create a dynamic chart using Chart.js with data from the
> database but I am not really sure how to do that . I have manager to create
> predefined and filled arrays but I dont know how to make it dynamic I have
> here my controller code
>
> def calc():
>
> teams =  db(db.projects).select(orderby=db.projects.id)
> rows1 = db(db.projects).select(orderby=db.projects.id)
> rows = db(db.projects).select(orderby=db.projects.id)
>
> # Calculation for total project by Teams in different
> developmentphases
> construct = db(db.projects.project_devlopment_phase).select()
> identification = db(db.projects.project_devlopment_phase=='0').select()
>
> pre_feasibility= db(db.projects.project_devlopment_phase=='1'
> ).select()
> feasibility= db(db.projects.project_devlopment_phase=='2' ).select()
> understudy = pre_feasibility + feasibility
>
> financing = db(db.projects.project_devlopment_phase=='3' ).select()
> implementation = db(db.projects.project_devlopment_phase=='4'
> ).select()
> under_construction = financing + implementation
>
> wp = db(db.projects.technology=='WP').select()
> sp=  db(db.projects.technology=='SP').select()
> hp = db(db.projects.technology=='HP').select()
> bi = db(db.projects.technology=='BI').select()
>
> re = wp + sp + hp + bi
>
> data2d = [[100, 12, 5, 2, 5], [5, 100, 10,4,1 ], [5, 8, 100, 5,6],
> [12,15,8,6,100]]
> data1d = [11,5, 12,6, 5,100, 2,100]
>
> mylist = list(dict.fromkeys(data1d))
>
> return dict(mylist=mylist, team=team, datatest=datatest,  data2d=data2d
> ,data1d = data1d,construct=construct,rows1= rows1 ,teams=teams, rows=rows,
> identification=identification, understudy=understudy, 
> under_construction=under_construction,
> re=re)
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/84192b23-cc7c-4553-ae42-baea1b88b4ben%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAC5t_Jx6YoEGWMm6x0ts-fwP%2BUVMmWFj2ysBBEfOfgoNCAo86g%40mail.gmail.com.


[web2py] Help: Dynamic Chart.js issue

2022-10-02 Thread Silvian “Top 10 Answers” Cedru
Hello everyone,

I want to create a dynamic chart using Chart.js with data from the database 
but I am not really sure how to do that . I have manager to create 
predefined and filled arrays but I dont know how to make it dynamic I have 
here my controller code

def calc():

teams =  db(db.projects).select(orderby=db.projects.id)
rows1 = db(db.projects).select(orderby=db.projects.id)
rows = db(db.projects).select(orderby=db.projects.id)

# Calculation for total project by Teams in different developmentphases
construct = db(db.projects.project_devlopment_phase).select()
identification = db(db.projects.project_devlopment_phase=='0').select()

pre_feasibility= db(db.projects.project_devlopment_phase=='1' ).select()
feasibility= db(db.projects.project_devlopment_phase=='2' ).select()
understudy = pre_feasibility + feasibility

financing = db(db.projects.project_devlopment_phase=='3' ).select()
implementation = db(db.projects.project_devlopment_phase=='4' 
).select() 
under_construction = financing + implementation

wp = db(db.projects.technology=='WP').select()
sp=  db(db.projects.technology=='SP').select()
hp = db(db.projects.technology=='HP').select()
bi = db(db.projects.technology=='BI').select()

re = wp + sp + hp + bi
  
data2d = [[100, 12, 5, 2, 5], [5, 100, 10,4,1 ], [5, 8, 100, 5,6], 
[12,15,8,6,100]]
data1d = [11,5, 12,6, 5,100, 2,100]

mylist = list(dict.fromkeys(data1d))
   
return dict(mylist=mylist, team=team, datatest=datatest,  data2d=data2d 
,data1d = data1d,construct=construct,rows1= rows1 ,teams=teams, rows=rows, 
identification=identification, understudy=understudy, 
under_construction=under_construction, 
re=re)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/84192b23-cc7c-4553-ae42-baea1b88b4ben%40googlegroups.com.


[web2py] Help with project (many to many form or table)

2020-01-17 Thread Juan Gutiérrez
Hello, I'm creating a small project to test the use of web2py.
After going through some of the documentation for web2py I've found myself 
in quite a problem to deal with a many to many insert/update form.

The simplified context for the example is this:
Model: 
There are people (person) and each can only have a home (home). Homes 
(home) have many types of rooms (home_room). Types of rooms (room) are 
asigned to homes (home). A person can spend an amount of minutes in a 
specific room of his home (person_room).
The table to record the amount of minutes a person spends in a room can 
have only one record for a person/room of the home.

Controller:
Index. Show a list of the people in the DB.
Register minutes. Shows a list of the rooms available to the person 
according to the home and process the request to update amount of minutes 
for each room.

View:
Index. Displays a list of records for person. Each person links to the 
register url and using the args sends the person's id.
Register minutes. Should display a table (or form) with the rooms and any 
previous minutes registered to a person so the amounts can be entered or 
updated.

So my problem is creating a table (or form) that presents the left join for 
home_rooms and person so I can enter the minutes for each room and submit 
the information. I've been thinking a solution could be to insert first any 
records from the left join into the person_room table before creating the 
table (or form), but this still leaves me the problem of showing several 
records to update the amount of minutes.

CODE:
Model:

db.define_table('room', Field('name', 'string'))
db.define_table('home', Field('name', 'string'))
db.define_table('home_room', Field('description', 'string'), 
Field('home_id', 'references home'), Field('room_id', 'references room'))
db.define_table('person', Field('name', 'string'), 
Field('home_id','references home'))
db.define_table('person_room', Field('minutes', 'integer'), 
Field('person_id', 'references person'), Field('home_room_id', 'references 
home_room'))


Data:
Home:
home.id home.name
1 city
2 beach
3 winter

Room:
room.id room.name
1 principal
2 secundary
3 living
4 dining
5 gaming

Home_Room:
home_room.id home_room.description home_room.home_id home_room.room_id
1 city principal 1 1
2 city secondary 1 2
3 city living 1 3
4 beach principal 2 1
5 beach living 2 3
6 beach dining 2 4
7 winter principal 3 1
8 winter living 3 3
9 winter gaming 3 5

Person:
person.id person.name person.home_id
1 David 1
2 Sara 2
3 Charles 3
4 Rose 1
5 Fred 2
6 Martin 3


Controllers (default):

def index():
ppl = db().select(db.person.id, db.person.name)
return dict(people=ppl)

def register():
aForm = None
aPerson = db(db.person.id==request.args(0,
 cast=int, 
 otherwise=URL('index')
)
 ).select(db.person.id,
  db.person.name, 
 ).first() or redirect(URL('index'))
fields = ['person_id', 'home_room_id','minutes']
aForm = SQLFORM(db.person_room, fields=fields)
aForm.vars.person_id = aPerson.id
aForm.process(keepvalues=True)
return dict(person=aPerson, form = aForm)


Views:

default/index
{{extend 'layout.html'}}


{{if len(people) == 0:}}
There's no information
{{else:}}
{{for row in people:}}

{{=A('%s'%row.name, _href=URL("register", 
args=row.id))}}

{{pass}}
{{pass}}


default/register
{{extend 'layout.html'}}

{{=person.name}}
{{=form or ''}}



-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/8c397a93-79f8-43e5-8967-759ebb9611b2%40googlegroups.com.


[web2py] Help with request.args() and SQLFORM.grid(). Error 404

2020-01-14 Thread Juan Gutiérrez
This sounds crazy but I'm getting an error 404 when using in the same 
function this lines together:

test = db.test(request.args(0,cast=int, otherwise=URL('index'))) or 
redirect(URL('index'))
grid = SQLFORM.grid(db(db.test.id == 2), deletable=False, editable=True)

When I comment either one of the lines, the function returns the correct 
values for test and grid. When put together, it doesn't work and I get 
redirected or a 404 error.

the complete escenario is:
Request:
http://127.0.0.1/gk/default/testArg/1

Model:
db.define_table('test',
Field('nombre', 'string', unique=True, label='Nombre'),
Field('gerencia', label='Gerencia'),
Field('equipo', label='Equipo'),
Field('vigencia', 'date', label='Vigencia'),
format = '%(nombre)s'
)

Controler:
@auth.requires_login()
def testArg():
test = db.test(request.args(0,cast=int, otherwise=URL('index'))) or 
redirect(URL('index'))
grid = SQLFORM.grid(db(db.test.id == 2))#, deletable=False, 
editable=True)
return locals()

View:
generic.html

Am I missing something really obvious?

David.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/8e05d374-8497-4818-b6e3-e84df61dc4be%40googlegroups.com.


[web2py] Help understanding memory use and selects

2019-09-02 Thread Ian W. Scott
I'm trying to lower the memory use of an app and have some general 
questions about how memory is used in DAL selects:


   1. Am I right that the memory used while performing the select isn't 
   released right away, even if the select isn't assigned to a variable? 
   2. I'm aware of iterselect. Am I right that with iterselect the memory 
   used is just enough to store one row of data (instead of the whole selected 
   set)?
   3. Does this mean that, generally, you want to perform as few separate 
   selects as possible, unless you can use iterselect?
   4. Selects seem to occupy a significant amount of memory, even when the 
   result set is only one row. Is the memory use for the select determined by 
   the table size or the result size?

Here's an example of the kind of situation I'm working with. I'm using a 
list comprehension to loop through a list, performing a select in each loop:

p_here = [p for p in cpaths if loc_id in db.steps[int(p['steps'][0])].
locations]


When I run a memory profiler, this line results in over 1MB of memory being 
occupied, and that memory isn't released for at least several minutes. The 
table "steps" has about 3000 rows, so it's not enormous. The result for 
each select is a single row and doesn't include a huge amount of data (a 
few strings, ints, etc.). The "cpaths" list might have 50 or so items. So 
is the memory issue emerging because (a) the memory use for each select is 
determined by the table size, and (b) memory is being occupied (and not 
released) separately for each iteration of the loop? Is there a way to 
rewrite this so that it uses less memory?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d2665636-2694-4262-b3ad-441e1c1f695a%40googlegroups.com.


Re: [web2py] Help needed with web2py-book app

2018-12-07 Thread Massimo Di Pierro
Merged. Will deploy tomorrow. Excellent and very much appreciated.

On Tuesday, 4 December 2018 00:51:53 UTC-8, Nico Zanferrari wrote:
>
> Yes, the online version of the book is a web2py application - and I've 
> made it Python 3 compatible with that PR.
>
> But indeed the content of the book itself is still mainly 
> Python2-oriented 
> any help is appreciated ;-)
>
> Nico
>
> Il giorno Lun 3 Dic 2018, 18:17 Marcelo Huerta  
> ha scritto:
>
>> El sábado, 24 de noviembre de 2018, 19:48:32 (UTC-3), Nico Zanferrari 
>> escribió:
>>>
>>> I'm proud to announce that I've finished the work, and now the web2py 
>>> book is python3 compatible, as with PR #395 
>>>  It was a hard work for 
>>> me, but I've learned a lot ;-)
>>>

>
>> Is this the online version at web2py.com/book ?
>>
>> I see there that the explanations about string are Python2-oriented, e.g. 
>> http://web2py.com/books/default/chapter/29/02/the-python-language#str 
>>
>> -- 
>> 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.
>>
>
> Il 03 Dic 2018 18:17, "Marcelo Huerta"  ha 
> scritto:
>
> El sábado, 24 de noviembre de 2018, 19:48:32 (UTC-3), Nico Zanferrari 
> escribió:
>>
>> I'm proud to announce that I've finished the work, and now the web2py 
>> book is python3 compatible, as with PR #395 
>>  It was a hard work for 
>> me, but I've learned a lot ;-)
>>
>>>

> Is this the online version at web2py.com/book ?
>
> I see there that the explanations about string are Python2-oriented, e.g. 
> http://web2py.com/books/default/chapter/29/02/the-python-language#str 
>
> -- 
> 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] Help with deploy with nginx and ubuntu 18.04

2018-12-06 Thread carlos valdez
Hi, I'm a noob with web2py, I need some help, because I'm trying to put a 
site online, for a old project developed in web2py 2.9.5.

I need use nginx as a app server, I know I need to use uwsgi, but I'm a 
little confused with the configuration.

I used the script  setup-web2py-nginx-uwsgi-ubuntu.sh, but it didn't work.

Thanks in advance

Regards

-- 
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] Help needed with web2py-book app

2018-12-04 Thread Ari Lion BR Sp
Congrratulations and Thanks, Nico

ari / brazil

Em terça-feira, 4 de dezembro de 2018 05:51:53 UTC-3, Nico Zanferrari 
escreveu:
>
> Yes, the online version of the book is a web2py application - and I've 
> made it Python 3 compatible with that PR.
>
> But indeed the content of the book itself is still mainly 
> Python2-oriented 
> any help is appreciated ;-)
>
> Nico
>
> Il giorno Lun 3 Dic 2018, 18:17 Marcelo Huerta  > ha scritto:
>
>> El sábado, 24 de noviembre de 2018, 19:48:32 (UTC-3), Nico Zanferrari 
>> escribió:
>>>
>>> I'm proud to announce that I've finished the work, and now the web2py 
>>> book is python3 compatible, as with PR #395 
>>>  It was a hard work for 
>>> me, but I've learned a lot ;-)
>>>

>
>> Is this the online version at web2py.com/book ?
>>
>> I see there that the explanations about string are Python2-oriented, e.g. 
>> http://web2py.com/books/default/chapter/29/02/the-python-language#str 
>>
>> -- 
>> 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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> Il 03 Dic 2018 18:17, "Marcelo Huerta" > 
> ha scritto:
>
> El sábado, 24 de noviembre de 2018, 19:48:32 (UTC-3), Nico Zanferrari 
> escribió:
>>
>> I'm proud to announce that I've finished the work, and now the web2py 
>> book is python3 compatible, as with PR #395 
>>  It was a hard work for 
>> me, but I've learned a lot ;-)
>>
>>>

> Is this the online version at web2py.com/book ?
>
> I see there that the explanations about string are Python2-oriented, e.g. 
> http://web2py.com/books/default/chapter/29/02/the-python-language#str 
>
> -- 
> 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+un...@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.


Re: [web2py] Help needed with web2py-book app

2018-12-04 Thread Nico Zanferrari
Yes, the online version of the book is a web2py application - and I've made
it Python 3 compatible with that PR.

But indeed the content of the book itself is still mainly Python2-oriented
any help is appreciated ;-)

Nico

Il giorno Lun 3 Dic 2018, 18:17 Marcelo Huerta 
ha scritto:

> El sábado, 24 de noviembre de 2018, 19:48:32 (UTC-3), Nico Zanferrari
> escribió:
>>
>> I'm proud to announce that I've finished the work, and now the web2py
>> book is python3 compatible, as with PR #395
>>  It was a hard work for
>> me, but I've learned a lot ;-)
>>
>>>

> Is this the online version at web2py.com/book ?
>
> I see there that the explanations about string are Python2-oriented, e.g.
> http://web2py.com/books/default/chapter/29/02/the-python-language#str
>
> --
> 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.
>

Il 03 Dic 2018 18:17, "Marcelo Huerta"  ha
scritto:

El sábado, 24 de noviembre de 2018, 19:48:32 (UTC-3), Nico Zanferrari
escribió:
>
> I'm proud to announce that I've finished the work, and now the web2py book
> is python3 compatible, as with PR #395
>  It was a hard work for
> me, but I've learned a lot ;-)
>
>>
>>>
Is this the online version at web2py.com/book ?

I see there that the explanations about string are Python2-oriented, e.g.
http://web2py.com/books/default/chapter/29/02/the-python-language#str

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


Re: [web2py] Help needed with web2py-book app

2018-12-03 Thread Marcelo Huerta
El sábado, 24 de noviembre de 2018, 19:48:32 (UTC-3), Nico Zanferrari 
escribió:
>
> I'm proud to announce that I've finished the work, and now the web2py book 
> is python3 compatible, as with PR #395 
>  It was a hard work for 
> me, but I've learned a lot ;-)
>
>>
>>>
Is this the online version at web2py.com/book ?

I see there that the explanations about string are Python2-oriented, 
e.g. http://web2py.com/books/default/chapter/29/02/the-python-language#str 

-- 
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] Help needed with web2py-book app

2018-11-24 Thread Nico Zanferrari
Hi,

I'm proud to announce that I've finished the work, and now the web2py book
is python3 compatible, as with PR #395
 It was a hard work for me,
but I've learned a lot ;-)

Cheers,
Nico

Il giorno lun 15 ott 2018 alle ore 22:26 Nico Zanferrari 
ha scritto:

> Thank you all,
>
> I've finally resolved by using io.open() for the encode problem, and by
> putting the message in the redirect  for bypassing the session.forget()
> command.
>
> Nico
>
> Il giorno ven 12 ott 2018 alle ore 21:34 Dave S 
> ha scritto:
>
>>
>>
>> On Friday, October 12, 2018 at 2:52:44 AM UTC-7, Nico Zanferrari wrote:
>>>
>>> Hi Dave!
>>>
>>> On
>>> https://github.com/web2py/web2py-book/blob/master/controllers/default.py
>>>  the session.forget() command is on line 10 - and I suppose it's quite
>>> necessary.
>>>
>>>
>> I wonder if that's for development, like uncommenting the hack in
>> calc_date() a little below there.
>>
>>
>>> If I change the convert2html function in order to test for import errors:
>>>
>>> try:
>>> from pygments import highlight as pygments_highlight
>>> from pygments.lexers import PythonLexer as pygments_PythonLexer
>>> from pygments.formatters import HtmlFormatter as
>>> pygments_HtmlFormatter
>>> except (ModuleNotFoundError, ImportError) as e:
>>> session.flash = T('Requires pygments module, but it is not
>>> installed - %s' % e)
>>> redirect(URL('index'))
>>>
>>> The FLASH message is never displayed, unless I comment line 10.
>>>
>>>
>> And request.flash gets flushed by the redirect, IIRC.
>>
>> As a  fresh hack, put the message in the URL of the redirect, and look
>> for it in index(), and sanitize it into request.flash.
>>
>> /dps
>>
>>
>>
>>>
>>>
>>> Il giorno ven 12 ott 2018 alle ore 11:17 Dave S  ha
>>> scritto:
>>>


 On Thursday, October 11, 2018 at 1:29:04 PM UTC-7, Nico Zanferrari
 wrote:
>
> Thank you Ben,
>
> I was looking at  the same official page ;-)
> It seems that  using the io module is the way to go, and it's already
> used in pymysql . I'm testing it.
>
> Nobody has suggestions about the session.foget() and session.flash
> message?
>
> thank you,
> nico
>
>
 Where is the session.forget() call?  Is it part of the error path?  Or
 did you set up your index() function to do that>

 /dps


> Il giorno gio 11 ott 2018 alle ore 17:35 Ben Duncan 
> ha scritto:
>
>> Also found this:
>>
>> http://python-future.org/compatible_idioms.html
>>
>> On Thu, Oct 11, 2018 at 10:30 AM Ben Duncan 
>> wrote:
>>
>>> Try These suggestions:
>>>
>>>
>>> https://stackoverflow.com/questions/491921/unicode-utf-8-reading-and-writing-to-files-in-python/83
>>> http://www.evanjones.ca/python-utf8.html
>>>
>>>
>>> On Thu, Oct 11, 2018 at 9:38 AM Nico Zanferrari 
>>> wrote:
>>>
 Hi,

 the encode-decode problem on question 1 is mostly related to the
 opening of files. For example:

 filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
 if PY2:
 lines = open(filename)
 else:
 lines = open(filename, encoding='utf-8')

 In PY2 there is no option for the encoder, while on PY3 it is
 mandatory.

 I'm still learning, too ;-)
 Nico


 Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan <
 linu...@gmail.com> ha scritto:

> Exactly what are you running into?
>
> I ran into this with my rewrite of of extract
> extract_pgsql_models.py:
> ..
> f['type'] =
> "'decimal({},{})'".format(f['precision'],f['scale'])
> had to become
>  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])
>
> And so one.
>
> The changes work across Python 2.7 and 3.6 seamlessly now ...
>
> FWIW, I'm just making the transition to Python 3,6 so I'm learning
> things the hard way ...
>
> Ben Duncan
>
>
> On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari 
> wrote:
>
>> Hello,
>>
>> I'm playing with the web2py-book app, in order to make it python
>> 3 compatible and also to improve it a bit. I have a couple of 
>> questions
>> related to default.py:
>>
>> 1. there were some encode-decode errors. I was able to resolve
>> them (see https://github.com/nicozanf/web2py-book for a preview)
>> but I was forced to use many "IF PY2 / else" conditions, in order to
>> preserve python 2.7 compatibility.  Is there a more elegant and 
>> pythonic
>> solution to manage this and similar situations?
>>
>>

Re: [web2py] Help needed with web2py-book app

2018-10-15 Thread Nico Zanferrari
Thank you all,

I've finally resolved by using io.open() for the encode problem, and by
putting the message in the redirect  for bypassing the session.forget()
command.

Nico

Il giorno ven 12 ott 2018 alle ore 21:34 Dave S  ha
scritto:

>
>
> On Friday, October 12, 2018 at 2:52:44 AM UTC-7, Nico Zanferrari wrote:
>>
>> Hi Dave!
>>
>> On
>> https://github.com/web2py/web2py-book/blob/master/controllers/default.py
>>  the session.forget() command is on line 10 - and I suppose it's quite
>> necessary.
>>
>>
> I wonder if that's for development, like uncommenting the hack in
> calc_date() a little below there.
>
>
>> If I change the convert2html function in order to test for import errors:
>>
>> try:
>> from pygments import highlight as pygments_highlight
>> from pygments.lexers import PythonLexer as pygments_PythonLexer
>> from pygments.formatters import HtmlFormatter as
>> pygments_HtmlFormatter
>> except (ModuleNotFoundError, ImportError) as e:
>> session.flash = T('Requires pygments module, but it is not
>> installed - %s' % e)
>> redirect(URL('index'))
>>
>> The FLASH message is never displayed, unless I comment line 10.
>>
>>
> And request.flash gets flushed by the redirect, IIRC.
>
> As a  fresh hack, put the message in the URL of the redirect, and look for
> it in index(), and sanitize it into request.flash.
>
> /dps
>
>
>
>>
>>
>> Il giorno ven 12 ott 2018 alle ore 11:17 Dave S  ha
>> scritto:
>>
>>>
>>>
>>> On Thursday, October 11, 2018 at 1:29:04 PM UTC-7, Nico Zanferrari wrote:

 Thank you Ben,

 I was looking at  the same official page ;-)
 It seems that  using the io module is the way to go, and it's already
 used in pymysql . I'm testing it.

 Nobody has suggestions about the session.foget() and session.flash
 message?

 thank you,
 nico


>>> Where is the session.forget() call?  Is it part of the error path?  Or
>>> did you set up your index() function to do that>
>>>
>>> /dps
>>>
>>>
 Il giorno gio 11 ott 2018 alle ore 17:35 Ben Duncan 
 ha scritto:

> Also found this:
>
> http://python-future.org/compatible_idioms.html
>
> On Thu, Oct 11, 2018 at 10:30 AM Ben Duncan  wrote:
>
>> Try These suggestions:
>>
>>
>> https://stackoverflow.com/questions/491921/unicode-utf-8-reading-and-writing-to-files-in-python/83
>> http://www.evanjones.ca/python-utf8.html
>>
>>
>> On Thu, Oct 11, 2018 at 9:38 AM Nico Zanferrari 
>> wrote:
>>
>>> Hi,
>>>
>>> the encode-decode problem on question 1 is mostly related to the
>>> opening of files. For example:
>>>
>>> filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
>>> if PY2:
>>> lines = open(filename)
>>> else:
>>> lines = open(filename, encoding='utf-8')
>>>
>>> In PY2 there is no option for the encoder, while on PY3 it is
>>> mandatory.
>>>
>>> I'm still learning, too ;-)
>>> Nico
>>>
>>>
>>> Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan <
>>> linu...@gmail.com> ha scritto:
>>>
 Exactly what are you running into?

 I ran into this with my rewrite of of extract
 extract_pgsql_models.py:
 ..
 f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
 had to become
  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])

 And so one.

 The changes work across Python 2.7 and 3.6 seamlessly now ...

 FWIW, I'm just making the transition to Python 3,6 so I'm learning
 things the hard way ...

 Ben Duncan


 On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari 
 wrote:

> Hello,
>
> I'm playing with the web2py-book app, in order to make it python 3
> compatible and also to improve it a bit. I have a couple of questions
> related to default.py:
>
> 1. there were some encode-decode errors. I was able to resolve
> them (see https://github.com/nicozanf/web2py-book for a preview)
> but I was forced to use many "IF PY2 / else" conditions, in order to
> preserve python 2.7 compatibility.  Is there a more elegant and 
> pythonic
> solution to manage this and similar situations?
>
> 2. I've added a try/except condition, in order to catch a missing
> library (pygments). It works fine, but the session.flash error 
> message is
> not displayed at all because it's followed by a  redirect to index 
> itself
> and there is a session.forget() on the top that cleans it. If I 
> comment the
> session.forget() the flash message is correctly displayed. What can I 
> do?
>
> Cheers,
> Nico

Re: [web2py] Help needed with web2py-book app

2018-10-12 Thread Dave S


On Friday, October 12, 2018 at 2:52:44 AM UTC-7, Nico Zanferrari wrote:
>
> Hi Dave!
>
> On 
> https://github.com/web2py/web2py-book/blob/master/controllers/default.py 
>  the session.forget() command is on line 10 - and I suppose it's quite 
> necessary.
>
>
I wonder if that's for development, like uncommenting the hack in 
calc_date() a little below there.
 

> If I change the convert2html function in order to test for import errors:
>
> try:
> from pygments import highlight as pygments_highlight
> from pygments.lexers import PythonLexer as pygments_PythonLexer
> from pygments.formatters import HtmlFormatter as 
> pygments_HtmlFormatter
> except (ModuleNotFoundError, ImportError) as e:
> session.flash = T('Requires pygments module, but it is not 
> installed - %s' % e)
> redirect(URL('index'))
>
> The FLASH message is never displayed, unless I comment line 10.
>
>
And request.flash gets flushed by the redirect, IIRC.

As a  fresh hack, put the message in the URL of the redirect, and look for 
it in index(), and sanitize it into request.flash.

/dps

 

>
>
> Il giorno ven 12 ott 2018 alle ore 11:17 Dave S  > ha scritto:
>
>>
>>
>> On Thursday, October 11, 2018 at 1:29:04 PM UTC-7, Nico Zanferrari wrote:
>>>
>>> Thank you Ben,
>>>
>>> I was looking at  the same official page ;-)
>>> It seems that  using the io module is the way to go, and it's already 
>>> used in pymysql . I'm testing it.
>>>
>>> Nobody has suggestions about the session.foget() and session.flash 
>>> message?
>>>
>>> thank you,
>>> nico
>>>
>>>
>> Where is the session.forget() call?  Is it part of the error path?  Or 
>> did you set up your index() function to do that>
>>
>> /dps
>>  
>>
>>> Il giorno gio 11 ott 2018 alle ore 17:35 Ben Duncan  
>>> ha scritto:
>>>
 Also found this:

 http://python-future.org/compatible_idioms.html

 On Thu, Oct 11, 2018 at 10:30 AM Ben Duncan  wrote:

> Try These suggestions:
>
>
> https://stackoverflow.com/questions/491921/unicode-utf-8-reading-and-writing-to-files-in-python/83
> http://www.evanjones.ca/python-utf8.html
>
>
> On Thu, Oct 11, 2018 at 9:38 AM Nico Zanferrari  
> wrote:
>
>> Hi,
>>
>> the encode-decode problem on question 1 is mostly related to the 
>> opening of files. For example:
>>
>> filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
>> if PY2:
>> lines = open(filename)
>> else:
>> lines = open(filename, encoding='utf-8')
>>
>> In PY2 there is no option for the encoder, while on PY3 it is 
>> mandatory. 
>>
>> I'm still learning, too ;-)
>> Nico
>>
>>
>> Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan <
>> linu...@gmail.com> ha scritto:
>>
>>> Exactly what are you running into?
>>>
>>> I ran into this with my rewrite of of extract 
>>> extract_pgsql_models.py:
>>> ..
>>> f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
>>> had to become
>>>  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])
>>>
>>> And so one. 
>>>
>>> The changes work across Python 2.7 and 3.6 seamlessly now ...
>>>
>>> FWIW, I'm just making the transition to Python 3,6 so I'm learning 
>>> things the hard way ...
>>>
>>> Ben Duncan
>>>  
>>>
>>> On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari  
>>> wrote:
>>>
 Hello,

 I'm playing with the web2py-book app, in order to make it python 3 
 compatible and also to improve it a bit. I have a couple of questions 
 related to default.py:

 1. there were some encode-decode errors. I was able to resolve them 
 (see https://github.com/nicozanf/web2py-book for a preview) but I 
 was forced to use many "IF PY2 / else" conditions, in order to 
 preserve 
 python 2.7 compatibility.  Is there a more elegant and pythonic 
 solution to 
 manage this and similar situations?

 2. I've added a try/except condition, in order to catch a missing 
 library (pygments). It works fine, but the session.flash error message 
 is 
 not displayed at all because it's followed by a  redirect to index 
 itself 
 and there is a session.forget() on the top that cleans it. If I 
 comment the 
 session.forget() the flash message is correctly displayed. What can I 
 do?

 Cheers,
 Nico

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

Re: [web2py] Help needed with web2py-book app

2018-10-12 Thread Nico Zanferrari
Hi Dave!

On https://github.com/web2py/web2py-book/blob/master/controllers/default.py
 the session.forget() command is on line 10 - and I suppose it's quite
necessary.

If I change the convert2html function in order to test for import errors:

try:
from pygments import highlight as pygments_highlight
from pygments.lexers import PythonLexer as pygments_PythonLexer
from pygments.formatters import HtmlFormatter as
pygments_HtmlFormatter
except (ModuleNotFoundError, ImportError) as e:
session.flash = T('Requires pygments module, but it is not
installed - %s' % e)
redirect(URL('index'))

The FLASH message is never displayed, unless I comment line 10.



Il giorno ven 12 ott 2018 alle ore 11:17 Dave S  ha
scritto:

>
>
> On Thursday, October 11, 2018 at 1:29:04 PM UTC-7, Nico Zanferrari wrote:
>>
>> Thank you Ben,
>>
>> I was looking at  the same official page ;-)
>> It seems that  using the io module is the way to go, and it's already
>> used in pymysql . I'm testing it.
>>
>> Nobody has suggestions about the session.foget() and session.flash
>> message?
>>
>> thank you,
>> nico
>>
>>
> Where is the session.forget() call?  Is it part of the error path?  Or did
> you set up your index() function to do that>
>
> /dps
>
>
>> Il giorno gio 11 ott 2018 alle ore 17:35 Ben Duncan 
>> ha scritto:
>>
>>> Also found this:
>>>
>>> http://python-future.org/compatible_idioms.html
>>>
>>> On Thu, Oct 11, 2018 at 10:30 AM Ben Duncan  wrote:
>>>
 Try These suggestions:


 https://stackoverflow.com/questions/491921/unicode-utf-8-reading-and-writing-to-files-in-python/83
 http://www.evanjones.ca/python-utf8.html


 On Thu, Oct 11, 2018 at 9:38 AM Nico Zanferrari 
 wrote:

> Hi,
>
> the encode-decode problem on question 1 is mostly related to the
> opening of files. For example:
>
> filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
> if PY2:
> lines = open(filename)
> else:
> lines = open(filename, encoding='utf-8')
>
> In PY2 there is no option for the encoder, while on PY3 it is
> mandatory.
>
> I'm still learning, too ;-)
> Nico
>
>
> Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan 
> ha scritto:
>
>> Exactly what are you running into?
>>
>> I ran into this with my rewrite of of extract extract_pgsql_models.py:
>> ..
>> f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
>> had to become
>>  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])
>>
>> And so one.
>>
>> The changes work across Python 2.7 and 3.6 seamlessly now ...
>>
>> FWIW, I'm just making the transition to Python 3,6 so I'm learning
>> things the hard way ...
>>
>> Ben Duncan
>>
>>
>> On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari 
>> wrote:
>>
>>> Hello,
>>>
>>> I'm playing with the web2py-book app, in order to make it python 3
>>> compatible and also to improve it a bit. I have a couple of questions
>>> related to default.py:
>>>
>>> 1. there were some encode-decode errors. I was able to resolve them
>>> (see https://github.com/nicozanf/web2py-book for a preview) but I
>>> was forced to use many "IF PY2 / else" conditions, in order to preserve
>>> python 2.7 compatibility.  Is there a more elegant and pythonic 
>>> solution to
>>> manage this and similar situations?
>>>
>>> 2. I've added a try/except condition, in order to catch a missing
>>> library (pygments). It works fine, but the session.flash error message 
>>> is
>>> not displayed at all because it's followed by a  redirect to index 
>>> itself
>>> and there is a session.forget() on the top that cleans it. If I comment 
>>> the
>>> session.forget() the flash message is correctly displayed. What can I 
>>> do?
>>>
>>> Cheers,
>>> Nico
>>>
>>> --
>>> 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+un...@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 grou

Re: [web2py] Help needed with web2py-book app

2018-10-12 Thread Dave S


On Thursday, October 11, 2018 at 1:29:04 PM UTC-7, Nico Zanferrari wrote:
>
> Thank you Ben,
>
> I was looking at  the same official page ;-)
> It seems that  using the io module is the way to go, and it's already used 
> in pymysql . I'm testing it.
>
> Nobody has suggestions about the session.foget() and session.flash message?
>
> thank you,
> nico
>
>
Where is the session.forget() call?  Is it part of the error path?  Or did 
you set up your index() function to do that>

/dps
 

> Il giorno gio 11 ott 2018 alle ore 17:35 Ben Duncan  > ha scritto:
>
>> Also found this:
>>
>> http://python-future.org/compatible_idioms.html
>>
>> On Thu, Oct 11, 2018 at 10:30 AM Ben Duncan > > wrote:
>>
>>> Try These suggestions:
>>>
>>>
>>> https://stackoverflow.com/questions/491921/unicode-utf-8-reading-and-writing-to-files-in-python/83
>>> http://www.evanjones.ca/python-utf8.html
>>>
>>>
>>> On Thu, Oct 11, 2018 at 9:38 AM Nico Zanferrari >> > wrote:
>>>
 Hi,

 the encode-decode problem on question 1 is mostly related to the 
 opening of files. For example:

 filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
 if PY2:
 lines = open(filename)
 else:
 lines = open(filename, encoding='utf-8')

 In PY2 there is no option for the encoder, while on PY3 it is 
 mandatory. 

 I'm still learning, too ;-)
 Nico


 Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan >>> > ha scritto:

> Exactly what are you running into?
>
> I ran into this with my rewrite of of extract extract_pgsql_models.py:
> ..
> f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
> had to become
>  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])
>
> And so one. 
>
> The changes work across Python 2.7 and 3.6 seamlessly now ...
>
> FWIW, I'm just making the transition to Python 3,6 so I'm learning 
> things the hard way ...
>
> Ben Duncan
>  
>
> On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari  > wrote:
>
>> Hello,
>>
>> I'm playing with the web2py-book app, in order to make it python 3 
>> compatible and also to improve it a bit. I have a couple of questions 
>> related to default.py:
>>
>> 1. there were some encode-decode errors. I was able to resolve them 
>> (see https://github.com/nicozanf/web2py-book for a preview) but I 
>> was forced to use many "IF PY2 / else" conditions, in order to preserve 
>> python 2.7 compatibility.  Is there a more elegant and pythonic solution 
>> to 
>> manage this and similar situations?
>>
>> 2. I've added a try/except condition, in order to catch a missing 
>> library (pygments). It works fine, but the session.flash error message 
>> is 
>> not displayed at all because it's followed by a  redirect to index 
>> itself 
>> and there is a session.forget() on the top that cleans it. If I comment 
>> the 
>> session.forget() the flash message is correctly displayed. What can I do?
>>
>> Cheers,
>> Nico
>>
>> -- 
>> 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+un...@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+un...@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+un...@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

Re: [web2py] Help needed with web2py-book app

2018-10-11 Thread Nico Zanferrari
Thank you Ben,

I was looking at  the same official page ;-)
It seems that  using the io module is the way to go, and it's already used
in pymysql . I'm testing it.

Nobody has suggestions about the session.foget() and session.flash message?

thank you,
nico

Il giorno gio 11 ott 2018 alle ore 17:35 Ben Duncan  ha
scritto:

> Also found this:
>
> http://python-future.org/compatible_idioms.html
>
> On Thu, Oct 11, 2018 at 10:30 AM Ben Duncan  wrote:
>
>> Try These suggestions:
>>
>>
>> https://stackoverflow.com/questions/491921/unicode-utf-8-reading-and-writing-to-files-in-python/83
>> http://www.evanjones.ca/python-utf8.html
>>
>>
>> On Thu, Oct 11, 2018 at 9:38 AM Nico Zanferrari 
>> wrote:
>>
>>> Hi,
>>>
>>> the encode-decode problem on question 1 is mostly related to the opening
>>> of files. For example:
>>>
>>> filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
>>> if PY2:
>>> lines = open(filename)
>>> else:
>>> lines = open(filename, encoding='utf-8')
>>>
>>> In PY2 there is no option for the encoder, while on PY3 it is mandatory.
>>>
>>> I'm still learning, too ;-)
>>> Nico
>>>
>>>
>>> Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan 
>>> ha scritto:
>>>
 Exactly what are you running into?

 I ran into this with my rewrite of of extract extract_pgsql_models.py:
 ..
 f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
 had to become
  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])

 And so one.

 The changes work across Python 2.7 and 3.6 seamlessly now ...

 FWIW, I'm just making the transition to Python 3,6 so I'm learning
 things the hard way ...

 Ben Duncan


 On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari 
 wrote:

> Hello,
>
> I'm playing with the web2py-book app, in order to make it python 3
> compatible and also to improve it a bit. I have a couple of questions
> related to default.py:
>
> 1. there were some encode-decode errors. I was able to resolve them
> (see https://github.com/nicozanf/web2py-book for a preview) but I was
> forced to use many "IF PY2 / else" conditions, in order to preserve python
> 2.7 compatibility.  Is there a more elegant and pythonic solution to 
> manage
> this and similar situations?
>
> 2. I've added a try/except condition, in order to catch a missing
> library (pygments). It works fine, but the session.flash error message is
> not displayed at all because it's followed by a  redirect to index itself
> and there is a session.forget() on the top that cleans it. If I comment 
> the
> session.forget() the flash message is correctly displayed. What can I do?
>
> Cheers,
> Nico
>
> --
> 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.

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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://

Re: [web2py] Help needed with web2py-book app

2018-10-11 Thread Ben Duncan
Also found this:

http://python-future.org/compatible_idioms.html

On Thu, Oct 11, 2018 at 10:30 AM Ben Duncan  wrote:

> Try These suggestions:
>
>
> https://stackoverflow.com/questions/491921/unicode-utf-8-reading-and-writing-to-files-in-python/83
> http://www.evanjones.ca/python-utf8.html
>
>
> On Thu, Oct 11, 2018 at 9:38 AM Nico Zanferrari 
> wrote:
>
>> Hi,
>>
>> the encode-decode problem on question 1 is mostly related to the opening
>> of files. For example:
>>
>> filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
>> if PY2:
>> lines = open(filename)
>> else:
>> lines = open(filename, encoding='utf-8')
>>
>> In PY2 there is no option for the encoder, while on PY3 it is mandatory.
>>
>> I'm still learning, too ;-)
>> Nico
>>
>>
>> Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan 
>> ha scritto:
>>
>>> Exactly what are you running into?
>>>
>>> I ran into this with my rewrite of of extract extract_pgsql_models.py:
>>> ..
>>> f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
>>> had to become
>>>  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])
>>>
>>> And so one.
>>>
>>> The changes work across Python 2.7 and 3.6 seamlessly now ...
>>>
>>> FWIW, I'm just making the transition to Python 3,6 so I'm learning
>>> things the hard way ...
>>>
>>> Ben Duncan
>>>
>>>
>>> On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari 
>>> wrote:
>>>
 Hello,

 I'm playing with the web2py-book app, in order to make it python 3
 compatible and also to improve it a bit. I have a couple of questions
 related to default.py:

 1. there were some encode-decode errors. I was able to resolve them
 (see https://github.com/nicozanf/web2py-book for a preview) but I was
 forced to use many "IF PY2 / else" conditions, in order to preserve python
 2.7 compatibility.  Is there a more elegant and pythonic solution to manage
 this and similar situations?

 2. I've added a try/except condition, in order to catch a missing
 library (pygments). It works fine, but the session.flash error message is
 not displayed at all because it's followed by a  redirect to index itself
 and there is a session.forget() on the top that cleans it. If I comment the
 session.forget() the flash message is correctly displayed. What can I do?

 Cheers,
 Nico

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


Re: [web2py] Help needed with web2py-book app

2018-10-11 Thread Ben Duncan
Try These suggestions:

https://stackoverflow.com/questions/491921/unicode-utf-8-reading-and-writing-to-files-in-python/83
http://www.evanjones.ca/python-utf8.html


On Thu, Oct 11, 2018 at 9:38 AM Nico Zanferrari  wrote:

> Hi,
>
> the encode-decode problem on question 1 is mostly related to the opening
> of files. For example:
>
> filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
> if PY2:
> lines = open(filename)
> else:
> lines = open(filename, encoding='utf-8')
>
> In PY2 there is no option for the encoder, while on PY3 it is mandatory.
>
> I'm still learning, too ;-)
> Nico
>
>
> Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan 
> ha scritto:
>
>> Exactly what are you running into?
>>
>> I ran into this with my rewrite of of extract extract_pgsql_models.py:
>> ..
>> f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
>> had to become
>>  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])
>>
>> And so one.
>>
>> The changes work across Python 2.7 and 3.6 seamlessly now ...
>>
>> FWIW, I'm just making the transition to Python 3,6 so I'm learning things
>> the hard way ...
>>
>> Ben Duncan
>>
>>
>> On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari 
>> wrote:
>>
>>> Hello,
>>>
>>> I'm playing with the web2py-book app, in order to make it python 3
>>> compatible and also to improve it a bit. I have a couple of questions
>>> related to default.py:
>>>
>>> 1. there were some encode-decode errors. I was able to resolve them (see
>>> https://github.com/nicozanf/web2py-book for a preview) but I was forced
>>> to use many "IF PY2 / else" conditions, in order to preserve python 2.7
>>> compatibility.  Is there a more elegant and pythonic solution to manage
>>> this and similar situations?
>>>
>>> 2. I've added a try/except condition, in order to catch a missing
>>> library (pygments). It works fine, but the session.flash error message is
>>> not displayed at all because it's followed by a  redirect to index itself
>>> and there is a session.forget() on the top that cleans it. If I comment the
>>> session.forget() the flash message is correctly displayed. What can I do?
>>>
>>> Cheers,
>>> Nico
>>>
>>> --
>>> 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.
>>
> --
> 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.


Re: [web2py] Help needed with web2py-book app

2018-10-11 Thread Nico Zanferrari
Hi,

the encode-decode problem on question 1 is mostly related to the opening of
files. For example:

filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
if PY2:
lines = open(filename)
else:
lines = open(filename, encoding='utf-8')

In PY2 there is no option for the encoder, while on PY3 it is mandatory.

I'm still learning, too ;-)
Nico


Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan  ha
scritto:

> Exactly what are you running into?
>
> I ran into this with my rewrite of of extract extract_pgsql_models.py:
> ..
> f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
> had to become
>  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])
>
> And so one.
>
> The changes work across Python 2.7 and 3.6 seamlessly now ...
>
> FWIW, I'm just making the transition to Python 3,6 so I'm learning things
> the hard way ...
>
> Ben Duncan
>
>
> On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari 
> wrote:
>
>> Hello,
>>
>> I'm playing with the web2py-book app, in order to make it python 3
>> compatible and also to improve it a bit. I have a couple of questions
>> related to default.py:
>>
>> 1. there were some encode-decode errors. I was able to resolve them (see
>> https://github.com/nicozanf/web2py-book for a preview) but I was forced
>> to use many "IF PY2 / else" conditions, in order to preserve python 2.7
>> compatibility.  Is there a more elegant and pythonic solution to manage
>> this and similar situations?
>>
>> 2. I've added a try/except condition, in order to catch a missing library
>> (pygments). It works fine, but the session.flash error message is not
>> displayed at all because it's followed by a  redirect to index itself and
>> there is a session.forget() on the top that cleans it. If I comment the
>> session.forget() the flash message is correctly displayed. What can I do?
>>
>> Cheers,
>> Nico
>>
>> --
>> 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.
>

-- 
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] Help needed with web2py-book app

2018-10-11 Thread Ben Duncan
Exactly what are you running into?

I ran into this with my rewrite of of extract extract_pgsql_models.py:
..
f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
had to become
 f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])

And so one.

The changes work across Python 2.7 and 3.6 seamlessly now ...

FWIW, I'm just making the transition to Python 3,6 so I'm learning things
the hard way ...

Ben Duncan


On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari  wrote:

> Hello,
>
> I'm playing with the web2py-book app, in order to make it python 3
> compatible and also to improve it a bit. I have a couple of questions
> related to default.py:
>
> 1. there were some encode-decode errors. I was able to resolve them (see
> https://github.com/nicozanf/web2py-book for a preview) but I was forced
> to use many "IF PY2 / else" conditions, in order to preserve python 2.7
> compatibility.  Is there a more elegant and pythonic solution to manage
> this and similar situations?
>
> 2. I've added a try/except condition, in order to catch a missing library
> (pygments). It works fine, but the session.flash error message is not
> displayed at all because it's followed by a  redirect to index itself and
> there is a session.forget() on the top that cleans it. If I comment the
> session.forget() the flash message is correctly displayed. What can I do?
>
> Cheers,
> Nico
>
> --
> 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] Help needed with web2py-book app

2018-10-10 Thread Nico Zanferrari
Hello,

I'm playing with the web2py-book app, in order to make it python 3
compatible and also to improve it a bit. I have a couple of questions
related to default.py:

1. there were some encode-decode errors. I was able to resolve them (see
https://github.com/nicozanf/web2py-book for a preview) but I was forced to
use many "IF PY2 / else" conditions, in order to preserve python 2.7
compatibility.  Is there a more elegant and pythonic solution to manage
this and similar situations?

2. I've added a try/except condition, in order to catch a missing library
(pygments). It works fine, but the session.flash error message is not
displayed at all because it's followed by a  redirect to index itself and
there is a session.forget() on the top that cleans it. If I comment the
session.forget() the flash message is correctly displayed. What can I do?

Cheers,
Nico

-- 
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] HELP: Communication error

2018-08-31 Thread Carlos Zenteno
When editing app source from web interface there is a problem while saving 
...I'm getting 'Last saved on: communication error' and nothing saved ... 
tried several times and even re-installed simplejson

No luck

it was working perfect last night and this morning this happened.

Help !!

-- 
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] Help with an error:

2018-08-14 Thread Morganti
Hi guys,

I am having the error below:

Número do Ticket

187.122.40.48.2018-08-14.20-50-49.b4d5d6f0-071d-4f6b-aec3-1c662eb5ea0c
 function sum(character varying) does 
not exist LINE 1: SELECT SUM("ov_home"."valor") FROM "ov_home" WHERE 
((("ov_ho... ^ HINT: No function matches the given name and argument types. 
You might need to add explicit type casts.Versão
web2py™ Version 2.16.1-stable+timestamp.2017.11.14.05.54.25
Python Python 2.7.12: /home/www-data/py27env/bin/uwsgi (prefix: 
/home/www-data/py27env)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.

Traceback (most recent call last):
  File "/home/www-data/py27env/web2py/gluon/restricted.py", line 219, in 
restricted
exec(ccode, environment)
  File 
"/home/www-data/py27env/web2py/applications/nwproducao/compiled/controllers.relatorios.bonus_area.py",
 line 530, in 
  File "/home/www-data/py27env/web2py/gluon/globals.py", line 419, in 
self._caller = lambda f: f()
  File 
"/home/www-data/py27env/web2py/applications/nwproducao/compiled/controllers.relatorios.bonus_area.py",
 line 320, in bonus_area
  File 
"/home/www-data/py27env/web2py/applications/nwproducao/compiled/models.funcoes.py",
 line 1367, in gera_bonus_area
  File 
"/home/www-data/py27env/web2py/applications/nwproducao/compiled/models.funcoes.py",
 line 1422, in total_venda_home
  File "/home/www-data/py27env/web2py/gluon/packages/dal/pydal/objects.py", 
line 2250, in select
return adapter.select(self.query, fields, attributes)
  File 
"/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
762, in select
return self._select_aux(sql, fields, attributes, colnames)
  File 
"/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
718, in _select_aux
rows = self._select_aux_execute(sql)
  File 
"/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
712, in _select_aux_execute
self.execute(sql)
  File 
"/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/__init__.py", 
line 67, in wrap
return f(*args, **kwargs)
  File 
"/home/www-data/py27env/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
412, in execute
rv = self.cursor.execute(command, *args[1:], **kwargs)
ProgrammingError: function sum(character varying) does not exist
LINE 1: SELECT SUM("ov_home"."valor") FROM "ov_home" WHERE ((("ov_ho...
   ^
HINT:  No function matches the given name and argument types. You might need to 
add explicit type casts.


The code that is getting this error is:

total = db.ov_home.valor.sum()
total_venda = db(
(db.ov_home.home_id == home_id) &
(db.ov_home.data_ordem.year() == ano) &
(db.ov_home.data_ordem.month() == mes)
).select(total).first()[total]

I think I am using nothing out of normal, isn´t it?

Thanks your helping
André

-- 
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] Help with CAS logout

2018-08-01 Thread fiubarc


Hello, I am wanting to implement CAS, but during the tests, when I close 
session in the "provider" application it does not close the session in the rest 
of the "consumers" applications. 

I have several applications distributed on several servers and the CAS 
application on a separate server. They all share the same user storage.

The question is if I lack some configuration. I tried sharing the session in 
the database, but I do not know what else to try.

Any help would be appreciated!

-- 
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] Help a noob - I have run script setup-web2py-nginx-uwsgi-ubuntu.sh, now what?

2018-07-07 Thread William Chen
Hi web2py community, I am a complete noob, so bear with me.

I have set up my server on DigitalOcean, set up my SSH and user 
permissions, and run the following script successfully:

cd ~/
wget 
https://raw.githubusercontent.com/web2py/web2py/master/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh
chmod +x  setup-web2py-nginx-uwsgi-ubuntu.sh
sudo ./setup-web2py-nginx-uwsgi-ubuntu.sh



Now, how do I launch Web2py to be able to access the admin interface from 
the server IP address? 

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.


[web2py] Help with cascading drop down list

2018-02-08 Thread 'Matthew J Watts' via web2py-users
Hi community

I'm having a few problems trying to understand how create a cascading drop 
down list. I've followed this tutorial -

http://www.web2pyslices.com/slice/show/1526/cascading-drop-down-lists-with-ajax-2

i've managed to adapt it slightly, but i'm having trouble trying to add 
more tables to the cascade/sequence

It is quite difficult for me (a beginner) to suss out the logic behind it. 

So at the moment i have the code below, what i'm trying to do is return a 
list of values from  the "tax_class" table based selecting results from 
the  "tax_phylum" table

*model*

db.define_table('tax_kingdom',
Field('name'))

db.define_table('tax_phylum',
Field('name', 'string'),
Field('kingdom_id'))
db.tax_phylum.kingdom_id.requires = IS_IN_DB(db, db.tax_kingdom.id, '%(name)s')

db.define_table('tax_class',
Field('name', 'string'),
Field('phylum_id'))
db.tax_class.phylum_id.requires = IS_IN_DB(db, db.tax_phylum.id, '%(name)s')


*Controller*

def index():
kingdoms = db().select(db.tax_kingdom.ALL)

if request.vars.kingdom_name:
phylum_select = db(db.tax_phylum.id == 
request.vars.kingdom_name).select(db.tax_phylum.ALL)
else:
phylum_select = db(db.tax_phylum.id == 1).select(db.tax_phylum.ALL)
return dict(kingdoms=kingdoms, phylum_select=phylum_select)


def phylum():
phylums = db(db.tax_phylum.kingdom_id == 
request.vars.kingdom_name).select(db.tax_phylum.ALL)
result = ""
for p in phylums:
result += "" + p.name + ""
return XML(result)



*view*



{{extend 'layout.html'}}



{{for kingdom in kingdoms:}}

{{=kingdom.name}}

{{pass}}





{{for phylum in phylum_select:}}

{{=phylum.name}}
{{pass}}





-- 
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] Help with icons

2017-12-04 Thread Richard Vézina
I think this can be fix in web2py.js .fire() :

/* Triggers an event on an element and returns false if the event
result is false */
fire: function (obj, type, data, target) {
var event = $.Event(type, {
'containerTarget': $('#' + target)[0]
});
obj.trigger(event, data);
return event.result !== false;
},

But I am not sure how...

On Mon, Dec 4, 2017 at 1:22 PM, Richard Vézina 
wrote:

> I don't see much of icon stuff in widget.py and validators.py...
>
> There is also one thing that bug me with custom widget when you want to
> use bts "add-on" or semantic ui "label" :
>
> $
> .00
>
> You have to handle error message that get inserted before the div ui label
> stuff with js... It would be better that error message get append to field
> div instead of just below the input field...
>
> Richard
>
> On Mon, Dec 4, 2017 at 1:14 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Hello Massimo,
>>
>> Whit font-awesome 3.2.1 it was drop in replace, sadly they change their
>> way how to hook icons...
>>
>> I think we should suggest to pass them more than include them in the core
>> code there is these settings for instance which is good :
>>
>> # jQuery UI ThemeRoller classes (empty if ui is disabled)
>> if ui == 'jquery-ui':
>> ui = dict(widget='ui-widget',
>>   header='ui-widget-header',
>>   content='ui-widget-content',
>>   default='ui-state-default',
>>   cornerall='ui-corner-all',
>>   cornertop='ui-corner-top',
>>   cornerbottom='ui-corner-bottom',
>>   button='ui-button-text-icon-primary',
>>   buttontext='ui-button-text',
>>   buttonadd='ui-icon ui-icon-plusthick',
>>   buttonback='ui-icon ui-icon-arrowreturnthick-1-w',
>>   buttonexport='ui-icon ui-icon-transferthick-e-w',
>>   buttondelete='ui-icon ui-icon-trash',
>>   buttonedit='ui-icon ui-icon-pencil',
>>   buttontable='ui-icon ui-icon-triangle-1-e',
>>   buttonview='ui-icon ui-icon-zoomin',
>>   )
>> elif ui == 'web2py':
>> ui = dict(widget='',
>>   header='',
>>   content='',
>>   default='',
>>   cornerall='',
>>   cornertop='',
>>   cornerbottom='',
>>   button='button btn btn-default',
>>   buttontext='buttontext button',
>>   buttonadd='icon plus icon-plus glyphicon
>> glyphicon-plus',
>>   buttonback='icon leftarrow icon-arrow-left
>> glyphicon glyphicon-arrow-left',
>>   buttonexport='icon downarrow icon-download
>> glyphicon glyphicon-download',
>>   buttondelete='icon trash icon-trash glyphicon
>> glyphicon-trash',
>>   buttonedit='icon pen icon-pencil glyphicon
>> glyphicon-pencil',
>>   buttontable='icon rightarrow icon-arrow-right
>> glyphicon glyphicon-arrow-right',
>>   buttonview='icon magnifier icon-zoom-in glyphicon
>> glyphicon-zoom-in'
>>   )
>>
>> But I am not sure if it propagate to all the widget properly of if there
>> is a way to customize all different widgets...
>>
>> We already have glyphicon glyphicon-something... It would make sens to
>> stick with fa fa-something...
>>
>> Richard
>>
>> On Sun, Dec 3, 2017 at 12:41 PM, Massimo Di Pierro <
>> massimo.dipie...@gmail.com> wrote:
>>
>>> In the old days of BS2 we used "icon icon-{name}" for icons. then to
>>> support BS3 we also added "glyphicon glyphicon-{name}". now we use BS4 and
>>> there are no more icons we have to use Font Awesome so we should add "fa
>>> fa-{name}". I can easily add this to sqlhtml.py and we will all be fine but
>>> we will have a proliferation of classes. Another option is to use define
>>> .icon and .icon-{name} for those classes that we use in the grid in terms
>>> of font awesome icons and add them to web2py-bootstrap4.css.
>>>
>>> Preferences?
>>>
>>> --
>>> 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 (

Re: [web2py] Help with icons

2017-12-04 Thread Richard Vézina
I don't see much of icon stuff in widget.py and validators.py...

There is also one thing that bug me with custom widget when you want to use
bts "add-on" or semantic ui "label" :

$
.00

You have to handle error message that get inserted before the div ui label
stuff with js... It would be better that error message get append to field
div instead of just below the input field...

Richard

On Mon, Dec 4, 2017 at 1:14 PM, Richard Vézina 
wrote:

> Hello Massimo,
>
> Whit font-awesome 3.2.1 it was drop in replace, sadly they change their
> way how to hook icons...
>
> I think we should suggest to pass them more than include them in the core
> code there is these settings for instance which is good :
>
> # jQuery UI ThemeRoller classes (empty if ui is disabled)
> if ui == 'jquery-ui':
> ui = dict(widget='ui-widget',
>   header='ui-widget-header',
>   content='ui-widget-content',
>   default='ui-state-default',
>   cornerall='ui-corner-all',
>   cornertop='ui-corner-top',
>   cornerbottom='ui-corner-bottom',
>   button='ui-button-text-icon-primary',
>   buttontext='ui-button-text',
>   buttonadd='ui-icon ui-icon-plusthick',
>   buttonback='ui-icon ui-icon-arrowreturnthick-1-w',
>   buttonexport='ui-icon ui-icon-transferthick-e-w',
>   buttondelete='ui-icon ui-icon-trash',
>   buttonedit='ui-icon ui-icon-pencil',
>   buttontable='ui-icon ui-icon-triangle-1-e',
>   buttonview='ui-icon ui-icon-zoomin',
>   )
> elif ui == 'web2py':
> ui = dict(widget='',
>   header='',
>   content='',
>   default='',
>   cornerall='',
>   cornertop='',
>   cornerbottom='',
>   button='button btn btn-default',
>   buttontext='buttontext button',
>   buttonadd='icon plus icon-plus glyphicon
> glyphicon-plus',
>   buttonback='icon leftarrow icon-arrow-left glyphicon
> glyphicon-arrow-left',
>   buttonexport='icon downarrow icon-download glyphicon
> glyphicon-download',
>   buttondelete='icon trash icon-trash glyphicon
> glyphicon-trash',
>   buttonedit='icon pen icon-pencil glyphicon
> glyphicon-pencil',
>   buttontable='icon rightarrow icon-arrow-right
> glyphicon glyphicon-arrow-right',
>   buttonview='icon magnifier icon-zoom-in glyphicon
> glyphicon-zoom-in'
>   )
>
> But I am not sure if it propagate to all the widget properly of if there
> is a way to customize all different widgets...
>
> We already have glyphicon glyphicon-something... It would make sens to
> stick with fa fa-something...
>
> Richard
>
> On Sun, Dec 3, 2017 at 12:41 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> In the old days of BS2 we used "icon icon-{name}" for icons. then to
>> support BS3 we also added "glyphicon glyphicon-{name}". now we use BS4 and
>> there are no more icons we have to use Font Awesome so we should add "fa
>> fa-{name}". I can easily add this to sqlhtml.py and we will all be fine but
>> we will have a proliferation of classes. Another option is to use define
>> .icon and .icon-{name} for those classes that we use in the grid in terms
>> of font awesome icons and add them to web2py-bootstrap4.css.
>>
>> Preferences?
>>
>> --
>> 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.


Re: [web2py] Help with icons

2017-12-04 Thread Richard Vézina
Hello Massimo,

Whit font-awesome 3.2.1 it was drop in replace, sadly they change their way
how to hook icons...

I think we should suggest to pass them more than include them in the core
code there is these settings for instance which is good :

# jQuery UI ThemeRoller classes (empty if ui is disabled)
if ui == 'jquery-ui':
ui = dict(widget='ui-widget',
  header='ui-widget-header',
  content='ui-widget-content',
  default='ui-state-default',
  cornerall='ui-corner-all',
  cornertop='ui-corner-top',
  cornerbottom='ui-corner-bottom',
  button='ui-button-text-icon-primary',
  buttontext='ui-button-text',
  buttonadd='ui-icon ui-icon-plusthick',
  buttonback='ui-icon ui-icon-arrowreturnthick-1-w',
  buttonexport='ui-icon ui-icon-transferthick-e-w',
  buttondelete='ui-icon ui-icon-trash',
  buttonedit='ui-icon ui-icon-pencil',
  buttontable='ui-icon ui-icon-triangle-1-e',
  buttonview='ui-icon ui-icon-zoomin',
  )
elif ui == 'web2py':
ui = dict(widget='',
  header='',
  content='',
  default='',
  cornerall='',
  cornertop='',
  cornerbottom='',
  button='button btn btn-default',
  buttontext='buttontext button',
  buttonadd='icon plus icon-plus glyphicon
glyphicon-plus',
  buttonback='icon leftarrow icon-arrow-left glyphicon
glyphicon-arrow-left',
  buttonexport='icon downarrow icon-download glyphicon
glyphicon-download',
  buttondelete='icon trash icon-trash glyphicon
glyphicon-trash',
  buttonedit='icon pen icon-pencil glyphicon
glyphicon-pencil',
  buttontable='icon rightarrow icon-arrow-right
glyphicon glyphicon-arrow-right',
  buttonview='icon magnifier icon-zoom-in glyphicon
glyphicon-zoom-in'
  )

But I am not sure if it propagate to all the widget properly of if there is
a way to customize all different widgets...

We already have glyphicon glyphicon-something... It would make sens to
stick with fa fa-something...

Richard

On Sun, Dec 3, 2017 at 12:41 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> In the old days of BS2 we used "icon icon-{name}" for icons. then to
> support BS3 we also added "glyphicon glyphicon-{name}". now we use BS4 and
> there are no more icons we have to use Font Awesome so we should add "fa
> fa-{name}". I can easily add this to sqlhtml.py and we will all be fine but
> we will have a proliferation of classes. Another option is to use define
> .icon and .icon-{name} for those classes that we use in the grid in terms
> of font awesome icons and add them to web2py-bootstrap4.css.
>
> Preferences?
>
> --
> 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] Help with icons

2017-12-03 Thread Massimo Di Pierro
In the old days of BS2 we used "icon icon-{name}" for icons. then to 
support BS3 we also added "glyphicon glyphicon-{name}". now we use BS4 and 
there are no more icons we have to use Font Awesome so we should add "fa 
fa-{name}". I can easily add this to sqlhtml.py and we will all be fine but 
we will have a proliferation of classes. Another option is to use define 
.icon and .icon-{name} for those classes that we use in the grid in terms 
of font awesome icons and add them to web2py-bootstrap4.css.

Preferences?

-- 
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] Help with python classes...

2017-10-27 Thread António Ramos
Hello i'm blocked so i need your opinion

I have many groups of  Objects.
Each group has some fields.
Each field has 3 functions: visible,init and disabled.


I'm coding something like

main.py
from all_fields import *


all_fields.py

Class Load_fields:
def f1():
this field should have inside 3 functions like explained above
def f2():
etc..

Class Another_group:
def f3():
   this field should have inside 3 functions like explained above


I know i´m doing something wrong but can "unlock" my mind...
I need 3 functions inside each fx function but this is not the way...

Any ideas?

Regards

-- 
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] Help - Grid with left joins and sending arguments/variables to other functions

2017-07-19 Thread 'Matthew J Watts' via web2py-users
Hi all

I'm having some problems  trying to achieve the following  

I have a grid with left joins which selects a subset of entries in my 
database -(query between 3 tables) 

Once i get the desired result, i want to be able to set up links within the 
table that then send the id from each row (MAIN table) to a seperate 
function (another query between many tables). 
 
I then want to trigger a download 'csv' file. 

So far, I have managed to get this working if I use one table in the grid 
 (no left joins), however when i set up left joins within the grid,i get an 
'AttributeError' message. Somehow, by setting up the left joins, i loose 
the main id that i  want to send to the seperate function. 

Here's the code:

*Controller*

def vec_dyn_query():
links = [lambda ids: A('Download data 
set',_href=URL("default","download_dataset.csv",args=[ids.id]))]
grid = SQLFORM.grid((db.MAIN), 
field_id=db.MAIN.id,
left = [db.StudyLocation.on(db.MAIN.LocationID == 
db.StudyLocation.id), db.TAXON.on(db.MAIN.TaxonID == db.TAXON.id)],
links=links,
deletable=False, editable=False, details=False, 
selectable=False, create=False, csv=False)
return locals()

def download_dataset():
main_id = request.args(0,cast=int)
dataset = db(db.MAIN.id == request.args[0]).select()
return dict(dataset=dataset)

*Views*

{{
import cStringIO
stream = cStringIO.StringIO()
dataset.export_to_csv_file(stream)
response.headers['Content-Type'] = 'text/csv'
response.write(stream.getvalue(), escape=False)
}}

Note - if i take away the 'left = [db.StudyLocation.on(db.MAIN.LocationID 
== db.StudyLocation.id), db.TAXON.on(db.MAIN.TaxonID == db.TAXON.id)],' 
Everything works fine

Thanks for your help in advance

Matt

-- 
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] Help with building query functions in a web app - links to tutorials etc

2017-04-29 Thread 'Matthew J Watts' via web2py-users
Hi there everyone!

I'm new to Web2py, i'm really enjoying using the framework so far. 

I am trying to rebuild a legacy database. 

I want to produce a web app that can query data from multiple tables using 
drop down boxes e.g. locations, species etc.. I want to be able to select 
info using drop down boxes,  Then i want to display the result and get the 
option to download them. 

Could someone please point me in the right direction in regards to a 
tutorial 

Thanks

matt

-- 
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] Help with creating a Select within the Web2Py DAL for a SQL query that uses an 'exists' clause

2017-04-21 Thread George D Elig
I have a simple SQL query that pulls a column value from a secondary table, 
based on a ID being equal in both tables. The query uses an exists clause 
on a subquery.

select sites.domain_name, batch.batch_name from sites, batch

where exists (select batch.id from batch

  where sites.batchid = batch.id) limit 1

-- 
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] Help! I need to show a short name of languages in a dropdown

2017-03-01 Thread Yoel Baez
How can I show a short name of the languages in a dropdow?
I updated the languages files, but not working...

Ej.
"English (US)" = "EN"
"Español" = "ES"



-- 
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] Help at counting comments of a post and restrict access to certain categories

2017-01-16 Thread 'N. Fischer' via web2py-users
Hi all,
I am currently working with a friend on a web2py project. This is our first 
time, we do anything with web2py and we managed to build the reddit clone 
and do little improvements, Massimo Di Pierro did in his video tutorials, 
thank you at this point for your great videos.
Now we want to add some other features and have some problems to implement 
2 specific things.

1. We want to display how many comments a post has in the overview of the 
category. But we dont really know how we can access the comments of a post 
and count them.

in our database we have the both tables, post and comment. comment has a 
reference to the post it is connected to. 

2. We have a category called "Updates" and we want that only users in the 
group "admin" can create new posts. Other users shall only be able to 
comment on these posts.

@auth.requires_login()
def create_post():
category = get_category()
db.post.category.default = category.id
form = SQLFORM(db.post).process(next='view_post/[id]');
return locals()

@auth.requires_membership("admin")

We tried to use an if-statement that it requires an admin membership.

Hopefully, there is anyone out there who can help. Thank you for reading 
this.

Best regards
N. Fischer

-- 
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] Help needed simplifying creation of response.menu 4-tuple

2017-01-08 Thread Terrence Brannon
I attempted to simplify creation of the response.menu list of tuples by the 
following function:


def menu_item(menu_item_text, url, sub_menu=None, ignore=False):
# First element of tuple is the text of the meny item.
retval = list(menu_item_text)

# Second element of the tuple indicates if this menu item is the
# current active one.
retval.append(url == URL())

# Third element is the link to follow when this item is selected.
retval.append(url)

# The fourth item is an optional sub_menu.
if sub_menu:
retval.append(sub_menu)
else:
retval.append([])

retval.append(ignore)

return retval


but when using it like so:

def public_menu():

response.menu += [
menu_item('How it Works', URL('default', 'how_it_works')),
menu_item('Testimonials', URL('default', 'testimonials')),
menu_item('Sign up Now!', URL('default', 'register')),
menu_item('Login'   , URL('default', 'login')),
]

if auth.is_logged_in():
logged_in_menu()
else:
public_menu()


I get the error:

127.0.0.1.2017-01-08.19-46-22.ca7178e4-a2b2-48f7-8463-81d2c8f70f27
 need more than 1 value to unpack Version 
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 Traceback 

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

Traceback (most recent call last):
  File 
"/home/schemelab/domains/org/metaperl/web2py/web2py/gluon/restricted.py", line 
227, in restricted
exec ccode in environment
  File 
"/home/schemelab/domains/org/metaperl/web2py/web2py/applications/refbank/views/default/index.html",
 line 59, in 
  File "/home/schemelab/domains/org/metaperl/web2py/web2py/gluon/globals.py", 
line 430, in write
self.body.write(xmlescape(data))
  File "/home/schemelab/domains/org/metaperl/web2py/web2py/gluon/html.py", line 
131, in xmlescape
return data.xml()
  File "/home/schemelab/domains/org/metaperl/web2py/web2py/gluon/html.py", line 
2580, in xml
return self.serialize(self.data, 0).xml()
  File "/home/schemelab/domains/org/metaperl/web2py/web2py/gluon/html.py", line 
2545, in serialize
li.append(self.serialize(item[3], level + 1))
  File "/home/schemelab/domains/org/metaperl/web2py/web2py/gluon/html.py", line 
2525, in serialize
(name, active, link) = item[:3]
ValueError: need more than 1 value to unpack


-- 
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] Help writing my first Web APP using Web2py

2016-12-28 Thread Sif Baksh
 

I’m trying to use web2py to create a program for some of my buddies, it’s 
called “Home Run Derby”. Each member will pick 6 baseball players, only the 
top 5 score will count as a total score for each member.

 

Now I get the players name, team and HR by scraping a website and put it in 
a CSV file.

 

This works as a standalone script but want to move it to Web2py.

 

Here are the features I need help with getting started:

-   Put CSV file into DB

-   Create a member login

o   Associate players with each member

 

What I have so far for the DB is:

player_name,team,hr

David Ortiz,Red Sox,38

  

Not sure where to start so anything you can do to point me in the correct 
direction I will appreciate it J


Thanks,

Sif

-- 
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] help,passing java script variable using ajax

2016-12-28 Thread nishanta sarma

function my_function()
{
 var val = 'val';
ajax('{{=URL('default','other' vars = {'key':val})}}',[],'target')"/>;

}


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] Help about html helper composition

2016-12-06 Thread António Ramos
I have an error in the next code and cant see the problem.
I would appreciate some help here.
thanks


 {{for x in kpi:}}
 {{=DIV(DIV(H3("???"),P(x["waiting"]),_class="inner"),DIV(I(_class="fa
fa-hourglass-end"),_class="icon"),A(T("Please
wait..."),_class="small-box-footer"),_class="small-box bg-red"
 ,_id=x["kpi"],_onclick="web2py_component('{{=URL('kpi',
x['kpi']+'.load')}}', target='{{=x['kpi']}}')")}}
 {{pass}}
 {{pass}}



Traceback (most recent call last):
  File "/home/ramstein74/webapps/new2py/web2py/gluon/restricted.py",
line 226, in restricted
ccode = compile2(code, layer)
  File "/home/ramstein74/webapps/new2py/web2py/gluon/restricted.py",
line 209, in compile2
return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, 'exec')
  File 
"/home/ramstein74/webapps/new2py/web2py/applications/fileit/views/entities/list.html",
line 379
,_id=x["kpi"],_onclick="web2py_component('{{=URL('kpi', x['kpi']+'.load'))
 ^
SyntaxError: EOL while scanning string literal

-- 
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] Help with App memory usage

2016-10-13 Thread daniel
Hello im an developing an opensource POS (link 
) using web2py, 
everything is fine except that on my development environment and in a 
production server, my app memory usage grows without limits, it does not 
crash the server however sometimes i get python MemoryError's, things like 
error: 
unpack_from requires a buffer of at least 5 bytes 
 or postgres memory errors in 
the production server, in my development environment i see the memory grow 
by 3 to 6 MB for every request, i dont know what is causing this behavior, 
i am not using caching. any help appreciated.

-- 
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] Help needed to understand/utilise a CSS element

2016-10-02 Thread Peter


Would anyone haver time to explain briefly how to utilise this CSS code.

/* Global Event Styles
*/

.fc-event,
.fc-agenda .fc-event-time,
.fc-event a {
   border-style: solid; 
   border-color: #36c; /* default BORDER color (probably the same as 
background-color) */
   background-color: #36c; /* default BACKGROUND color */
   color: #fff;/* default TEXT color */
   }
   
   /* Use the 'className' CalEvent property and the following
* example CSS to change event color on a per-event basis:
*
* .myclass,
* .fc-agenda .myclass .fc-event-time,
* .myclass a {
* background-color: black;
* border-color: black;
* color: red;
* }
*/



I know some python & html but know little about CSS so I need to take a 
course or two...

In the mean time I would appreciate any help with this...

The calendar view has this code

$('#calendar').fullCalendar({
editable: false,
events: [
{{for row in rows:}}
{  .myclass, .fc-agenda .myclass .fc-event-time, .myclass a { 
background-color: black; border-color: black; color: red;  }
title: '{{=row.task.task_status}} {{=row.task.task_type}}  
{{=row.person.fullname.replace("'","\\'")}} ',
allDay: false,
start: new Date('{{=row.task.start_time.strftime('%B %d, %Y 
%H:%M:%S')}}'),
url: '{{=URL('view_task',args=row.task.id)}}'
},
{{pass}}
]
});


This works to display the calendar events but they all have the same 
background colour of blue

How do I implement the CSS so each event background colour changes 
depending on {{=row.task.task_type}}


Many thanks,
 
Peter

-- 
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] Help with Patterns

2016-08-28 Thread Diego Marinho
I have this pattern:

"/jobs/year-start/{jobs.year_start.year}/amount-range-id/{jobs.amount_range_id}/neighbourhood-id/{jobs.neighbourhood_id}"

I have tree fields that im using to filter the 'jobs' table. How can i make 
those filters optional? 

Let's say i want to use only two of the tree possible filters. What can i 
send instead of the id to say that i want all data concerning that field?  

-- 
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] Help with setting up apps with virutualenv and nginx

2016-07-14 Thread Jason Solack
Hello all,

I am trying to get my head around setting up apps with virtual env on my 
server running nginx.

i have found this:

http://www.web2pyslices.com/slice/show/1464/setting-up-web2py-in-a-virtual-environment

but i am not able to make the connection between running web2py locally and 
having it run on my production server.  The desired outcome would be to 
have each application running on my server have it's own virtual 
environment.  We use pandas in most of our apps and upgrading it at a 
system level often breaks older apps that were written using older API.

Right now i have a test server running ubuntu / nginx out on AWS to test 
things out.  If anyone could point me towards documentation or give me any 
tips on making this work i would greatly appreciate it!

Thanks,

Jason

-- 
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] Help with memory leak

2016-06-18 Thread DNeuman
I'm having trouble running Web2py on Mac OS X 10.11.5  El Capitan - the 
memory consumed by Web2Py just keeps growing. Left overnight it crashes my 
application, corrupts my tables, and creates an unrecoverable mess.

I have uninstalled, and loaded a new download. This didn't work. Running 
from a new download Mac binary with nothing running but the server shows 
memory leak at a very consistent 3.4MB/minute.

No applications running - just download, and start the server.

If I download source and run from python 2.7.11, I get a slow memory leak 
(1.1MB/minute before the server is started, 2.5MB/sec when the server is 
started). Note: I am not running anything. No applications, no code of my 
own, nothing but the server. How can I fix this? Has anyone else 
experienced this? I suspect OS X, so I ran just python, with no program at 
all, and this is stable, with no memory leak.

Any hints what I can do next to try to fix this?

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.


[web2py] help setup nssm services in windows

2016-04-19 Thread Jason Solack
Hello all, 

I'm trying to setup a service in windows to utilize the scheduler.  I found 
this:

http://www.web2pyslices.com/slice/show/1614/nssm-webserver-and-scheduler-as-services-in-windows-oses

but the version of NSSM is different than the version shown in the example 
above.

I have path (which i'm assuming is the path to pythonw.exe), Startup 
directory (the path to the application that will use the scheduler?) and 
Arguments...

could someone help me understand how to start up this service?

Thank you!

Jason

-- 
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] Help with displaying content from my database table

2016-03-02 Thread henry

So I have my table (as seen below) and I want to make it display in the 
view below but I don't want it to show all the records, just the records 
with the same 'auth_user.teacher_id' as the currently logged in user. How 
would I do this?

My Controller:
def default_obs():
 obs = db().select(db.observation.teacher_id,db.observation.date,orderby
=db.observation.date)
 return dict(obs=obs)


My View:
{{extend 'layout.html'}}
Available wiki pages
[ {{=A('search', _href=URL('search'))}} ]
{{for observation in obs:}}
 {{=LI(A(observation.date, _href=URL('show', args=observation.date)))}}
{{pass}}


My db.py:
auth.settings.extra_fields['auth_user']= [
  Field('first_name', type='string'),
  Field('last_name', type='string'),
  Field('department', type='string'),
  Field('date_joined_school', type='date')]


auth.define_tables(username=True,)
auth.settings.everybody_group_id = 7
auth.messages.label_remember_me = "Remember Me   "


db.define_table('observation',
   Field('teacher_id', 'reference auth_user' ),
   Field('observer', type='string'),
   Field('subject'),
   Field('class_name', type='string'),
   Field('year_group', type='string'),
   Field('outcome',),
   Field('details', type='string'),
   Field('date', type='date'),
   Field('extra_information', 'upload'))



Thank you very much for your help

-- 
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] Help with deployment

2015-12-23 Thread Alfonso Serra
Im trying to mount a fresh web2py in a hosting with mod_python, i dont have 
shell access, only ftp and htaccess editing.

Steps ive done:

   1. Unzip web2py in my hard drive and execute rocket server to create 
   deposit, logs folders and parameters_80.py (password and port 80)
   2. Delete all pyc files
   3. Uploaded web2py folder to "/httpdocs/wordpress/python/" (i have to 
   mount the application there because existing rewrite rules)
   4. Place modpythonhandler.py at web2py root folder
   5. Create .htaccess at web2py root:
   SetHandler python-program
   PythonHandler web2py_modpython
   SetEnv SCRIPT_URL '/python/web2py/welcome' 
   PythonDebug On
   
   
   6. Create another file web2py_modpython at web2py root:
   from mod_python import apache
   import modpythonhandler
   
   def handler(req):
   req.subprocess_env['PATH_INFO'] = req.subprocess_env['SCRIPT_URL']
   return modpythonhandler.handler(req)
   
I can access the handler at:
http://mydomain.com/python/web2py/

And this is the error log:

MOD_PYTHON ERROR

ProcessId:  30794
Interpreter:'mydomain.com'

ServerName: 'mydomain.com'
DocumentRoot:   '/var/www/vhosts/mydomain.com/httpdocs/wordpress'

URI:'/python/web2py/'
Location:   None
Directory:  
'/var/www/vhosts/mydomain.com/httpdocs/wordpress/python/web2py/'
Filename:   
'/var/www/vhosts/mydomain.com/httpdocs/wordpress/python/web2py/'
PathInfo:   ''

Phase:  'PythonHandler'
Handler:'web2py_modpython'

Traceback (most recent call last):

  File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1537, 
in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1202, 
in _process_target
module = import_module(module_name, path=path)

  File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 296, 
in import_module
log, import_path)

  File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 680, 
in import_module
execfile(file, module.__dict__)

  File 
"/var/www/vhosts/mydomain.com/httpdocs/wordpress/python/web2py/web2py_modpython.py"
, line 2, in 
import modpythonhandler

  File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 991, 
in load_module
return _global_modules_cache.import_module(self.__file)

  File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 680, 
in import_module
execfile(file, module.__dict__)

  File 
"/var/www/vhosts/mydomain.com/httpdocs/wordpress/python/web2py/modpythonhandler.py"
, line 43, in 
import gluon.main

  File 
"/var/www/vhosts/mydomain.com/httpdocs/wordpress/python/web2py/gluon/__init__.py"
, line 29, in 
"You can also download a complete copy from http://www.web2py.com.";

RuntimeError: web2py depends on pydal, which apparently you have not 
installed.
Probably you cloned the repository using git without '--recursive'
To fix this, please run (from inside your web2py folder):

Ive downloaded the source files from web2py and it does work locally. I may 
have any misconfiguration on the htaccess but i dont know how to fix it.

Please some help.

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.


[web2py] Help with custom widget for list:reference field

2015-12-02 Thread Carlos Cesar Caballero Díaz
Hi, I am working in a plugin (based in the Tim Richardson ckeditor4 
plugin galley) for creating a global media galley for web2py 
applications (some functionality like the wordpress and other cms 
galleys), it is in https://github.com/daxslab/web2py-media-galley.


If you look at the functions get_media_field() and widget() from 
modules/plugin_daxs_media_galley.py you can see that I create a field, 
and a custom widget for that field.


Right now I am using a very ugly approach storing comma-separated images 
ids in a string field, because if I use a list:reference field it always 
throws:


Exception: Validation error, field:media object at 0x7f6158557250>


So, someone can help me with this? why this error? and how avoid it?

Cheears.

--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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] Help with routes and static files

2015-09-13 Thread Alfonso Serra
 I need help writing routes_in/out to achieve this:

Strip the application name and controller from the url
http:\\localhost\tables where tables is a function inside default.py

At the same time im declaring static files as:

So i need to map "css/theme.css" to "http:\\localhost\css\theme.css" 
regardless the current url

So routes_in should be something like:
('/', '/myapp/default/index'), #for home page
#static files
('/css/$anything', '/myapp/static/css/$anything')
('/js/$anything', '/myapp/static/js/$anything')
('/img/$anything', '/myapp/static/img/$anything')

#finally let through actions
('/$anything', '/myapp/default/index/$anything')

The problem is, if im at:
http:\\localhost\tables
the static files are maped as
http:\\localhost\tables\css\theme.css and returns 404

Another question is if i should include static routes in routes_out.
Appreciate any advise.
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.


[web2py] help on sessions

2015-09-05 Thread dirman
is it possible to delete or clear an item in session.cart.items() ?

-- 
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] help on form button inner text

2015-09-05 Thread dirman
i need help here

this works fine with form input

form.element('input[type=submit]')['_value']='Go!'

but this does not output the inner text on form button

form.element('button[type=submit]')['_submit_button']='Go!'

-- 
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] Help with MSSQL Connection

2015-06-30 Thread Massimiliano
Hello,

I've a problem with odbc.

I'm developing on OSX 10.10.3 and I found some problems connecting to sql
server express 2005

I'm tried few things

1. I installed pyodbc and web2py said:

Version 2.10.4-stable+timestamp.2015.04.26.15.11.54
Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000,
pyodbc

but from ipython:

import pyodbc
gave me an error.

tracing web2py, it failed importing pyodbc... It's normal that web2py
includes pyodbc in drivers available if it fail to import pyodbc?

2. I installed from brew unixodbc

but now, when I try to connect to mssql with the following connection
strings:

db = DAL("mssql://sa:pass@192.168.0.19\SQLEXPRESS/TESTDB")
or
db = DAL("mssql3://sa:pass@192.168.0.19\SQLEXPRESS/TESTDB")
I got this error:

RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "pydal/base.py", line 435, in __init__
self._adapter = ADAPTERS[self._dbname](**kwargs)
  File "pydal/adapters/base.py", line 53, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "pydal/adapters/mssql.py", line 155, in __init__
if do_connect: self.reconnect()
  File "pydal/connection.py", line 105, in reconnect
self.connection = f()
  File "pydal/adapters/mssql.py", line 153, in connector
return self.driver.connect(cnxn, **driver_args)
Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib
'SQL Server' : file not found (0) (SQLDriverConnect)")


Could someone help me?
The application with be deployed on debian 7, do you think there are
problems also there?

Thank you

-- 
Massimiliano

-- 
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] Help/documentation on auth.wiki

2015-06-29 Thread St. Pirsch
Hi, 
I'am trying to get familiar with the auth.wiki, which I think is great to 
use for simple cms tasks. 
The documentation in the book is a bit short, a least from the perspective 
of a novice. I couldn't find much more information on auth.wiki here nor 
elsewhere. Maybe it would help other users too,  to sum up some questions 
and best practice somewhere.
In detail, I have two questions:
1. The editor offers a dropown for templates to choose from.
- How can this field be populated, howhave the templates to be designed?
2. I am trying to LOAD wiki pages in other web2py-views. The wiki-pages 
take their styles with them, i.e. as defined in the standard wiki view. How 
to avoid that without removing the style from the wiki itself?
Thanks, Stephan

-- 
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] Help with two python operators

2015-03-28 Thread Paul McDonald
 


 In the web2py Application Development Cookbook:


 
 page 69 the | operator


 alphabetical = User.first_name|User.last_name *← | what is this doing??*


 
 
 page 82 the &= operator


 if not form:

# search flatpage according to the current request

query = db.flatpage.c==request.controller

query &= db.flatpage.f==request.function *← &= what is this doing??*

if request.args:

query &= db.flatpage.args==request.args(0)

else:

query &= (db.flatpage.args==None)|(db.flatpage.args=='')

query &= db.flatpage.lang==lang


 

-- 
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] Help with two Python operators

2015-03-28 Thread Paul McDonald
In the Web2py Application Development Cookbook:
 
 p82the  &=  operators


 if not form:

# search flatpage according to the current request

query = db.flatpage.c==request.controller

query &= db.flatpage.f==request.function *<-  what is going on 
here?*

if request.args:

query &= db.flatpage.args==request.args(0)

else:

query &= (db.flatpage.args==None)|(db.flatpage.args=='')

query &= db.flatpage.lang==lang


 Alos, p69the   |   bianary or operator

alphabetical = User.first_name|User.last_name   * <--  what is 
going on here?   *
  

  Can anyone explain what these are doing?
Thank you in advance


Paul
  

-- 
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] Help deleting a row when using components LOAD

2015-03-07 Thread Ron Chatterjee
U can use the dictionary (or table) as a list n use regular python syntex for 
list. Like li =['a', 'b']; n then do li.remove ('a'). Ur table a dictionary in 
python.  Db (table.field) r dictionaries.  But, u can use [] to make it a list 
I belive or use select method a pass as a set n then remove.

-- 
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] Help deleting a row when using components LOAD

2015-03-07 Thread niki
hi everyone,

So i have two components on my page. I can insert comments on my components 
just fine.
However i am trying to allow my users to delete a comment they have 
inserted.
I am not sure how to go about it. Somebody please help it will be 
appreciated.
This is what i have.


*In comments.py #i declare controllers to the two components and declare a 
delete function *
@auth.requires_login()
def post():
return dict(form = SQLFORM(db.comment_post).process(), 
comments=db(db.comment_post).select())

@auth.requires_login()
def post2():
return dict(form = SQLFORM(db.comment_post2).process(), 
comments=db(db.comment_post2).select())


@auth.requires_login()
def delete_comment():
form = SQLFORM(db.comment_post).process()
db(db.comment_post.id == request.vars.id).delete()
return locals()


*In comments_db.py, i declare my tables*

db.define_table('comment_post',
   Field('body','text'),
   auth.signature)

db.define_table('comment_post2',
   Field('body','text'),
   auth.signature)


*In both post.load and post2.load, i insert the delete link which is in 
bold below*

{{for post in comments:}}

  On {{=post.created_on}} {{=post.created_by.first_name}}
  says {{=post.body}}
*{{=A('Remove', _href=URL('default', 'delete_comment', args=['delete', 
post.id]), cid=request.cid, ajax=True,user_signature=True)}}*

{{pass}}
{{=form}}

*In both post.html and post2,html*
{{extend 'layout.html'}}
{{for post in comments:}}

  On {{=post.created_on}} {{=post.created_by.first_name}}
  says {{=post.body}}


{{pass}}
{{=form}}


*In my htmls where i put my components*


*{{=LOAD('comments', 'post.load', ajax=True)}}*

*{{=LOAD('comments', 'post2.load', ajax=True)}}*

-- 
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] Help using aliasnames instead of real names on my app

2015-02-20 Thread niki
hi,

I have an app that allows people to login in using their Facebook 
credentials. 
However i want them to be able to choose if they want to use their real 
Facebook names or just alias names.
can somebody break it down for me how i would go about achieving this. 

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.


Re: [web2py] HELP!! One click upgrade failed for pythonanywhere site

2015-01-21 Thread Philip Kilner

Hi,

On 21/01/15 16:13, Omi Chiba wrote:

Hi, I clicked the upload on admin and tried to upgrade from 2.4.6 to
2.9.12. As soon as I clicked I got ticket but cannot see the ticket
because now I get a ticket to see the ticket... It means I cannot open
admin site. My app is still working fine.

I don't where to start to fix. Can you guys help?

I can access web2py folder on pythonanywhere no problem. Worst case, I
can delete it and install new and import app which I backup before upgrade.



I don't know if this is relevant, but I've trie to upgrade from 2.9.11 
to 2.9.12 today in my PythonAnywhere instance, and it's failing with: -


unable to upgrade because "[Errno 2] No such file or directory 
'/home/[accname]/web2py/gluon/dal/__init__.py"


where [accname] is my PytonAnywhere account name.

I've not had time to look into this yet, but I'm not sure why it thinks 
that web2py/gluon/dal is a folder.


HTH


--

Regards,

PhilK


'a bell is a cup...until it is struck'

--
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] HELP!! One click upgrade failed for pythonanywhere site

2015-01-21 Thread Omi Chiba
Hi, I clicked the upload on admin and tried to upgrade from 2.4.6 to 
2.9.12. As soon as I clicked I got ticket but cannot see the ticket because 
now I get a ticket to see the ticket... It means I cannot open admin site. 
My app is still working fine.

I don't where to start to fix. Can you guys help?

I can access web2py folder on pythonanywhere no problem. Worst case, I can 
delete it and install new and import app which I backup before upgrade.


-- 
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] Help with web2py on webfaction

2014-11-09 Thread António Ramos
Post a ticket on webfaction , they are very friendly and know about web2py.

There is also a script to install web2py.
I used it and never had problems so far.


2014-11-08 23:47 GMT+00:00 Hans Soflao :

> Can somebody help me with getting web2py app to work with webfaction? This
> is a very simple question I imagine.
>
> The way my folders are structured  are like this:
> home/user/webapps/appname.
> Inside appname folder, there are these folders: apache2, htdocs and
> web2py. These get created when an app gets installed from webfaction
> control panel.
>
> Now, when website is called the output of the website is a page saying:
>
> Welcome to your mod_wsgi website! It uses python...
>
> Now, I figured out this is the index.py page loaded from htdocs.
>
> Thus, I went ahead and looked at the conf file in the apache2 folder. I
> just need a little help to modify conf file right to get it call the
> welcome app in the web2py. I appreciate a lot if you could help. I have
> already taken htdocs out of the directory path and written web2py, but gave
> me error The requested URL / was not found on this server.
>
> ServerRoot "/home/user/webapps/appname/apache2"
>
> LoadModule dir_modulemodules/mod_dir.so
> LoadModule env_modulemodules/mod_env.so
> LoadModule log_config_module modules/mod_log_config.so
> LoadModule mime_module   modules/mod_mime.so
> LoadModule rewrite_modulemodules/mod_rewrite.so
> LoadModule setenvif_module   modules/mod_setenvif.so
> LoadModule wsgi_module   modules/mod_wsgi.so
>
> LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\"
> \"%{User-Agent}i\"" combined
> CustomLog /home/user/logs/user/access_appname.log combined
> DirectoryIndex index.py
> DocumentRoot /home/user/webapps/appname/web2py
> ErrorLog /home/user/logs/user/error_appname.log
> KeepAlive Off
> Listen 15578
> MaxSpareThreads 3
> MinSpareThreads 1
> ServerLimit 1
> SetEnvIf X-Forwarded-SSL on HTTPS=1
> ThreadsPerChild 5
> WSGIDaemonProcess learas processes=5
> python-path=/home/user/webapps/appname/lib/python2.7 threads=1
> WSGIProcessGroup appname
> WSGIRestrictEmbedded On
> WSGILazyInitialization On
>
> 
> AddHandler wsgi-script .py
> 
>
>
>
>
>
>
>  --
> 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] Help with web2py on webfaction

2014-11-08 Thread Hans Soflao
Can somebody help me with getting web2py app to work with webfaction? This 
is a very simple question I imagine. 

The way my folders are structured  are like this:
home/user/webapps/appname.
Inside appname folder, there are these folders: apache2, htdocs and web2py. 
These get created when an app gets installed from webfaction control panel. 

Now, when website is called the output of the website is a page saying:

Welcome to your mod_wsgi website! It uses python...

Now, I figured out this is the index.py page loaded from htdocs. 

Thus, I went ahead and looked at the conf file in the apache2 folder. I 
just need a little help to modify conf file right to get it call the 
welcome app in the web2py. I appreciate a lot if you could help. I have 
already taken htdocs out of the directory path and written web2py, but gave 
me error The requested URL / was not found on this server.

ServerRoot "/home/user/webapps/appname/apache2"

LoadModule dir_modulemodules/mod_dir.so
LoadModule env_modulemodules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module   modules/mod_mime.so
LoadModule rewrite_modulemodules/mod_rewrite.so
LoadModule setenvif_module   modules/mod_setenvif.so
LoadModule wsgi_module   modules/mod_wsgi.so

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" 
\"%{User-Agent}i\"" combined
CustomLog /home/user/logs/user/access_appname.log combined
DirectoryIndex index.py
DocumentRoot /home/user/webapps/appname/web2py
ErrorLog /home/user/logs/user/error_appname.log
KeepAlive Off
Listen 15578
MaxSpareThreads 3
MinSpareThreads 1
ServerLimit 1
SetEnvIf X-Forwarded-SSL on HTTPS=1
ThreadsPerChild 5
WSGIDaemonProcess learas processes=5 
python-path=/home/user/webapps/appname/lib/python2.7 threads=1
WSGIProcessGroup appname
WSGIRestrictEmbedded On
WSGILazyInitialization On


AddHandler wsgi-script .py







-- 
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] Help in server config

2014-08-30 Thread Carlos Correia
Hi,

After migrating a web2py tree with several apps from one server to the 
other, I found that in the new server I had to put a symbolic link in 
admin/static to itself with the release name prefixed by an underscore in 
order to get a "normal" (css/js) admin interface, i.e., in 
applications/admin/static: 

ln -s _2.9.5 .

because the HTML generated have tags like this:


https://t5.m16e.com/admin/static/_2.7.3/js/jquery.js>" 
type="text/javascript">



I also noticed that one particular application stopped losing sessions in 
one of its controllers. All the other apps are working fine.

Both servers are running Debian wheezy, though the previous one (which 
wasn't fully configured by me) is running in a virtualenv.

Both servers are running apache + wsgi (same config, except for the 
certificate, which was a new one).

My question is: any one has a hint of where should I look to fix this?

-- 
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] Help with Application-Specific pattern based routes

2014-08-15 Thread Manuele Pesenti
Hi!
Can somebody show me few examples of routes_in and routes_out variables
for a pattern based and Application-Specific routes.py file please?

Thanks a lot

Manuele

-- 
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] help

2014-08-05 Thread ROHIT NEGI
Hi
I am new to web2py and I'm quite confused as to how I will be able to 
deploy application on web? Even if I make a web2py app, how will I be able 
to make a site from it as I'm making apps on the web2py site?

-- 
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] Help! Invalid request when the url has special characters in it. e.g. -> abcd%2Bfdf.jpg

2014-07-26 Thread kenny c
I am currently working on generating a jpg file and the filename contains 
special characters in it.

when the link to image file is "www.somedomain.com/abcd%2Bfdf.jpg" It gives 
"invalid request" error. 

I am currently using "request.args" to read the filename.

I tried to understand routes.py but I didn't know how it should be 
configured. Thank you.

-- 
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] Help me stop bashing me head on keyboard...

2014-07-24 Thread Jesse Ferguson
I have a Form that will submit to multiple tables, most items reference 
items.. For the life of me I cannot figure out how to make the form item 
not a select box (default behavior). I would like a input/suggest input 
field and if the input is not in db I would like to add it to DB. If it is 
in DB then just reference it.. If that doesn't make sense then just picture 
a "TAG" input field and you want to let users make there own tags and have 
them added to db.tags, however if the tag exists then you just want to 
reference it...

For some reason my brain is just drawing a blank so sorry if this is a 
beaten dead horse question.

-- 
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] Help building a query to use in SQLFORM.grid

2014-07-20 Thread asumal
Hello everyone,

I am having troubles building a query that can be used in SQLFORM.grid.

#models
db.define_table('boats', Field('category_of_boat'), Field('value_of_boat'))

I want to get the the record with the smallest value for each category, but 
I don't know how to properly use aggregate functions with SQLFORM.grid(). 
Any ideas?

-- 
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] help with join

2014-07-09 Thread Fabiano Almeida
Hi,

I'm trying to do a join table auth_user and auth_membership. I need the
list of users with membership.group_id in [2,3,4].

I tried to create a query for membership before the join, but it did not
work.

Is to make this join? How?

Thanks in advance,

Fabiano.

-- 
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] Help with the eb2py calendar?

2014-05-21 Thread Cliff Kachinske

Here is what I want to do.

I have several divs with date field inside them. It uses the Web2py 
calendar widget.

I want to trap the onSelect event for the calendar widget and trigger an 
ajax call when that happens.  I know I can put a fake submit button next to 
the calendar widget and trigger ajax on its click event, but I think it 
would be slicker to fire the ajax when the calendar changes.

Any thoughts?

Thank you,
Cliff Kachinske

-- 
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] help with helper!

2014-05-14 Thread Carlos Costa
Are you using it in the MENU helper?


2014-05-14 20:14 GMT-03:00 greenpoise :

> I tried this but didnt work. I am using it in the menu section
>
>
> Thanks
>
>
>
> On Wednesday, May 14, 2014 3:59:19 PM UTC-7, yamandu wrote:
>
>> Like this
>>
>> A(I(_class="fa-home"),SPAN("Home",_class="menu-item-parent"),_href="index.html",
>> _title="Home")
>>
>>
>> 2014-05-14 18:59 GMT-03:00 greenpoise :
>>
>>> I need help with this helper!
>>>
>>> I have this
>>>
>>>  >> "menu-item-parent">Home
>>>
>>>
>>> and I made this:
>>>
>>> [A(I(SPAN(_class=('menu-item-parent','Home')), _class='fa-home',_title=
>>> 'Home',), False, None, []),]
>>>
>>>
>>>
>>> I am missing the URL('home") cant get it to work. Where should I put it?
>>>
>>>
>>> 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+un...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Att.
>>
>> Carlos J. Costa
>> Cientista da Computação
>> Esp. Gestão em Telecom
>>
>> EL MELECH NEEMAN!
>> אָמֵן
>>
>>   --
> 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.
>



-- 
Att.

Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן

-- 
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] Help with a helper!

2014-05-14 Thread Danel Segarra
I cant get this one:

 Home


I have this so far:

[A(I(SPAN(_class=('menu-item-parent','Home')), _class='fa-home',_title=
'Home',), False, None, []),]

I am missing the URL part. Dont know where it goes!

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.


Re: [web2py] help with helper!

2014-05-14 Thread greenpoise
I tried this but didnt work. I am using it in the menu section


Thanks



On Wednesday, May 14, 2014 3:59:19 PM UTC-7, yamandu wrote:
>
> Like this
>
> A(I(_class="fa-home"),SPAN("Home",_class="menu-item-parent"),_href="index.html",
>  
> _title="Home")
>
>
> 2014-05-14 18:59 GMT-03:00 greenpoise >:
>
>> I need help with this helper!
>>
>> I have this
>>
>>  > "menu-item-parent">Home
>>
>>
>> and I made this:
>>
>> [A(I(SPAN(_class=('menu-item-parent','Home')), _class='fa-home',_title=
>> 'Home',), False, None, []),]
>>
>>
>>
>> I am missing the URL('home") cant get it to work. Where should I put it?
>>
>>
>> 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+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Att.
>
> Carlos J. Costa
> Cientista da Computação
> Esp. Gestão em Telecom
>
> EL MELECH NEEMAN!
> אָמֵן
>
> 

-- 
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] help with helper!

2014-05-14 Thread Carlos Costa
Like this

A(I(_class="fa-home"),SPAN("Home",_class="menu-item-parent"),_href="index.html",
_title="Home")


2014-05-14 18:59 GMT-03:00 greenpoise :

> I need help with this helper!
>
> I have this
>
>   "menu-item-parent">Home
>
>
> and I made this:
>
> [A(I(SPAN(_class=('menu-item-parent','Home')), _class='fa-home',_title=
> 'Home',), False, None, []),]
>
>
>
> I am missing the URL('home") cant get it to work. Where should I put it?
>
>
> 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.
>



-- 
Att.

Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן

-- 
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] help with helper!

2014-05-14 Thread greenpoise
I need help with this helper!

I have this

 Home


and I made this:

[A(I(SPAN(_class=('menu-item-parent','Home')), _class='fa-home',_title=
'Home',), False, None, []),]



I am missing the URL('home") cant get it to work. Where should I put it?


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.


Re: [web2py] HELP: REST service problem when api in remote server.

2014-05-02 Thread Richard Vézina
Hello Charles,

I think you miss the views in prod for your parser controller and api
function...

http://web2py.com/books/default/chapter/29/10/services?search=generic#Generic-views


For security reasons the generic views are only allowed to be accessed on
localhost. In order to enable the access from remote clients you may need
to set the response.generic_patterns.

Richard


On Fri, May 2, 2014 at 12:13 AM, Charles Levesque <
dreamtoolovert...@gmail.com> wrote:

> Hi everyone,
>
> I have a problem with my application. It is a function that uses the
> @request.restful() decorator. The app gets events from Google Calendar urls
> (those are in the sqlite database). For example: if you request (GET)
> http://theapiserver/calendar/parser/api/ets.json, you'll get all the
> events of the "ets" calendar.
>
> The problem is when I do the same request locally, it works very well, but
> if I test it on my certification server, it fails. It is not a 500. The
> message is "*Invalid view (parser/api.html)*" like if I was requesting
> the HTML view
> but I don't. If you look at the screenshots, you can see that there is
> ".json" at the end of the URL. The same thing happens when I replace json
> for xml. It works fine locally.
>
> I debugged it locally and remotely and my code is doing what it's suppose
> to do. There is surely something I'm missing on REST services with Web2Py.
>
> I sent with this message my application and two screenshots (one for
> successful local request and one for the remote request that fails). It
> would be greatly appreciated if someone could help me.
>
> You can request the certification server if you want. The address is
> appletscertif.cloudapp.net:8000. I did some URL rewrite so instead of
> appletscertif.cloudapp.net
> :8000 
> /calendar/parser/api/ets, you can simply put
> appletscertif.cloudapp.net
> :8000 /calendar/ets.
>
> Thank you for your time.
>
> Charles
>
> --
> 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] Help defining architecture for app

2014-04-02 Thread Francisco Betancourt
Hello everyone.

I need some help defining the architecture for an application. We already 
have something in place, but the size of the the users data files is making 
the site very unresponsive. The app works as follows:


   1. The user uploads a csv file
   2. The user file is read to a table for further processing
   3. The user previews the data I read from his file (to see if everything 
   is ok)
   4. If data is ok he clicks a button which will make us generate an xml 
   (using some of the data he uploaded) and send the xml to a web service
   5. The web service is not ours, and we must send the xml files one at a 
   time (though we can send hundreds simultaneously)
   6. The web service returns data, and we store that data into the db
   7. Once done we offer a print friendly version of the final data

So currently we are doing the following:

   1. Receive a file, and once saved we process it with web2py built in 
   import from csv.
   2. Once data has been read we show a view with all the rows and a button 
   to start the process
   3. Using js we send groups of 20 rows at a time through ajax, to be 
   processed (to xml) and sent to the web service
   4. Each ajax call returns js code to update a progress bar

Originally this files were suppose to consist of hundreds hardly a thousand 
row, but in the end we have files with 15000 rows and the average is about 
4000. Incredibly the view (even with 15000 rows and js) works well. But the 
site becomes quite unresponsive (especially because there are normally a 
dozen or so users doing the same thing simultaneously).

We have already done as many optimizations as we know (use migrate=False 
for db, call session.forget in ajax controller functions, byte compile the 
code) but it still is way too slow. So we are making some heavy changes. I 
want to try to use the scheduler and workers to do this job, but I fear it 
will generate even more db queries and make things worse. So I would like 
some suggestions on how to tackle this problem??

Is scheduler the way to go? An if so should I make a task for every xml and 
webservice call (this seems like a bad idea to me). Or should I group them 
in chunks of an arbitrary size (e.g. 50)? And if I make this change will I 
be able to display the progress of the process?

Thanks for all the help. Good day.

-- 
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] Help with SQL Query without using executesql preferably :)

2014-03-10 Thread brahama von
This is the result i get from a simple select like this:

legacy_db(legacy_db.cursodado.gp_pro_id==course).select()

cursodado.gp_id cursodado.gp_pro_id cursodado.gp_historicdate 
cursodado.gp_curso_id 

10003600042014-01-27 16:02:10None


10003600042014-01-27 17:18:31None


10003600042014-01-27 17:21:02None


10005250042014-01-27 16:02:10None


10005250042014-01-27 17:18:31None


10005250042014-01-27 17:21:02None









Here i get the id of the person and the id of the course but I want only to 
show the first I once, that correspond to the max(cursodado.gp_historicdate)
To see it like this:

cursodado.gp_id cursodado.gp_pro_id cursodado.gp_historicdate 
cursodado.gp_curso_id 








10003600042014-01-27 17:21:02None








10005250042014-01-27 17:21:02None

tried this in the select but it gives a timeout:

select(groupby=gp_id,having=max(historicdate field))

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.


Re: [web2py] help with jsonrpc

2014-03-03 Thread Dave S


On Saturday, March 1, 2014 4:34:42 PM UTC-8, Trevor Overman wrote:
>
> Finally got things working. For anyone out there reading this, I fixed the 
> problem by utilizing urlfetch in GAE.
>

Works with curl, or works with your Android app? 

In either case, thanks for the update!

/dps


> @service.jsonrpc
> def test_add(a,b):
> number_sum = a+b
> db.testing.insert(number_sum=number_sum)
> return a+b
>
> def test():
> from gluon.contrib.simplejsonrpc import ServerProxy
> from google.appengine.api import urlfetch
> URL = "http://www.conex.us/conexus/default/call/jsonrpc";
> urlfetch.set_default_fetch_deadline(60)
> service = ServerProxy(URL, verbose=True)
> test = service.test_add(1, 2)
> return test
>
> Anyway, thanks for the help! :)
>
>

-- 
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/groups/opt_out.


Re: [web2py] help with jsonrpc

2014-03-01 Thread Trevor Overman
Finally got things working. For anyone out there reading this, I fixed the 
problem by utilizing urlfetch in GAE.

@service.jsonrpc
def test_add(a,b):
number_sum = a+b
db.testing.insert(number_sum=number_sum)
return a+b

def test():
from gluon.contrib.simplejsonrpc import ServerProxy
from google.appengine.api import urlfetch
URL = "http://www.conex.us/conexus/default/call/jsonrpc";
urlfetch.set_default_fetch_deadline(60)
service = ServerProxy(URL, verbose=True)
test = service.test_add(1, 2)
return test

Anyway, thanks for the help! :)

-- 
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/groups/opt_out.


Re: [web2py] help with jsonrpc

2014-03-01 Thread Jonathan Lundell
On 1 Mar 2014, at 11:46 AM, Trevor Overman  wrote:
> So I'm trying to connect an android application to my web2py website back end 
> database by using json remote procedure calls.
> Currently, I am trying to make a simple test function to remotely add entries 
> in the db.
> Additionally, I am running on GAE.
> 
> What I have right now is:
> 
> db.py
> db.define_table('testing',
> Field('number_sum','string'),
> )
> 
> default.py
> def call():
> return service()
> 
> @service.jsonrpc
> def test_add(a,b):
> sum = a+b
> db.testing.insert(numer_sum=sum)
> return a+b
> 
> when I run the following in terminal,
> curl http://domain/app/default/call/run/test_add?a=3&b=4
> 
> I receive an "Object does not exist" error. 
> Any help would be appreciated!

Change 'run' to 'jsonrpc', since that's how you declared test_add. But curl 
isn't going to create a jsonrpc request for you, so that part won't work.

If you want the curl request to work (with /run/), you need @service.run rather 
than @service.jsonrpc.


-- 
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/groups/opt_out.


[web2py] help with jsonrpc

2014-03-01 Thread Trevor Overman
So I'm trying to connect an android application to my web2py website back 
end database by using json remote procedure calls.
Currently, I am trying to make a simple test function to remotely add 
entries in the db.
Additionally, I am running on GAE.

What I have right now is:

db.py
db.define_table('testing',
Field('number_sum','string'),
)

default.py
def call():
return service()

@service.jsonrpc
def test_add(a,b):
sum = a+b
db.testing.insert(numer_sum=sum)
return a+b

when I run the following in terminal,
curl http://domain/app/default/call/run/test_add?a=3&b=4

I receive an "Object does not exist" error. 
Any help would be appreciated!

-Trevor

-- 
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/groups/opt_out.


[web2py] HELP with bootstrap 3

2014-02-23 Thread Massimo Di Pierro
Urgent. We need help fixing the bootstrap 3 menu in welcome in trunk. 
Can it be done without changing any python code, except perhaps the MENU 
helper?

-- 
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/groups/opt_out.


Re: [web2py] help with request

2014-01-10 Thread Jonathan Lundell
On 10 Jan 2014, at 12:16 AM, Tarun Kumar  wrote:
> Hi! people I am new to web2py and web development. I am a bit confused about 
> the request object. In its variables which can be accessed by 
> request.vars.variable_name are the values stored only for the most recent 
> request or for all the past requests. 
> Considering the example given in web2py book overview section in which we use 
> action attribute of the form and in the second function retrieve the visitors 
> name using request.vars.visitor_name. My question is now that after a 
> redirect to some other page will request.vars.visitor_name still be 
> accessible?


Request is only the current request.

request.vars is a dictionary representing the URL's query string. If you want 
request.vars.visitor_name to be visible after a redirect, you must include it 
in the query string of the URL you're redirecting to.

Alternatively you could store the visitor_name in session, making it visible to 
subsequent requests.

-- 
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/groups/opt_out.


[web2py] help with request

2014-01-10 Thread Tarun Kumar
Hi! people I am new to web2py and web development. I am a bit confused 
about the request object. In its variables which can be accessed by 
request.vars.variable_name are the values stored only for the most recent 
request or for all the past requests. 
Considering the example given in web2py book overview section in which we 
use action attribute of the form and in the second function retrieve the 
visitors name using request.vars.visitor_name. My question is now that 
after a redirect to some other page will request.vars.visitor_name still be 
accessible?

Thanks in advanced and sorry if I am acting too dumb 

-- 
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/groups/opt_out.


[web2py] Help with query from multiple tables and groupby

2013-12-31 Thread Francisco
Hello Guys (by the way Happy New Year everyone).

I'm having a problem writing a query to get product details, price and only 
one image for every product.

I have tables like this:

*db.define_table('price_lists'*
*Field('name')*
*)*
*db.define_table('products',*
*Field('name'),*
*Field('description'),*
*...)*
*db.define_table('product_prices',*
*Field('product_id',db.products),*
*Field('price_list_id',db.price_lists),*
*Field('price',type='decimal(14,6)')*
*)*
*db.defin_table('product_images',*

*Field('product_id',db.products),*
*Field('image',type='upload')*

I was doing this with sqlite and mysql:

*prod_query = (db.products.id==db.product_prices.product_id) &*
*(db.product_prices.price_list_id==current_list_id)*
*products = 
db(prod_query).select(left=db.product_images.on(db.products.id==db.product_images.product_id),*
*groupby=db.products.id)*

 but now that we tested with postgres it just wont work, so I fixed the 
query with the following:

*prod_query = (db.products.id==db.product_prices.product_id) &*
*(db.product_prices.price_list_id==current_list_id)*
*products = 
db(prod_query).select(left=db.product_images.on(db.products.id==db.product_images.product_id),*
*groupby=db.products.id|db.product_prices.id|db.product_images.id)*

but then if a product has two prices or images it will appear more than 
once.

How can I fix it for postgres??? I have search the forum but haven't found 
anything like this.

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/groups/opt_out.


Re: [web2py] Help me understand how to create a search

2013-12-23 Thread Marco Mansilla
El Mon, 23 Dec 2013 13:08:20 -0800 (PST)
Keith Planer  escribió:

> I'm new to web2py, and Python. I created a database, and I want to
> create a page where I can return records from a table of people,
> using their first and last names as search terms. What I have so far
> is:
> 
> def patient_lookup():
> 
> #form = SQLFORM.grid(db.consumer, deletable = True)
> 
>form=SQLFORM.factory(
>  Field('Lname', requires=IS_IN_SET(consumer)),
>  Field('Fname', requires=IS_IN_SET(consumer)),
>  submit_button="Search")
> if form.accepts(request.vars, session):
> consumer=db.consumer(id).select()
> return dict(form=form)
> 
> 
> My error:
> 
> 
> Traceback (most recent call last):
>   File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line
> 217, in restricted File
> "C:/web2py_src/web2py/applications/facesheet/controllers/default.py",
> line 64, in  File
> "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 372, in
>  File
> "C:/web2py_src/web2py/applications/facesheet/controllers/default.py",
> line 38, in patient_lookup Field('Lname',
> requires=IS_IN_SET(consumer)), UnboundLocalError: local variable
> 'consumer' referenced before assignment
> 
> 
> 

Would you please show your model file?... it seems that consumer table
isn't created yet... is this right?

-- 
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/groups/opt_out.


[web2py] Help me understand how to create a search

2013-12-23 Thread Keith Planer
I'm new to web2py, and Python. I created a database, and I want to create a 
page where I can return records from a table of people, using their first 
and last names as search terms. What I have so far is:

def patient_lookup():

#form = SQLFORM.grid(db.consumer, deletable = True)

   form=SQLFORM.factory(
 Field('Lname', requires=IS_IN_SET(consumer)),
 Field('Fname', requires=IS_IN_SET(consumer)),
 submit_button="Search")
if form.accepts(request.vars, session):
consumer=db.consumer(id).select()
return dict(form=form)


My error:


Traceback (most recent call last):
  File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line 217, in 
restricted
  File "C:/web2py_src/web2py/applications/facesheet/controllers/default.py", 
line 64, in 
  File "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 372, in 

  File "C:/web2py_src/web2py/applications/facesheet/controllers/default.py", 
line 38, in patient_lookup
Field('Lname', requires=IS_IN_SET(consumer)),
UnboundLocalError: local variable 'consumer' referenced before assignment



-- 
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/groups/opt_out.


[web2py] help-block in Bootstrap forms

2013-12-12 Thread Annet
Some field definitions in my models have comments, which in a Bootstrap 
form are
being displayed in a help-block.

The problem is that this help-block

my comment

is added to every form field, resulting in 20 px of extra padding between 
form fields, margin-bottom: 10px
and margin-bottom: 5px. Is there a way to make adding a help-block 
conditional?

So far I made the following adjustments to a custom formstyle function:

def bootstrap3(form, fields):
form.add_class('form-horizontal')
parent = FIELDSET()
for id, label, controls, help in fields:
# wrappers
_help = SPAN(help, _class='help-block')
# embed _help into _controls
_controls = DIV(controls, _help, _class='controls col-sm-8')
# submit unflag by default
_submit = False

if isinstance(controls, INPUT):
controls.add_class('form-control')
if controls['_type'] == 'submit':
# flag submit button
_submit = True
controls['_class'] = 'btn btn-primary'
if controls['_type'] == 'file':
controls['_class'] = 'input-file'

# For password fields, which are wrapped in a CAT object.
if isinstance(controls, CAT) and isinstance(controls[0], INPUT):
controls[0].add_class('form-control')

if isinstance(controls, SELECT):
controls.add_class('form-control')

if isinstance(controls, TEXTAREA):
controls.add_class('form-control')

if isinstance(label, LABEL):
label['_class'] = 'col-sm-4 control-label'

if _submit:
# submit button has unwrapped label and controls, different 
class
parent.append(DIV(label, controls, _class='col-sm-offset-4 
col-sm-8 form-actions', _id=id))
# unflag submit (possible side effect)
_submit = False
else:
# unwrapped label
parent.append(DIV(label, _controls, _class='form-group', 
_id=id))
return parent



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/groups/opt_out.


[web2py] Re: web2py help

2013-12-12 Thread 黄祥

>
>
>
>1. When the user perform a successful register process, i need to 
>perform an insert of that user in a new table. Not sure where i can embed 
>this process
>
> please take a look at the book for record versioning
ref:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=versioning#Record-versioning
 

>
>1. After the admin approve the registered user i need to redirect him 
>to another URL, also not sure where i can embed the REDIRECT('URL')
>
> please take a look access control in the book 
http://web2py.com/books/default/chapter/29/09/access-control

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/groups/opt_out.


Re: [web2py] web2py help

2013-12-11 Thread Johann Spies
On 9 December 2013 22:19, Michel Hayek  wrote:

> Hey guys,
>
> i need your help i'm new to web2py and trying to use all its features. i
> need help in 2 things
>

You will get better help if you post the code of what you have tried so far.

Did you browse or read the book (http://www.web2py.com/book)?

>
>
>1. When the user perform a successful register process, i need to
>perform an insert of that user in a new table. Not sure where i can embed
>this process
>
>
It is unclear what you are trying to do that.  Code will enlighten us.

>
>1. After the admin approve the registered user i need to redirect him
>to another URL, also not sure where i can embed the REDIRECT('URL')
>
>
If you search the book for 'redirect'  you will find many examples of how
to to do it.


Regards
Johann


-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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/groups/opt_out.


[web2py] web2py help

2013-12-09 Thread Michel Hayek
Hey guys,

i need your help i'm new to web2py and trying to use all its features. i 
need help in 2 things


   1. When the user perform a successful register process, i need to 
   perform an insert of that user in a new table. Not sure where i can embed 
   this process
   2. After the admin approve the registered user i need to redirect him to 
   another URL, also not sure where i can embed the REDIRECT('URL')

Thanks for your help

-- 
 

*This e-mail is confidential and may also be privileged. If you are not the 
intended **recipient, please notify the sender immediately, delete it from 
your system and do **not copy, disseminate, distribute or disclose any 
information contained therein.*

-- 
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/groups/opt_out.


[web2py] Help with production deployment on virtual server

2013-10-22 Thread curiouslearn
I want to get web2py running on a Digital Ocean virtual server with nginx 
and uWSGI. I followed the instructions on deployment recipes in Web2py 
book, but things are not working. The following are the differences between 
the instructions given in the book and my specific case. 

*Differences from instructions given in web2py deployment recipes*
(1) I have web2py installed in "/home/username/web_apps/web2py" instead of 
in "/home/www-data/web2py"
(2) The configuration file is called 
"/etc/nginx/sites-available/myconfig.org" instead of "
/etc/nginx/sites-available/web2py"
(3) For now I am ignoring settings related to ssl since I am just trying to 
get this to work.

*The configuration I am using:*

*1.* In the nginx file I have the following. Since I have other non-web2py 
apps running I don't want to listen on 80:

*server {*
*
*
*server_name $hostname;*
*listen 9001; *
*access_log /var/log/nginx/me.log;*
*
*
*location / {*
*uwsgi_pass unix:///tmp/web2py.socket;*
*include uwsgi_params;*
*uwsgi_param UWSGI_SCHEME $scheme;*
*uwsgi_param SERVER_SOFTWARE nginx/$nginx_version;*
*}*
*}*

*
*
*2.* In the /etc/uwsgi/web2py.xml file I have:

**
*/tmp/web2py.socket   *
*/home/username/web_apps/web2py/*
*/=wsgihandler:application  *
*  *
*1   *
*60*
*8 *
*1 *
*/tmp/stats.socket   *
*2000  *
*512   *
*256   *
*192 *
*web_apps*
*web_apps*
*  *
**


3. The uwsgi-emperor.conf is identical to that in the instructions.

When I run sudo start uwsgi-emperor I get an error saying,

 * start: Job failed to start*

I have no clue what the error is. Would help setting this up. Where am I 
making a mistake? Do I need to start web2py separately, or is the above 
script supposed to start it?

Any help in understanding where I am going wrong and getting this working 
would be very helpful.

Thank you.
 

-- 
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/groups/opt_out.


Re: [web2py] Help me test model subfolders

2013-10-22 Thread Johann Spies
Thanks Anthony and Massimo for *Revision:* *5a3f2701b077 *in the trunk a
few hours ago.

That fixed the problem for me.  Both admin and the app works as expected.



Regards
Johann


On 22 October 2013 08:26, Johann Spies  wrote:

> On 21 October 2013 21:28, Massimo Di Pierro wrote:
>
>> I do not understand. You have
>>
>>  r'^\db\.py$',
>>
>> shouldn't this be?
>>
>>  r'^db\.py$',
>>
>>
>>
> Yes it should be.  Thanks.
>
> But that does not make any difference to the result:
>
> python web2py.py -M -S nkb/akb
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2013
> Version 2.7.4-stable+timestamp.2013.10.16.09.10.20
> Database drivers available: SQLite(sqlite2), SQLite(sqlite3),
> MySQL(pymysql), PostgreSQL(psycopg2), PostgreSQL(pg8000), MSSQL(pyodbc),
> DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), IMAP(imaplib)
>
> Traceback (most recent call last):
>   File "/home/js/web2py/gluon/restricted.py", line 217, in restricted
> exec ccode in environment
>   File "applications/nkb/models/akb/akb.py", line 22, in 
>
> db.executesql("set search_path to akb, public;")
> NameError: name 'db' is not defined
>
> js@artikel ~/web2py> tail applications/nkb/models/0.py
> response.models_to_run = [
> r'^0\.py$',
> r'^db\.py$',
> r'^dbcommon\.py$',
> r'^%s/\w+\.py$' % request.controller,
> r'^%s/%s/\w+\.py$' % (request.controller, request.function)
>
>
> Regards
> Johann
>



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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/groups/opt_out.


Re: [web2py] Help me test model subfolders

2013-10-21 Thread Johann Spies
On 21 October 2013 21:28, Massimo Di Pierro wrote:

> I do not understand. You have
>
>  r'^\db\.py$',
>
> shouldn't this be?
>
>  r'^db\.py$',
>
>
>
Yes it should be.  Thanks.

But that does not make any difference to the result:

python web2py.py -M -S nkb/akb
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2013
Version 2.7.4-stable+timestamp.2013.10.16.09.10.20
Database drivers available: SQLite(sqlite2), SQLite(sqlite3),
MySQL(pymysql), PostgreSQL(psycopg2), PostgreSQL(pg8000), MSSQL(pyodbc),
DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), IMAP(imaplib)
Traceback (most recent call last):
  File "/home/js/web2py/gluon/restricted.py", line 217, in restricted
exec ccode in environment
  File "applications/nkb/models/akb/akb.py", line 22, in 
db.executesql("set search_path to akb, public;")
NameError: name 'db' is not defined

js@artikel ~/web2py> tail applications/nkb/models/0.py
response.models_to_run = [
r'^0\.py$',
r'^db\.py$',
r'^dbcommon\.py$',
r'^%s/\w+\.py$' % request.controller,
r'^%s/%s/\w+\.py$' % (request.controller, request.function)


Regards
Johann

-- 
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/groups/opt_out.


Re: [web2py] Help me test model subfolders

2013-10-21 Thread Massimo Di Pierro
I do not understand. You have

 r'^\db\.py$',

shouldn't this be?

 r'^db\.py$',





On Monday, 21 October 2013 04:20:01 UTC-5, Johann Spies wrote:
>
> Hallo Massimo,
>
>
> There is a problem with sorting of model subfolders in 2.7.2. We made some 
>> changes in trunk. 
>>
>
> After this morning's updates from the trunk I got problems for the first 
> time which reflected a sorting problem:
>
> Traceback (most recent call last):
>
>   File "/home/js/web2py/gluon/restricted.py", line 217, in restricted
>
> exec ccode in environment
>   File "/home/js/web2py/applications/nkb/models/akb/akb.py", line 22, in 
> 
>
> db.executesql("set search_path to akb, public;")
> NameError: name 'db' is not defined
>
>
>  And my models directory:
>
> -rw-r--r--  1 js js  1196 Okt 11 07:43 0.py
> -rw-r--r--  1 js js  1354 Okt 10 23:02 0.py.orig
> drwxr-xr-x  2 js js  4096 Okt  8 14:44 akb
> -rw-r--r--  1 js js  7845 Okt 11 07:44 dbcommon.py
> -rw-r--r--  1 js js  7994 Okt 10 23:13 dbcommon.py.orig
> -rw-r--r--  1 js js  9459 Okt 11 07:44 db.py
> -rw-r--r--  1 js js  9504 Okt 10 23:07 db.py.orig
> drwxr-xr-x  2 js js  4096 Okt 21 10:41 isi
> -rw-r--r--  1 js js 11652 Okt  8 14:44 menu.py
> -rw-r--r--  1 js js 10060 Aug 29 09:30 menu.py.orig
> drwxr-xr-x  2 js js  4096 Okt  8 14:44 sabinet
>
>
> Please help me check that:
>>
>> [ ] if you have a byte-compiled app, it still runs fine
>> [ ] if you byte-compiler an app with trunk, it runs fine
>> [ ] models are executed in this order:
>> models/*.py (alphabetically) then  
>> models/*.py(alphabetically) then
>> models///*.py (also alphabetically)
>> [ ] if you set response.models_to_run (described in the book) the filter 
>> works correctly for normal apps and byte code compiled apps.
>>
>> None of the above worked for me.
>   
>
>> I have tried the following in 0.py but it did not solve the problem:
>
> response.models_to_run = [
> r'^\0\.py$',
> r'^\db\.py$',
> r'^\dbcommon\.py$', 
> r'^%s/\w+\.py$' % request.controller,
> r'^%s/%s/\w+\.py$' % (request.controller, request.function)
> ]
>
> In the end I go the app working again by doing:
>  
> > hg rename db.py 0db.py
> > hg rename dbcommon.py 0dbcommon.py 
>  
>
> Regards
> Johann
>  

-- 
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/groups/opt_out.


  1   2   3   4   >