[web2py] web2py ACE editor

2013-11-18 Thread Yebach
Hello

I got the following task

In my home page created with web2py I need to embed ACE editor. Then the 
code written in ace editor needs to be saved somewhere on server side.

I copied all ACE needed files to my static folder

In my view (html) I inserted the following code with source of course

$(document).ready (function () {
$('#textArea').each(function () {
var textarea = $(this);
 
var mode = textarea.data('editor');

var editDiv = $(div, {
position: 'absolute',
width: textarea.width(),
height: textarea.height(),
'class': textarea.attr('class')
}).insertBefore(textarea);
 
textarea.css('visibility', 'hidden');
 
var editor = ace.edit(editDiv[0]);
editor.renderer.setShowGutter(false);
editor.getSession().setValue(textarea.val());
editor.getSession().setMode(ace/mode/javascript);
editor.setTheme(ace/theme/dawn);
})
 
});

textarea name=my-xml-editor id =textArea data-editor=xml rows=50 
cols=50/textarea


now I need to get the text from this editor to write it into file and save 
it.

I need some direction how to do this. What is the best way? I am a total 
newbe here so please bare with me.

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.


[web2py] Re: return PDF content created from a blob field

2013-11-18 Thread Fred Guedes Pereira
Thanks, Niphlod.

Now it's clear for me, but I cant use response.stream() because it receives 
a filename, not a content, as parameter. Should I save the content into a 
local file first? 

Fred

Em quinta-feira, 14 de novembro de 2013 14h21min37s UTC-3, Fred Guedes 
Pereira escreveu:

 Hello,

 Is there a way to return PDF content generated from a blob db field? 

 My table has a blob field whose content is PDF. I would like to create a 
 'PDF page' from those bytes and return it.

 Thanks,

 Sorry for possible duplication.

 Fred


-- 
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 ACE editor

2013-11-18 Thread Paolo Valleri
Have a look to the code of admin app, we do the same thing in the app 
editor (the only difference is that we use codemirror instead of ACE)

On Monday, November 18, 2013 1:10:30 PM UTC+1, Yebach wrote:

 Hello

 I got the following task

 In my home page created with web2py I need to embed ACE editor. Then the 
 code written in ace editor needs to be saved somewhere on server side.

 I copied all ACE needed files to my static folder

 In my view (html) I inserted the following code with source of course

 $(document).ready (function () {
 $('#textArea').each(function () {
 var textarea = $(this);
  
 var mode = textarea.data('editor');
 
 var editDiv = $(div, {
 position: 'absolute',
 width: textarea.width(),
 height: textarea.height(),
 'class': textarea.attr('class')
 }).insertBefore(textarea);
  
 textarea.css('visibility', 'hidden');
  
 var editor = ace.edit(editDiv[0]);
 editor.renderer.setShowGutter(false);
 editor.getSession().setValue(textarea.val());
 editor.getSession().setMode(ace/mode/javascript);
 editor.setTheme(ace/theme/dawn);
 })
  
 });

 textarea name=my-xml-editor id =textArea data-editor=xml rows=50 
 cols=50/textarea


 now I need to get the text from this editor to write it into file and save 
 it.

 I need some direction how to do this. What is the best way? I am a total 
 newbe here so please bare with me.

 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.


[web2py] Re: pls, where can i get web2py_manual 3rd edition

2013-11-18 Thread Anthony
Probably shouldn't post a copyrighted work without the permission of the 
publisher. I'll take it down for now.

Anthony

On Monday, November 18, 2013 12:44:24 AM UTC-5, Rahul wrote:


 Hi Olaniyi,
   Have attached an edition from late 2010. Not sure if this is the 
 one, have a look

 Rahul D.

 On Monday, November 18, 2013 12:35:16 AM UTC+5:30, Olaniyi Arawande wrote:

 i actually have 5th edition but i need to check something in the 3rd. 
 pls, if anyone have it or a link to, kindly response. thanx.



-- 
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: return PDF content created from a blob field

2013-11-18 Thread Niphlod
taken from the book

 As noted above, response.download should be used to retrieve files stored 
via an upload field. response.stream can be used in other cases, such as 
returning a temporary file or StringIO object created by the controller. If 
attachment is True, the Content-Disposition header will be set to 
attachment, and if filename is also provided, it will be added to the 
Content-Disposition header as well (but only when attachment is True). If 
not already included in response.headers, the following response headers 
will be set automatically: Content-Type, Content-Length, Cache-Control, 
Pragma, and Last-Modified (the latter three are set to allow browser 
caching of the file). To override any of these automatic header settings, 
simply set them in response.headers before calling response.stream.

So, you can use a StringIO instance to stream it **should** work with 
your blob contents.

On Monday, November 18, 2013 2:03:45 PM UTC+1, Fred Guedes Pereira wrote:

 Thanks, Niphlod.

 Now it's clear for me, but I cant use response.stream() because it 
 receives a filename, not a content, as parameter. Should I save the content 
 into a local file first? 

 Fred

 Em quinta-feira, 14 de novembro de 2013 14h21min37s UTC-3, Fred Guedes 
 Pereira escreveu:

 Hello,

 Is there a way to return PDF content generated from a blob db field? 

 My table has a blob field whose content is PDF. I would like to create a 
 'PDF page' from those bytes and return it.

 Thanks,

 Sorry for possible duplication.

 Fred



-- 
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: return PDF content created from a blob field

2013-11-18 Thread Fred Guedes Pereira
Hi Niphlod,

It worked! No need for StringIO. I just returned the blob field as the http 
response content. The code:

def pdfdoc():
evento = session._eventos[int(request.args(0))] or 
redirect(URL('eventos'), args=request.args(0))
response.headers['Content-Type'] = 'application/pdf'
response.headers['Content-Disposition'] = 'attachment; 
filename=teste.pdf'
return evento['lb_documento']  #lb_documento is a blob field in an 
Oracle DB, mapped with a 'blob' type with DAL

BUT (always have a but!), the blob content (PDF) seems to be encoded. When 
I open the resulting downloaded file it is not recognized as a PDF file. I 
put a print just after retrieve the field from DB and it seems enconded 
(base64?). But it´s another problem.

Fred

Em quinta-feira, 14 de novembro de 2013 14h21min37s UTC-3, Fred Guedes 
Pereira escreveu:

 Hello,

 Is there a way to return PDF content generated from a blob db field? 

 My table has a blob field whose content is PDF. I would like to create a 
 'PDF page' from those bytes and return it.

 Thanks,

 Sorry for possible duplication.

 Fred


-- 
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] Session Expiration

2013-11-18 Thread Saurabh Kumar
What can cause a session to expire on server side? I have been facing the
session expiration problem. I have already checked the 'expiration' field
of the session.
What are all the possible cases that could lead to server expiration on
server?


Session data just after log in:
{'_session_hash': 'ea152f552f6c88e598824b393cc650a6',
 '_user_agent': {'is_mobile': False, 'is_tablet': False},
 'auth': Storage {'hmac_key': 'd4eea339-34f0-4e81-a8f5-54a68e8da363',
'user_groups': {1672: 'user_3747'}, 'expiration': 9, 'last_visit':
datetime.datetime(2013, 11, 18, 15, 4, 6, 891109), 'user': Row
{some-data-here}},
 'login_method': 'android_google',
 'mversion': '38'}


And it expires on its own after some time to:
{'_auth_next': '/app_init_data.json',
 '_formkey[login]': '426176a2-ad70-4af5-a146-0e7b16874d97',
 '_formkey[register]': 'f7ca1d03-2f5f-4d76-997b-1d7801b70d82',
 '_session_hash': '0e151d2a1dbb7242190fab4eaaf4a5d5',
 '_user_agent': {'is_mobile': False, 'is_tablet': False},
 'flash': ''}


I use the following function for login:
login_user(self, user)

-- 
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: return PDF content created from a blob field

2013-11-18 Thread Niphlod
you were the one saying that the column hold the content of the pdf file ^_^
If you need to convert from base64, use a StringIO and then fill it with 
the decoded value, and stream that one.

Simone

On Monday, November 18, 2013 4:05:49 PM UTC+1, Fred Guedes Pereira wrote:

 Hi Niphlod,

 It worked! No need for StringIO. I just returned the blob field as the 
 http response content. The code:

 def pdfdoc():
 evento = session._eventos[int(request.args(0))] or 
 redirect(URL('eventos'), args=request.args(0))
 response.headers['Content-Type'] = 'application/pdf'
 response.headers['Content-Disposition'] = 'attachment; 
 filename=teste.pdf'
 return evento['lb_documento']  #lb_documento is a blob field in an 
 Oracle DB, mapped with a 'blob' type with DAL

 BUT (always have a but!), the blob content (PDF) seems to be encoded. When 
 I open the resulting downloaded file it is not recognized as a PDF file. I 
 put a print just after retrieve the field from DB and it seems enconded 
 (base64?). But it´s another problem.

 Fred

 Em quinta-feira, 14 de novembro de 2013 14h21min37s UTC-3, Fred Guedes 
 Pereira escreveu:

 Hello,

 Is there a way to return PDF content generated from a blob db field? 

 My table has a blob field whose content is PDF. I would like to create a 
 'PDF page' from those bytes and return it.

 Thanks,

 Sorry for possible duplication.

 Fred



-- 
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] BingSearch API

2013-11-18 Thread dirman
I downloaded the bing search api from web2py appliances and change the 
APPID to my account ID but does not work.i get
the error ticket: parameter is invalid.What is wrong? 

-- 
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: bootstrap 3 skeleton app?

2013-11-18 Thread Arnon Marcus
Is it in the roadmap? (Could't see it on the official one..)
Is there a designated-version for it? (2.8 maybe? ...hope...)
Can we get a guestimated-timeframe?
Lots of client-side libraries/frameworks that we have our eyes on for 
using, and who relied on bootstrap 2.x, are fast-converting to 3.0
We are scheduled to upgrade our web2py version in about a month or two, and 
it would be painful to convert our app twice..
Should we expect it to be ready by then? 

-- 
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: return PDF content created from a blob field

2013-11-18 Thread Fred Guedes Pereira
Hi Simone,

It really is a PDF file (I checked)! It´s a legacy database, the blob field 
was not filled by DAL, but by another system (in Java). I guess a base64 
decode is going on incorrectly when the DAL reads the database. I tried to 
replace the Field type parameter from 'blob' to 'SQLCustomType', but it 
didnt work. It doenst read the field's value from DB.

Field(lb_documento, blob)

Field(lb_documento, type=SQLCustomType(type='string', native='blob'))

In the first declaration the field came base64 decoded. When using the 
second one, the blob field is not read from DB. 

Do you know any way to read a native blob field using DAL without decode it 
?

Thanks a lot,
Fred

Em segunda-feira, 18 de novembro de 2013 12h53min39s UTC-3, Niphlod 
escreveu:

 you were the one saying that the column hold the content of the pdf file 
 ^_^
 DAL uses base64 to put the contents in.
 If you need to convert from base64, use a StringIO and then fill it with 
 the decoded value, and stream that one.

 Simone

 On Monday, November 18, 2013 4:05:49 PM UTC+1, Fred Guedes Pereira wrote:

 Hi Niphlod,

 It worked! No need for StringIO. I just returned the blob field as the 
 http response content. The code:

 def pdfdoc():
 evento = session._eventos[int(request.args(0))] or 
 redirect(URL('eventos'), args=request.args(0))
 response.headers['Content-Type'] = 'application/pdf'
 response.headers['Content-Disposition'] = 'attachment; 
 filename=teste.pdf'
 return evento['lb_documento']  #lb_documento is a blob field in an 
 Oracle DB, mapped with a 'blob' type with DAL

 BUT (always have a but!), the blob content (PDF) seems to be encoded. 
 When I open the resulting downloaded file it is not recognized as a PDF 
 file. I put a print just after retrieve the field from DB and it seems 
 enconded (base64?). But it´s another problem.

 Fred

 Em quinta-feira, 14 de novembro de 2013 14h21min37s UTC-3, Fred Guedes 
 Pereira escreveu:

 Hello,

 Is there a way to return PDF content generated from a blob db field? 

 My table has a blob field whose content is PDF. I would like to create a 
 'PDF page' from those bytes and return it.

 Thanks,

 Sorry for possible duplication.

 Fred



-- 
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: MENU helper's menu item 2nd argument ignored?

2013-11-18 Thread Leonel Câmara
The second argument does not mean enabled/disabled. It means 
active/inactive. For instance, if you are visiting the page this menu item 
leads to you might want to change the CSS style of that menu item. To help 
you do this, MENU by default adds web2py-menu-active when that second 
argument evaluates to True.

Of course, you can also use this to disable items if you want.

Segunda-feira, 18 de Novembro de 2013 0:17:00 UTC, Scott Hunter escreveu:

 As I understand it, the second argument in a menu item (which does not 
 seem to be documented in the book) indicates if the item is disabled (True) 
 or not (False).  In fact, in the menu generated by the app wizard, this 
 argument is given an expression comparing the same URL() as used for the 
 menu item to URL().

 But even if I stuff a True in this argument, the correspond menu item is 
 still enabled.

 Am I misunderstanding how this works, or what it should do, or is there a 
 bug?

 (version 2.7.4, OSX 10.9)


-- 
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:36307] Re: invalid request/controller handle

2013-11-18 Thread Marco
Il giorno mercoledì 2 dicembre 2009 05:07:25 UTC+1, Thadeus ha scritto:

 Yes, but that is not working :)
 routes_onerror = [
('thadeusb/*', '/thadeusb/default/error'),
 ]



After 4 years, this still does not work...

routes_onerror = [
('myapp/*', '/myapp/default/fail'),
]

Always returns invalid request

-- 
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: return PDF content created from a blob field

2013-11-18 Thread Fred Guedes Pereira
Simone and others,

I solved the DAL base64 encoding problem. I read the field using 
cx_Oracle directly, not DAL. I dont know if there is another easier 
solution for this. Anyway, now I can go foward!

Follows the function to read the blob field:

def readPDFContent(query_parameters_here):
blobselect = cx_Oracle.connect('usraudien/u$raud1en@SUAP')
cursor = blobselect.cursor()
cursor.execute(
'''select your_blob_field
from ...
''', {query_parameters_here})
row = cursor.fetchone()
blobfield = row[0].read()   #read() must be before the cursor.close()!
cursor.close()
return blobfield

Fred

Em segunda-feira, 18 de novembro de 2013 14h02min47s UTC-3, Fred Guedes 
Pereira escreveu:

 Hi Simone,

 It really is a PDF file (I checked)! It´s a legacy database, the blob 
 field was not filled by DAL, but by another system (in Java). I guess a 
 base64 decode is going on incorrectly when the DAL reads the database. I 
 tried to replace the Field type parameter from 'blob' to 'SQLCustomType', 
 but it didnt work. It doenst read the field's value from DB.

 Field(lb_documento, blob)

 Field(lb_documento, type=SQLCustomType(type='string', native='blob'))

 In the first declaration the field came base64 decoded. When using the 
 second one, the blob field is not read from DB. 

 Do you know any way to read a native blob field using DAL without decode 
 it ?

 Thanks a lot,
 Fred

 Em segunda-feira, 18 de novembro de 2013 12h53min39s UTC-3, Niphlod 
 escreveu:

 you were the one saying that the column hold the content of the pdf file 
 ^_^
 DAL uses base64 to put the contents in.
 If you need to convert from base64, use a StringIO and then fill it with 
 the decoded value, and stream that one.

 Simone

 On Monday, November 18, 2013 4:05:49 PM UTC+1, Fred Guedes Pereira wrote:

 Hi Niphlod,

 It worked! No need for StringIO. I just returned the blob field as the 
 http response content. The code:

 def pdfdoc():
 evento = session._eventos[int(request.args(0))] or 
 redirect(URL('eventos'), args=request.args(0))
 response.headers['Content-Type'] = 'application/pdf'
 response.headers['Content-Disposition'] = 'attachment; 
 filename=teste.pdf'
 return evento['lb_documento']  #lb_documento is a blob field in an 
 Oracle DB, mapped with a 'blob' type with DAL

 BUT (always have a but!), the blob content (PDF) seems to be encoded. 
 When I open the resulting downloaded file it is not recognized as a PDF 
 file. I put a print just after retrieve the field from DB and it seems 
 enconded (base64?). But it´s another problem.

 Fred

 Em quinta-feira, 14 de novembro de 2013 14h21min37s UTC-3, Fred Guedes 
 Pereira escreveu:

 Hello,

 Is there a way to return PDF content generated from a blob db field? 

 My table has a blob field whose content is PDF. I would like to create 
 a 'PDF page' from those bytes and return it.

 Thanks,

 Sorry for possible duplication.

 Fred



-- 
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: Reset password based on username instead of email

2013-11-18 Thread DeanK
Will do.  I could create a fix on my own by creating a new Auth class that 
inherits from auth and just override the  'reset_password' method, correct? 
 That way I should still be able to update as long as nothing new happens 
in gluon.Auth.reset_password?



On Saturday, November 16, 2013 3:58:56 AM UTC-5, Massimo Di Pierro wrote:

 Please open a ticket. This needs to be implemented.

 On Friday, 15 November 2013 11:07:31 UTC-6, DeanK wrote:

 So I have a somewhat unique situation where multiple different users will 
 be creating separate accounts with unique usernames, using the SAME email 
 address.  I figured I could make this happen by using custom auth tables 
 like this:

 ## Manually set up Auth tables so you can have non-unique emails
 db.define_table(
 auth.settings.table_user_name,
 Field('username', length=32, default=''),
 Field('first_name', length=128, default=''),
 Field('last_initial', length=1, default=''),
 Field('email', length=128, default=''), # required
 Field('password', 'password', length=512,# required
   readable=False, label='Password'),
 Field('registration_key', length=512,# required
   writable=False, readable=False, default=''),
 Field('reset_password_key', length=512,  # required
   writable=False, readable=False, default=''),
 Field('registration_id', length=512, # required
   writable=False, readable=False, default=''))

 ## do not forget validators
 custom_auth_table = db[auth.settings.table_user_name] # get the 
 custom_auth_table
 custom_auth_table.first_name.requires =   
 IS_NOT_EMPTY(error_message=auth.messages.is_empty)
 custom_auth_table.last_initial.requires =   
 IS_NOT_EMPTY(error_message=auth.messages.is_empty)
 custom_auth_table.password.requires = [CRYPT()]
 custom_auth_table.email.requires = 
 [IS_EMAIL(error_message=auth.messages.invalid_email)]
 custom_auth_table.username.requires = IS_NOT_IN_DB(db, 
 custom_auth_table.username)

 auth.settings.table_user = custom_auth_table # tell auth to use 
 custom_auth_table

 # Define auth tables
 auth.define_tables(username=True, signature=False)


 There are two issues with this approach.

 First, forgot password asks for an email still and resets the first 
 account in the table with that user name.  Is there a way to reset based on 
 username built in to web2py?  I couldn't seem to find anything in the 
 documentation so i'm thinking no unfortunately...

 Second, and less vital, is the forgot username functionality emails the 
 first username in the table linked to the entered email only.  Ideally you 
 would email the names and usernames of all accounts linked to the email 
 address.


 Is there any way I could enable the described desired functionality? 
  Could I somehow extend the existing login functionality without breaking 
 the ability to update my web2py instance (basically changes that don't 
 touch core web2py code)?  

 Thanks,
 Dean





-- 
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] where is the editor in 2.7.4?

2013-11-18 Thread Alex Glaros
just downloaded version 2.7.4 onto a windows XP machine

when I go to edit any file, e.g., db.py, I don't see any content

content is there because I can execute the controllers I wrote from 
previous version

how do I show the code in the editor?

thanks,

Alex Glaros

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


[web2py] Re: If logic in the menu.py model

2013-11-18 Thread Chris Hepworth
That worked perfectly! Thank you for the help, I guess my command of basic 
Python isn't nearly as good as I had thought...

On Saturday, November 16, 2013 2:05:40 AM UTC-7, Massimo Di Pierro wrote:

 This is not valid python syntax. Try:

 submenu = []

 response.menu = [(T('Manage'),URL(),URL(),submenu), ...]

 if auth.has_membership('admin'): submenu += [
 (T('Users'),URL('cms','users_manage')==URL(),URL('cms',
 'users_manage'),[]),   
 (T('Groups'),URL('cms','groups_manage')==URL(),URL('cms',
 'groups_manage'),[]),
 (T('Exhibits'),URL('cms','exhibits_manage')==URL(),URL('cms',
 'exhibits_manage'),[])]
 if auth.has_membership('collection_admin'): submenu += [
 (T('Display'),URL('cms','display_manage')==URL(),URL('cms',
 'display_manage'),[]),
 (T('Items'),URL('cms','items_manage')==URL(),URL('cms',
 'items_manage'),[]),
 (T('Categories'),URL('cms','categories_manage')==URL(),URL('cms',
 'categories_manage'),[]),
 (T('Tours'),URL('cms','tours_manage')==URL(),URL('cms',
 'tours_manage'),[])]
 if auth.has_membership('comment_moderator'): submenu += [
 (T('Comments'),URL('cms','comments_manage')==URL(),URL('cms',
 'comments_manage'),[]),
 ]


 On Friday, 15 November 2013 19:06:25 UTC-6, Chris Hepworth wrote:

 I am new to web2py and have what may be a stupid question.

 In the application I am designing there are a number of different tables 
 I have basic SQLforms to manage. I already have access control being 
 enforced in the controller using the appropriate decorators, but I would 
 like to further increase security by limiting which options are available 
 in the menu. I was trying to use if statements as follows:

 (T('Manage'),URL(),URL(),[
 if auth.has_membership('admin'):
 (T('Users'),URL('cms','users_manage')==URL(),URL('cms',
 'users_manage'),[]),   
 (T('Groups'),URL('cms','groups_manage')==URL(),URL('cms',
 'groups_manage'),[]),
 (T('Exhibits'),URL('cms','exhibits_manage')==URL(),URL('cms',
 'exhibits_manage'),[]),
 if auth.has_membership('collection_admin'):
 (T('Display'),URL('cms','display_manage')==URL(),URL('cms',
 'display_manage'),[]),
 (T('Items'),URL('cms','items_manage')==URL(),URL('cms',
 'items_manage'),[]),
 (T('Categories'),URL('cms','categories_manage')==URL(),URL('cms',
 'categories_manage'),[]),
 (T('Tours'),URL('cms','tours_manage')==URL(),URL('cms',
 'tours_manage'),[]),
 if auth.has_membership('comment_moderator'):
 (T('Comments'),URL('cms','comments_manage')==URL(),URL('cms',
 'comments_manage'),[]),
 ]),

 The error traceback indicates that the if statement is invalid, but I 
 don't see why that would be. If someone with more experience could 
 illuminate me, I would be much 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/groups/opt_out.


[web2py] Re: where is the editor in 2.7.4?

2013-11-18 Thread 黄祥
what kind of version did you use? i've tried using windows binary version 
and can edit the files directly from browser.

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.


[web2py] Re: auto compiled like in django

2013-11-18 Thread 黄祥
very straight to the point, it's make me clear now, thank you so much for 
detail explaination, anthony.

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.


[web2py] Re: If logic in the menu.py model

2013-11-18 Thread 黄祥
what is the URL() in second argument use for in this case?
URL('cms','users_manage')==URL()

i've checked the book for that but got no explaination about that :
No results for url()

thanks and best regards,
stifan

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


[web2py] Re: Strange Issue with Executesql

2013-11-18 Thread Josh Myers
@Tim - Thanks for the suggstion. I will upgrade to the newest version soon.
 
@Willoughby -  Thanks for the reply.  I doubt there is a row limit, but I 
will look into it.
 
@Brian - The queries are more complicated than that, usually.  I was just 
giving an example.  I have tried the exact same query in the SQL Server 
Express Application and it works just fine.  It just fails when run from 
executesql in web2py.  Is this the monitor you were referring to?  If 
not, what did you mean?
 
Thanks.
 
Josh
 
 

-- 
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] How can i show the data of crosstab table in web2py

2013-11-18 Thread Rafiq Mir
I have table called cmsold as follows

CREATE TABLE cmsold
(
  id serial NOT NULL,
  dd timestamp without time zone,
  cat character varying(32),
  model character varying(80),
  sold bigint,
  CONSTRAINT cmsold_pkey PRIMARY KEY (id)
)

inserted the following data

insert into cmsold(dd,cat,model,sold) 
values('2013-11-10','cat1','model1',10);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-10','cat1','model2',20);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-10','cat2','model1',40);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-10','cat2','model2',50);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-10','cat3','model1',15);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-10','cat3','model2',25);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-11','cat1','model1',10);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-11','cat1','model2',20);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-11','cat2','model1',40);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-11','cat2','model2',50);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-11','cat3','model1',15);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-11','cat3','model2',25);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-12','cat1','model1',10);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-12','cat1','model2',20);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-12','cat2','model1',40);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-12','cat2','model2',50);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-12','cat3','model1',15);
insert into cmsold(dd,cat,model,sold) 
values('2013-11-12','cat3','model2',25);

created a crosstab query in postgresql

select * from crosstab(
$$select cat,model,dd::date,sum(sold) sold from cmsold 
group by 1,2,3 
order by 1,2,3 $$,
$$VALUES('2013-11-10'),('2013-11-11'),('2013-11-12')$$
)
as newtable(
cat varchar,
model varchar,
2013-11-10 int,
2013-11-11 int,
2013-11-12 int);

it generates following output

cat,model,'2013-11-10','2013-11-11','2013-11-12'
cat1;model1;20;20;20
cat2;model1;50;50;50
cat3;model1;25;25;25

How can i display the above output in web2py in grid format ?

-- 
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] Estore (new!)

2013-11-18 Thread Massimo Di Pierro
I have posted a new Estore application: 

https://github.com/mdipierro/web2py-appliances/tree/master/EStore

It is minimalist but supports:
- multiple products
- product subtypes (for example t-shirt sizes)
- categories
- discounts (2x 3x 4x 5x 10x)
- shipping options (not shipping cost calculations yet)
- ajax shopping cart
- volume, weight, and tax calculations
- checkout with stripe.com using the new PCI compliant JavaScript API

I could use some help with:
- testing
- edit models/plughin_shipping.py to integrate https://www.easypost.com/
- improve the management interface for creating new products, and view 
transactions

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


[web2py] Re: Session Expiration

2013-11-18 Thread Massimo Di Pierro
There is a cron job that expires sessions: 

https://github.com/web2py/web2py/blob/master/applications/admin/cron/crontab

You may want to remove it.
On Monday, 18 November 2013 09:14:30 UTC-6, Saurabh Kumar wrote:

 What can cause a session to expire on server side? I have been facing the 
 session expiration problem. I have already checked the 'expiration' field 
 of the session.
 What are all the possible cases that could lead to server expiration on 
 server?


 Session data just after log in:
 {'_session_hash': 'ea152f552f6c88e598824b393cc650a6',
  '_user_agent': {'is_mobile': False, 'is_tablet': False},
  'auth': Storage {'hmac_key': 'd4eea339-34f0-4e81-a8f5-54a68e8da363', 
 'user_groups': {1672: 'user_3747'}, 'expiration': 9, 
 'last_visit': datetime.datetime(2013, 11, 18, 15, 4, 6, 891109), 'user': 
 Row {some-data-here}},
  'login_method': 'android_google',
  'mversion': '38'}


 And it expires on its own after some time to:
 {'_auth_next': '/app_init_data.json',
  '_formkey[login]': '426176a2-ad70-4af5-a146-0e7b16874d97',
  '_formkey[register]': 'f7ca1d03-2f5f-4d76-997b-1d7801b70d82',
  '_session_hash': '0e151d2a1dbb7242190fab4eaaf4a5d5',
  '_user_agent': {'is_mobile': False, 'is_tablet': False},
  'flash': ''}


 I use the following function for login:
 login_user(self, user)



-- 
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:36307] Re: invalid request/controller handle

2013-11-18 Thread Massimo Di Pierro
That is not a valid regular expression. You want:

routes_onerror = [
('myapp/(.*)', '/myapp/default/fail'),
]

On Monday, 18 November 2013 09:17:07 UTC-6, Marco wrote:

 Il giorno mercoledì 2 dicembre 2009 05:07:25 UTC+1, Thadeus ha scritto:

 Yes, but that is not working :)
 routes_onerror = [
('thadeusb/*', '/thadeusb/default/error'),
 ]



 After 4 years, this still does not work...

 routes_onerror = [
 ('myapp/*', '/myapp/default/fail'),
 ]

 Always returns invalid request


-- 
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] Re: If logic in the menu.py model

2013-11-18 Thread Federico Ferraro
Comparison syntax...


2013/11/18 黄祥 steve.van.chris...@gmail.com

 what is the URL() in second argument use for in this case?
 URL('cms','users_manage')==URL()

 i've checked the book for that but got no explaination about that :
 No results for url()

 thanks and best regards,
 stifan

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




-- 
--
Federico Ferraro
Usuario Linux : 482533.
--

-- 
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: BingSearch API

2013-11-18 Thread Massimo Di Pierro
Perhaps they changed the API but it is more likely that the example API ID 
has expired:

https://github.com/mdipierro/web2py-appliances/blob/master/BingApi/controllers/default.py#L10

Did you get your own API ID?

On Monday, 18 November 2013 10:40:50 UTC-6, dirman wrote:

 I downloaded the bing search api from web2py appliances and change the 
 APPID to my account ID but does not work.i get
 the error ticket: parameter is invalid.What is wrong? 


-- 
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: Estore (new!)

2013-11-18 Thread Massimo Di Pierro
Also,.. it store inventory info but it does not display it and does not 
update it on sale. This can be accounted for with two lines of code. Want 
to try as an exercise?

Massimo

On Monday, 18 November 2013 14:06:21 UTC-6, Massimo Di Pierro wrote:

 I have posted a new Estore application: 

 https://github.com/mdipierro/web2py-appliances/tree/master/EStore

 It is minimalist but supports:
 - multiple products
 - product subtypes (for example t-shirt sizes)
 - categories
 - discounts (2x 3x 4x 5x 10x)
 - shipping options (not shipping cost calculations yet)
 - ajax shopping cart
 - volume, weight, and tax calculations
 - checkout with stripe.com using the new PCI compliant JavaScript API

 I could use some help with:
 - testing
 - edit models/plughin_shipping.py to integrate https://www.easypost.com/
 - improve the management interface for creating new products, and view 
 transactions

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


[web2py] Re: where is the editor in 2.7.4?

2013-11-18 Thread Niphlod
ctrl+r is your friendit reloads the cached static files.

On Monday, November 18, 2013 8:02:58 PM UTC+1, 黄祥 wrote:

 what kind of version did you use? i've tried using windows binary version 
 and can edit the files directly from browser.

 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.


[web2py] Re: Estore (new!)

2013-11-18 Thread samuel bonill
+1 testing

El lunes, 18 de noviembre de 2013 15:06:21 UTC-5, Massimo Di Pierro 
escribió:

 I have posted a new Estore application: 

 https://github.com/mdipierro/web2py-appliances/tree/master/EStore

 It is minimalist but supports:
 - multiple products
 - product subtypes (for example t-shirt sizes)
 - categories
 - discounts (2x 3x 4x 5x 10x)
 - shipping options (not shipping cost calculations yet)
 - ajax shopping cart
 - volume, weight, and tax calculations
 - checkout with stripe.com using the new PCI compliant JavaScript API

 I could use some help with:
 - testing
 - edit models/plughin_shipping.py to integrate https://www.easypost.com/
 - improve the management interface for creating new products, and view 
 transactions

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


[web2py] Re: where is the editor in 2.7.4?

2013-11-18 Thread Alex Glaros
I guess I have a weird version of XP, Dell laptop.

Used Windows binaries.  Control/R didn't work.  Tried different browsers.

When I create a new file, it also doesn't display the lines of code.

2.7.4 works on my wife's Windows8 machine.

Where can I find a version of 2.6 windows binary download?

Is this correct, my only alternative is to install linux and run from that? 
 Any other way to edit the files and get error checking?

thanks,

Alex Glaros




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


[web2py] Re: Estore (new!)

2013-11-18 Thread samuel bonill
hi massimo, how i can do a pull request for this aplicacion ?, is a 
repository with a lot of aplicacions, would be a great idea, put this app 
in an separate repository

El lunes, 18 de noviembre de 2013 15:06:21 UTC-5, Massimo Di Pierro 
escribió:

 I have posted a new Estore application: 

 https://github.com/mdipierro/web2py-appliances/tree/master/EStore

 It is minimalist but supports:
 - multiple products
 - product subtypes (for example t-shirt sizes)
 - categories
 - discounts (2x 3x 4x 5x 10x)
 - shipping options (not shipping cost calculations yet)
 - ajax shopping cart
 - volume, weight, and tax calculations
 - checkout with stripe.com using the new PCI compliant JavaScript API

 I could use some help with:
 - testing
 - edit models/plughin_shipping.py to integrate https://www.easypost.com/
 - improve the management interface for creating new products, and view 
 transactions

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


[web2py] Re: resize image validator using PIL

2013-11-18 Thread Francisco Costa
its better to keep the TemporaryFile so that the image filesize gets 
updated, otherwise the image filesize will be the same as the original and 
it should be smaller

On Thursday, September 2, 2010 12:30:49 PM UTC+1, kachna wrote:

 One more update. tempfile.TemporaryFile() in not needed. 

 def __call__(self, value): 

 import Image 
 import cgi 

 try: 
 im = Image.open(value.file) 
 print im.size, im.format 

 im.thumbnail((100, 100), Image.ANTIALIAS) 

 value.file.seek(0) 
 im.save(value.file, im.format) 
 value.file.seek(0) 

 return (value, None) 
 except Exception as e: 
 print 'resize exception:', e 
 return (value, self.error_message) 


 On 2 zář, 12:34, kachna petr.marti...@gmail.com wrote: 
  Thanks for hint. 
  Here is my working solution. It takes lot of time. 
  
  def __call__(self, value): 
  
  import Image 
  import cgi 
  import tempfile 
  
  try: 
  im = Image.open(value.file) 
  print im.size, im.format 
  
  im.thumbnail((100, 100), Image.ANTIALIAS) 
  
  resized = tempfile.TemporaryFile() 
  
  im.save(resized, im.format) 
  
  value.file = resized 
  value.file.seek(0) 
  
  return (value, None) 
  except Exception as e: 
  print 'resize exception:', e 
  return (value, self.error_message) 
  
  - In-value in __call__ is just one Field of cgi.FieldStorage. Here is 
  upload filed. In value.file is open file with uploaded data. 
  - Final image is stored in  tempfile.TemporaryFile(). It must be 
  rewind before return! 
  - __call__ return Field of cgi.FieldStorage with new value.file 
  
  On 1 zář, 23:25, mdipierro mdipie...@cs.depaul.edu wrote: 
  
  
  
   This is a bit more complex than it seems because upload expects a 
   ci.FieldStorage object so the validator __call__ should return a 
   cgi.FieldStoarge. 
  
   On Sep 1, 3:50 pm, kachna petr.marti...@gmail.com wrote: 
  
Hi, 
I am trying to write validator to resize my image before storing in 
 DB 
field. 
  
class RESIZE_IMG(object): 
def __init__(self, isThumb=False, 
 error_message='unresizable'): 
(self.isThumb, self.error_message) = (isThumb, 
 error_message) 
  
def __call__(self, value): 
import Image 
  
try: 
  
im = Image.open(value.file) 
# This print is OK. PIL recognize uploaded 
 image 
print im.size, im.format 
  
im.resize((100, 100)) 
value.file.seek(0) 
im.save(value.file, im.format) 
return (value, None) 
except Exception as e: 
print 'resize exception:', e 
return (value, self.error_message) 
  
Script runs well but data in DB field is no image data. It can' t be 
displayed by download function from default controller too. 
  
Thanks for 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] Re: Estore (new!)

2013-11-18 Thread samuel bonill
also, might be a good idea that could accept bitcoin payments...


2013/11/18 samuel bonill pythonn...@gmail.com

 hi massimo, how i can do a pull request for this aplicacion ?, is a
 repository with a lot of aplicacions, would be a great idea, put this app
 in an separate repository

 El lunes, 18 de noviembre de 2013 15:06:21 UTC-5, Massimo Di Pierro
 escribió:

 I have posted a new Estore application:

 https://github.com/mdipierro/web2py-appliances/tree/master/EStore

 It is minimalist but supports:
 - multiple products
 - product subtypes (for example t-shirt sizes)
 - categories
 - discounts (2x 3x 4x 5x 10x)
 - shipping options (not shipping cost calculations yet)
 - ajax shopping cart
 - volume, weight, and tax calculations
 - checkout with stripe.com using the new PCI compliant JavaScript API

 I could use some help with:
 - testing
 - edit models/plughin_shipping.py to integrate https://www.easypost.com/
 - improve the management interface for creating new products, and view
 transactions

 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/IKJBgBI8cFo/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
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] response.view best practices

2013-11-18 Thread Mark Graves
Hey guys,

Two questions:

So I've got a public facing site and a private site, which have different 
layouts.

In the past, I used one layout.html and blocks of if statements to include 
stuff.

In terms of performance what would be the difference between that and 
response.view?

Also, I was having trouble with blocks and response.view.

For example in public.py controller:

def index():
 response.view = 'public_layout.html'
 return dict()

And view public/index:
{{extend 'public_layout.html'}}
  
{{include 'default/carousel.html'}}

I'm not getting the carousel included.  Do I also have to put:

{{extend 'public_layout.html'}}

in carousel.html?

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] Re: where is the editor in 2.7.4?

2013-11-18 Thread Alex Glaros
From source, instead of binary, some of the files appeared, so I just
deleted files like db.py that didn't show lines of code, and re-created
from copies of older versions.

It works now.  Thanks,

Alex


On Mon, Nov 18, 2013 at 1:09 PM, Alex Glaros alexgla...@gmail.com wrote:

 I guess I have a weird version of XP, Dell laptop.

 Used Windows binaries.  Control/R didn't work.  Tried different browsers.

 When I create a new file, it also doesn't display the lines of code.

 2.7.4 works on my wife's Windows8 machine.

 Where can I find a version of 2.6 windows binary download?

 Is this correct, my only alternative is to install linux and run from
 that?  Any other way to edit the files and get error checking?

 thanks,

 Alex Glaros




  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/BP38N8tK1GM/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
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: storing data received through HTTP request

2013-11-18 Thread melmg
I solved it by using regular expressions from the re library :)

On Sunday, November 17, 2013 8:42:42 PM UTC-5, melmg wrote:

 I changed it to:
 return dict(answer=answer)
 but the response looked the same through Firebug... I'm sure I'm not doing 
 it right, I was only trying to do that to see what the response looks like. 
 My main concern is how to look through the response in answer = 
 conn.getresponse() and get the values of ps, ls, pf, and pd. I'm not sure 
 how to step through the code and get those values to save them to the 
 database.



 On Saturday, November 16, 2013 5:02:48 PM UTC-5, Niphlod wrote:

 you're not returning anything from the controller to the view.

 def something():
  #...should actually return something :-P
  return dict(a=collected_values,b=collected_values2, etc etc etc)






-- 
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: response.view best practices

2013-11-18 Thread Anthony
response.view does not change the layout template -- it changes the 
template of the action being called (which typically extends a layout 
template). When you set response.view = 'public_layout.html', you are 
telling web2py to use public_layout.html as the view for the index function 
instead of using /views/default/index.html (so index.html never gets 
called). Instead, in index.html, you can do something like:

{{extend 'public_layout.html' if [some condition] else 'private_layout.html'
}}

But keep in mind that you won't be able to compile any views that include 
expressions in the {{extend ...}} statements, as above.

Anthony

On Monday, November 18, 2013 5:55:53 PM UTC-5, Mark Graves wrote:

 Hey guys,

 Two questions:

 So I've got a public facing site and a private site, which have different 
 layouts.

 In the past, I used one layout.html and blocks of if statements to include 
 stuff.

 In terms of performance what would be the difference between that and 
 response.view?

 Also, I was having trouble with blocks and response.view.

 For example in public.py controller:

 def index():
  response.view = 'public_layout.html'
  return dict()

 And view public/index:
 {{extend 'public_layout.html'}}
   
 {{include 'default/carousel.html'}}

 I'm not getting the carousel included.  Do I also have to put:

 {{extend 'public_layout.html'}}

 in carousel.html?

 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.


[web2py] Re: Strange Issue with Executesql

2013-11-18 Thread Brian M
I was meaning use the SQL server activity monitor to find out exactly what 
query is being run and how long it is taking. But if you are using SQL server 
express you won't have that. You can use something like express profile 2.0 
which is free though. Being able to see exactly what query is hitting the 
server can help; I know I have had instances where what I thought was being 
sent wasn't correct because of an unaccounted for type difference.

You said your table has 100K rows but how many rows are you expecting in the 
results?

-- 
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] How enable cron in production?

2013-11-18 Thread Mauricio cleveland
Hello all, I have a question I could not answer. In a production 
environment with ubuntu server need to add tasks with web2py cron. In the 
book says you should add the argument -Y in the command line, but not how 
to do it (the place where modify the line) on the server.

Thanks in advance!

-- 
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: Markdown in web2py support for raw HTML

2013-11-18 Thread Scott Hunter
The way Markdown is used from WIKI, it prevents the use of raw HTML.

On Sunday, November 17, 2013 10:18:45 PM UTC-5, Scott Hunter wrote:

 I added blank lines before  after the raw HTML; it still got escaped.

 On Sunday, November 17, 2013 9:56:08 PM UTC-5, Scott Hunter wrote:

 As I understand it, Markdown allows for raw HTML to be included, so long 
 as it is set unindented in its own paragraph.  But when I try the example 
 from the Markdown spec (
 http://daringfireball.net/projects/markdown/syntax#html), it gets 
 escaped.

 My view code:

 {{extend 'layout.html'}}
 {{from gluon.contrib.markdown import WIKI as MARKDOWN}}
 {{=MARKDOWN(
 This is a regular paragraph.
 table
 tr
 tdFoo/td
 /tr
 /table
 This is another regular paragraph.
 )}}


  
 And how it appears when rendered:

 This is a regular paragraph.
 table tr tdFoo/td /tr /table
 This is another regular paragraph.


 Is this an issue with the markdown2 module, how it is being used by 
 markdown.WIKI, or am I mistaken in how this should work?

 - Scott



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


[web2py] change password for all users

2013-11-18 Thread Jayadevan M
Hi,
The password for all users are stored in auth_user table. How can I reset 
the password for all users to the same from back-end (database layer)?
Thanks,
Jayadevan

-- 
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: Strange Issue with Executesql

2013-11-18 Thread Josh Myers
@Brian - 

That is a great suggestion and I didn't know about that.  I will get it.  

The table current has about 50k rows and about 25 columns and I wanted to 
pull in all of them.  It creates a list of tuples.  In the future, the 
table might have potentially millions of records, but I would still only be 
pulling in about 50k.  

My current solution is to run a loop so that I can execute several smaller 
queries and then combine them.  That way I ensure it runs.  I would, 
however, like to figure out why the query isn't reliably pulling in over 
10k rows at a time.  Maybe I can investigate along the line you suggested 
and it will bear fruit.

Any other thoughts?

-- 
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] Re: Estore (new!)

2013-11-18 Thread Mirko
https://github.com/pierrenoizat/webshop 
Written in RoR .
A web2py port shouldn't be too difficult...

On Monday, November 18, 2013 10:54:56 PM UTC+1, samuel bonill wrote:

 also, might be a good idea that could accept bitcoin payments...


 2013/11/18 samuel bonill pytho...@gmail.com javascript:

 hi massimo, how i can do a pull request for this aplicacion ?, is a 
 repository with a lot of aplicacions, would be a great idea, put this app 
 in an separate repository

 El lunes, 18 de noviembre de 2013 15:06:21 UTC-5, Massimo Di Pierro 
 escribió:

 I have posted a new Estore application: 

 https://github.com/mdipierro/web2py-appliances/tree/master/EStore

 It is minimalist but supports:
 - multiple products
 - product subtypes (for example t-shirt sizes)
 - categories
 - discounts (2x 3x 4x 5x 10x)
 - shipping options (not shipping cost calculations yet)
 - ajax shopping cart
 - volume, weight, and tax calculations
 - checkout with stripe.com using the new PCI compliant JavaScript API

 I could use some help with:
 - testing
 - edit models/plughin_shipping.py to integrate https://www.easypost.com/
 - improve the management interface for creating new products, and view 
 transactions

 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 a topic in the 
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/IKJBgBI8cFo/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
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] Updating auth.user extra_fields?

2013-11-18 Thread User
I want to store user page size preference for when there is a list view of 
items that needs pagination and have that preference persist between 
logins.  Two questions about this:

1. I decided to add an extra field to my auth.table. Is this the best place 
to store this type of data?
auth.settings.extra_fields['auth_user'] = [Field('pagesize','integer')]


2. If I want to update that setting how do I do it?
auth.user.pagesize = 100
seems to adjust the pagesize for the current session but does not seem to 
affect the db.


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