[web2py] Re: Scheduler repeat time drift

2014-08-31 Thread Yi Liu
Hi, any updates on Cron_style scheduler?

Scheduler is definitely more powerful than cron? Unfortunately, it cannot 
do what cron can do simply :( I am developing a web app that scrapes a page 
at 9am every day. Really wish scheduler can do this easily.

I also read your comments here: 
http://comments.gmane.org/gmane.comp.python.web2py/112088

Even this schuduler-in-a-scheduler (schedu-ception!) workaround will 
eventually need a cleanup. Because the parent scheduler will drift one 
minute a day and eventually, on a special day, the accumulated drift will 
jump over 9:00am and skip scheduling on that day.

Btw, you web2py developers are awesome. I love web2py so much!

Best, Yi

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


[web2py] Re: Document Expired/ Need to reload page on using browser back button

2014-08-31 Thread Sarbjit
Thanks a lot Anthony for the solution.

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


[web2py] Re: SOAP API authentication

2014-08-31 Thread Matheus Cardoso
You can find your answer 
here: 
http://web2py.com/books/default/chapter/29/09/#markmin_basic_authentication

And was working like a charm. ;)

On Sunday, August 31, 2014 9:41:01 AM UTC-3, Stefan van den Eertwegh wrote:
>
> Hi,
>
> Does anyone know how to set authentication to a web2py SOAP API?
>
> 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] Re: How do I change or remove the tabkename above a SQLFORM.grid?

2014-08-31 Thread Anthony
I don't think SQLFORM.grid generates a heading like that -- what does your 
code look like?

On Sunday, August 31, 2014 9:18:55 AM UTC-4, Tom Øyvind Hogstad wrote:
>
> The default SQLFORM.grid shows the tablename as a title above the output 
> grid. I want to change or remove it.
>
>
> 
>
>

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


[web2py] Re: Philosophical help with REST

2014-08-31 Thread Tim Richardson
Helpful it would be to see your table definitions.

-- 
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] new web2py videos

2014-08-31 Thread Stef Mientki

great Nico and Massimo.

one small remark, the titles can't be read (other than hoovering),
so if I may suggest, change the title by removing "Web2py video course 
2013" (or put it at the end of the title).


cheers,
Stef



On 31-Aug-14 04:56, Massimo DiPierro wrote:

Nico has helped edit and re-organize some my class lectures about web2py. They 
are now split into 30 small videos:

 https://vimeo.com/album/3016728

Please join me in thanking Nico.

Massimo



--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: two forms submitted into the same cotroller

2014-08-31 Thread Massimo Di Pierro
This helps but I still have some questions... where is ? what is 
? is this used the output of two generated SQLFORM? or the actual 
source view?

On Sunday, 31 August 2014 14:45:02 UTC-5, Andrey K wrote:
>
> Thanks Massimo.   
> Here is my reformatted question(hope it will be more understandable): 
>  I want to present two input sets of information coming from server 
> into two sections of the same view (div1 and div2). First input set is 
> generated based on user choice control, that presented at the same view(div 
> 0), the second is user based. 
>  How to 
> 1)organize data fetching/adding INPUT sets to the view  so   
> 2)all user input can be submitted back to the server from these two input 
> data sets into one data table record, icluding  user selection choice. 
>
> Here is how it looks in the result view and DB recorde: 
>
> View: 
>
>  
>
>  SELECT(t1,t2,t3) 
>
>  
>
>  
>
>  
>
>  
>
> INPUT(_name=’file’, _value=’’, default = 0) 
>
> INPUT(_name=’parameter’, _value= , default=100) 
>
>  
>
>  
>
>  
>
>  
>
>  
>
> INPUT(_name=purpose, _value=’processing’) 
>
>  
>
>  
>
>  
>
> Db.table row result: 
>
> User_choice, file, parameter, purpose 
>
> t1   , 0 ,100, ‘processing’ 
>
>
> Thank you in advance. 
> Please let me know if you need more details. 
>
>

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


[web2py] Re: new web2py videos

2014-08-31 Thread samuel bonill
Thanks so much

El sábado, 30 de agosto de 2014 21:57:04 UTC-5, Massimo Di Pierro escribió:
>
> Nico has helped edit and re-organize some my class lectures about web2py. 
> They are now split into 30 small videos: 
>
> https://vimeo.com/album/3016728 
>
> Please join me in thanking Nico. 
>
> Massimo

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


[web2py] Re: How do I change or remove the tabkename above a SQLFORM.grid?

2014-08-31 Thread Massimo Di Pierro
You cannot remove it but you can can set

db.plant._plural = 'My Plants'

On Sunday, 31 August 2014 08:18:55 UTC-5, Tom Øyvind Hogstad wrote:
>
> The default SQLFORM.grid shows the tablename as a title above the output 
> grid. I want to change or remove it.
>
>
> 
>
>

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


[web2py] Re: two forms submitted into the same cotroller

2014-08-31 Thread Andrey K
Thanks Massimo.  
Here is my reformatted question(hope it will be more understandable): 
 I want to present two input sets of information coming from server into 
two sections of the same view (div1 and div2). First input set is generated 
based on user choice control, that presented at the same view(div 0), the 
second is user based. 
 How to
1)organize data fetching/adding INPUT sets to the view  so  
2)all user input can be submitted back to the server from these two input data 
sets into one data table record, icluding  user selection choice.

Here is how it looks in the result view and DB recorde:

View:



 SELECT(t1,t2,t3)









INPUT(_name=’file’, _value=’’, default = 0)

INPUT(_name=’parameter’, _value= , default=100)











INPUT(_name=purpose, _value=’processing’)







Db.table row result:

User_choice, file, parameter, purpose

t1   , 0 ,100, ‘processing’


Thank you in advance.
Please let me know if you need more details.

-- 
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] How do I change or remove the tabkename above a SQLFORM.grid?

2014-08-31 Thread Tom Øyvind Hogstad
The default SQLFORM.grid shows the tablename as a title above the output 
grid. I want to change or remove it.



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


[web2py] Re: Moving a file (upload) from one table to another

2014-08-31 Thread Spokes
Thanks, Niphlod - that looks like it should solve the issue. Just have a 
follow-up question - what's the best way to pass the location of the file 
to the 'open()' function? I've tried a few things, including the following:

image_filename_as_list = current_image.image.split('.')
cur_image_location = path_join(request.folder, 'uploads',
'temp_user_images',
'.'.join(image_filename_as_list[:2]), image_filename_as_list[2
][:2], current_image.image)
print "cur_image_location:",cur_image_location
stream = open(cur_image_location, 'rb')

The print statement seems to show the correct file location. However, the 
open() command causes an exception, and the exception shows a different 
file path from what was output by the print statement; specifically, the 
'temp_user_images' portion is modified to just 'images'. Any 
recommendations? Thank you.



On Sunday, August 31, 2014 11:29:44 AM UTC-5, Niphlod wrote:
>
> when you deal with upload fields, you should use the proper method (i.e. 
> store())
>
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#More-on-uploads
>
> On Sunday, August 31, 2014 2:52:45 PM UTC+2, Spokes wrote:
>>
>> I have two tables, *t_image2* and *t_image1*, and I would like to copy 
>> an image (type: 'upload') from* t_image2* to *t_image1*.The tables are 
>> something like the following: 
>>
>> db.define_table('t_image2',
>> ...
>> Field('name', requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db, '
>> t_image2.name')], unique=True, notnull=True),
>> Field('image', 'upload', uploadseparate=True, autodelete=True, 
>>   uploadfolder=os_path_join(request.folder,'uploads/temp_images'
>> ),
>>   requires=[IS_NOT_EMPTY(), IS_IMAGE()]),
>>   ...
>>   )
>>
>> db.define_table('t_image1',
>> ...
>> Field('name', requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db, '
>> t_image1.name')], unique=True, notnull=True),
>> Field('image', 'upload', uploadseparate=True, autodelete=True, 
>> uploadfolder=os_path_join(request.folder,'uploads/images'),
>> requires=[IS_NOT_EMPTY(), IS_IMAGE()]),
>> Field('thumbnail','upload',  
>>uploadseparate=True, readable=True, writable=False, autodelete
>> =True,  
>>uploadfolder=os_path_join(request.folder,'uploads/thumbnails'
>> ),
>>compute=lambda row: SMARTHUMB('t_image1', row.image, (200, 150
>> ), 
>>upload_folder = 'uploads/thumbnails', request = request)),
>>...)
>>
>> It's possible to do this:
>>
>> db.t_image1.insert(name = [some name], image = [image_from_t_image2.image
>> ])
>>
>> But this merely copies the entries that are in one table to the other, 
>> without making a copy of the file in question. It also doesn't trigger the 
>> *t_image1* 'thumbnail' field's 'compute' function, which would create 
>> the thumbnail file. 
>>
>> Is there a better way to perform this sort of file copy from one table to 
>> another, such that the copy of the file is automatically made (and if 
>> necessary, the new folder is created), and which triggers the creation of 
>> the thumbnail? Or is it necessary to perform the folder creation and file 
>> copy operation, as well as the creation of the thumbnail, manually? 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.


Re: [web2py] Re: Help in server config

2014-08-31 Thread Carlos Correia
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 31-08-2014 17:28, Niphlod wrote:
> from 2.1.0 there's static asset management.
> 
> http://web2py.com/books/default/chapter/29/04/the-core#Static-asset-management
> 

Thanks, that solves the first "mistery" (the old server was running v. 2.0.6).

Now, what could possibly be terminating the sessions in that particular app,
considering that the only change is web2py version (from 2.0.6 to 2.9.5)?

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

- -- 
Com os melhores cumprimentos,

Carlos Correia
=
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iEYEARECAAYFAlQDXaEACgkQ90uzwjA1SJVsGQCfVbSqHmBCU9Wb/qvdqKIGQ4bA
C0QAnAsBkkBV4D/nJFhpaBvWi6DDNxYm
=4Wi4
-END PGP SIGNATURE-

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


[web2py] Re: "Enter date as 1963-08-28" error

2014-08-31 Thread Niphlod
hm. sorry, you got that already: you have two fields with the same name. 
What are you trying to achieve ?

On Saturday, August 30, 2014 9:13:09 PM UTC+2, Richard wrote:
>
> I have used an sql form for adding records with date fields. 
> I added 2 date fields on a table like I did before, now I get only on this 
> form the error " Enter date as 1963-08-28"  pops up when entering a date.
> On the other forms the datepicker is working fine.
>
> In db.py
> db.define_table('local_ev_def',
> ...
> Field('ev_start_date', 'date', required=True,
>   label=T('EV start date')),
> Field('ev_end_date', 'date',  required=True,
>   label=T('EV end date')),
> .
>
> In Controller
> form_add_local_ev_def = SQLFORM(db.local_ev_def,
> fields=['lev_def_name', 'description', 
> 'homeostat', 'global_ev', 'period',
> 'ev_start_date', 'ev_start_date', 
> 'data_type', 'unit'])
> if form_add_local_ev_def.process(formname='add_lev_def').accepted:
> .
>
> What may cause this error?
>
> The answer is a double ev_start_date field. The error is misleading, 
> should this be included in the form validation?
>
> Richard D
>
>

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


[web2py] Re: Moving a file (upload) from one table to another

2014-08-31 Thread Niphlod
when you deal with upload fields, you should use the proper method (i.e. 
store())

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#More-on-uploads

On Sunday, August 31, 2014 2:52:45 PM UTC+2, Spokes wrote:
>
> I have two tables, *t_image2* and *t_image1*, and I would like to copy an 
> image (type: 'upload') from* t_image2* to *t_image1*.The tables are 
> something like the following: 
>
> db.define_table('t_image2',
> ...
> Field('name', requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db, '
> t_image2.name')], unique=True, notnull=True),
> Field('image', 'upload', uploadseparate=True, autodelete=True, 
>   uploadfolder=os_path_join(request.folder,'uploads/temp_images'),
>   requires=[IS_NOT_EMPTY(), IS_IMAGE()]),
>   ...
>   )
>
> db.define_table('t_image1',
> ...
> Field('name', requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db, '
> t_image1.name')], unique=True, notnull=True),
> Field('image', 'upload', uploadseparate=True, autodelete=True, 
> uploadfolder=os_path_join(request.folder,'uploads/images'),
> requires=[IS_NOT_EMPTY(), IS_IMAGE()]),
> Field('thumbnail','upload',  
>uploadseparate=True, readable=True, writable=False, autodelete=
> True,  
>uploadfolder=os_path_join(request.folder,'uploads/thumbnails'),
>compute=lambda row: SMARTHUMB('t_image1', row.image, (200, 150
> ), 
>upload_folder = 'uploads/thumbnails', request = request)),
>...)
>
> It's possible to do this:
>
> db.t_image1.insert(name = [some name], image = [image_from_t_image2.image
> ])
>
> But this merely copies the entries that are in one table to the other, 
> without making a copy of the file in question. It also doesn't trigger the 
> *t_image1* 'thumbnail' field's 'compute' function, which would create the 
> thumbnail file. 
>
> Is there a better way to perform this sort of file copy from one table to 
> another, such that the copy of the file is automatically made (and if 
> necessary, the new folder is created), and which triggers the creation of 
> the thumbnail? Or is it necessary to perform the folder creation and file 
> copy operation, as well as the creation of the thumbnail, manually? 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] Re: Help in server config

2014-08-31 Thread Niphlod
from 2.1.0 there's static asset management.

http://web2py.com/books/default/chapter/29/04/the-core#Static-asset-management



On Sunday, August 31, 2014 4:45:18 PM UTC+2, Carlos Correia wrote:
>
>
> Reinstalled in a virtual machine with the same config (Debian 
> wheezy+apache+wsgi), just to confirm. Please take a look at the way the 
> admin interface looks :(
>
> Why is web2py rendering the links like this (
>
>  type="text/javascript">)?
>
> I would appreciate *very much *any help.
>
> Thanks,
>
>
> Sábado, 30 de Agosto de 2014 20:25:08 UTC+1, Carlos Correia escreveu:
>>
>> 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:
>>
>>
>> > 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] Re: Help in server config

2014-08-31 Thread Carlos Correia

Reinstalled in a virtual machine with the same config (Debian 
wheezy+apache+wsgi), just to confirm. Please take a look at the way the 
admin interface looks :(

Why is web2py rendering the links like this (

)?

I would appreciate *very much *any help.

Thanks,


Sábado, 30 de Agosto de 2014 20:25:08 UTC+1, Carlos Correia escreveu:
>
> 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:
>
>
>  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] Re: Document Expired/ Need to reload page on using browser back button

2014-08-31 Thread Anthony
The problem is that you are making a POST request to return the grid, which 
is fundamentally a GET action. When you use the browser back button to try 
to return to a page that was requested via POST, the browser will typically 
display a message indicating the page has expired (because responses to 
POST requests are not cacheable) and make you jump through some hoops to 
re-submit the request (this is because POST requests generally result in 
changes to resources, so it is assumed you do not want to re-submit and 
repeatedly make the same change simply by hitting the back button).

In this case, a better approach would be to make a GET request by changing 
the form method to "get". However, that will put "var1" and "testval" into 
the query string of the /default/results URL, which you may not want. As an 
alternative, you can submit the form back to the index function and then 
have the index function redirect to the results function after saving 
"var1" to the session:

In index.html, change the form method to "get":



In the controller:

def index():
if request.vars:
if request.vars.testval and session.var1:
del session.var1
if request.vars.var1 and not session.var1:
   session.var1 = request.vars.var1
redirect(URL('default', 'results'))
return dict(message='Hello World')

def results():
grid = {}
if session.var1:
query = (db.Category.Name==session.var1)
grid = SQLFORM.grid(query=query)
return dict(grid=grid)

Anthony

On Saturday, August 30, 2014 1:14:25 AM UTC-4, Sarbjit wrote:
>
> Hi Anthony,
>
> I am able to reproduce this problem in a small app (tested on windows - 
> 2.9.5).
>
> *MODEL:*
>
> db.define_table('Category',
> Field('Name'),
> Field('SubCategoryName'))
>  
> # Insert test data 
>  
> if db(db.Category.id>0).count() == 0:
> db.Category.insert(Name='PC',SubCategoryName='Intel')
> db.Category.insert(Name='PC',SubCategoryName='AMD')
> db.Category.insert(Name='SmartPhone',SubCategoryName='Apple')
> db.Category.insert(Name='SmartPhone',SubCategoryName='HTC')
> db.Category.insert(Name='SmartPhone',SubCategoryName='Google')
>
> *CONTROLLER:*
>
> def index():
> response.flash = T("Welcome to web2py!")
> return dict(message=T('Hello World'))
>
> def results():
> if (request.vars.testval and session.var1):
> try:
> del session.var1
> except Exception : pass
> if (request.vars.var1) and (not session.var1):
>session.var1 = request.vars.var1
> grid = {}
> if session.var1:
> query = (db.Category.Name==session.var1)
> grid = SQLFORM.grid(query=query)
> return dict(grid=grid)
>
> *VIEWS:*
>
> *results.html*
>
> {{extend 'layout.html'}}
> {{=grid}}
>
> *index.html*
>
> {{extend 'layout.html'}}
>  action={{=URL('default','results')}} >
> 
> PC
> Smart Phone
> 
> 
> 
> 
>
> *Steps to reproduce the problem :-*
>
> 1. Select any value from the drop down and hit submit button.
> 2. Select any GRID row and click on View
> 3. Use Browser Back button -> Document will expire, you have to refresh to 
> get the results back (Tried on Chrome/Firefox)
> 4. Repeat Step2
> 5. Now instead of using Browser back button, use GRID embedded back button.
> 6. Now repeating step 2-3 won't cause any problem (document won't expire) 
> until the new selection is made from the selection drop down.
>
> Please suggest something to resolve this problem. 
>
> Thanks
> Sarbjit
>

-- 
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] Moving a file (upload) from one table to another

2014-08-31 Thread Spokes
I have two tables, *t_image2* and *t_image1*, and I would like to copy an 
image (type: 'upload') from* t_image2* to *t_image1*.The tables are 
something like the following: 

db.define_table('t_image2',
...
Field('name', requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 't_image2.name'
)], unique=True, notnull=True),
Field('image', 'upload', uploadseparate=True, autodelete=True, 
  uploadfolder=os_path_join(request.folder,'uploads/temp_images'),
  requires=[IS_NOT_EMPTY(), IS_IMAGE()]),
  ...
  )

db.define_table('t_image1',
...
Field('name', requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 't_image1.name'
)], unique=True, notnull=True),
Field('image', 'upload', uploadseparate=True, autodelete=True, 
uploadfolder=os_path_join(request.folder,'uploads/images'),
requires=[IS_NOT_EMPTY(), IS_IMAGE()]),
Field('thumbnail','upload',  
   uploadseparate=True, readable=True, writable=False, autodelete=
True,  
   uploadfolder=os_path_join(request.folder,'uploads/thumbnails'),
   compute=lambda row: SMARTHUMB('t_image_user_submit', row.image, (
200, 150), 
   upload_folder = 'uploads/thumbnails', request = request)),
   ...)

It's possible to do this:

db.t_image1.insert(name = [some name], image = [image_from_t_image2.image])

But this merely copies the entries that are in one table to the other, 
without making a copy of the file in question. It also doesn't trigger the 
*t_image1* 'thumbnail' field's 'compute' function, which would create the 
thumbnail file. 

Is there a better way to perform this sort of file copy from one table to 
another, such that the copy of the file is automatically made (and if 
necessary, the new folder is created), and which triggers the creation of 
the thumbnail? Or is it necessary to perform the folder creation and file 
copy operation, as well as the creation of the thumbnail, manually? 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] SOAP API authentication

2014-08-31 Thread Stefan van den Eertwegh
Hi,

Does anyone know how to set authentication to a web2py SOAP API?

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] IMAPDB, decode ISO-8859-1 in sender.from name

2014-08-31 Thread javierobcn

Hi 

I'm working with IMAPDB adapter, i can connect and read the messages, but i 
want proccess and store in DB some messages. The problem is with the 
message.sender field and some characters... the sender can be something 
similar to: Juan =?ISO-8859-1?Q?Cint=F3?= 

I need convert or decode the sender name part to Juan Cintó (note the o 
cute) to store in db without the ?ISO-8859-1Q?  

I need print the value on view... how i can decode the original string Juan 
=?ISO-8859-1?Q?Cint=F3?=   to Juan Cintó 


how i can do this? any idea are appreciated

Thanks in advance, Web2py is awesome...

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