[web2py] Re: Web2Py and MS Access

2012-11-16 Thread Simon Carr
Which SQL Standard?

On Friday, 16 November 2012 02:39:24 UTC, Tim Richardson wrote:

 Your experience with MS Access will not be good I think. It doesn't even 
 pretend to support SQL standards as far as I remember, and you'll have a 
 very difficult time getting support. 

 The advice to consider the free edition of SQL server is something you 
 should look at. You get nice management tools, and the restrictions of the 
 free version aren't likely to bother you. The performance, robustness, 
 management tools and support is a completely different level than Access. 
 Access is not a server, multi-user access is handled at the OS file level 
 and it's not good. 




-- 





Re: [web2py] Re: Web2Py and MS Access

2012-11-16 Thread Vasile Ermicioi
man do a favor for yourself and don't use ms access database,
move to sqlite which is built in python :)

why?
http://database-management-systems.findthebest.com/saved_compare/Access-vs-SQLite
http://sqlite.phxsoftware.com/forums/p/666/3106.aspx

and you will find more reasons on google

how?
use a converter
didn't use it but looks good
http://code.google.com/p/mdb-sqlite/

-- 





[web2py] Re: Web2Py and MS Access

2012-11-16 Thread Tim Richardson


On Friday, 16 November 2012 20:32:23 UTC+11, Simon Carr wrote:

 Which SQL Standard?


:)
But seriously, the SQL you develop to get anything working with Access will 
be unusually idiosyncratic. I have bad memories ... 

-- 





Re: [web2py] Multilanguage website

2012-11-16 Thread David Sorrentino
Hi Niphlod,

Thanks for your example. It's crystal clear. ;)
I got another doubt about multi-languages: on the online book I read that
in order to tell web2py which language is the default one, I have to use:

T.set_current_languages('it')


Now I am wondering if I need to use it in the controller and call it every
time I load a page, or I can put it somewhere else and tell web2py just
once which one is the default language.

Sorry for all these doubts! :P

Cheers,
David


On 15 November 2012 21:46, Niphlod niph...@gmail.com wrote:

 I'd do the following
 1. choose a storage option for your content (you may want to use a simple
 table with a 'text' field for editing online, or code something to save the
 content to a txt file)
 2. code something that inspects the uri_language and does
 (semi-programming-language):
 if exists nameoftherequestedarticle:
   if uri_language in translationsofthearticle:
   content = translatedarticle
   else:
   content = originalarticle (english ?)
 else:
 raise 404

  --





-- 





[web2py] Re: GAE - SQL cloud connection

2012-11-16 Thread rif
I created today a sql cloud database. And I got the same error.

I changed to path VARCHAR(255) and now it works. Anybody else having the 
same problem?

-rif

marți, 7 august 2012, 18:27:13 UTC+3, Massimo Di Pierro a scris:

 Why does 512 result in Specified key was too long; max key length is 767 
 bytes. Is one counting unicode and one bytes? If setting this length to 
 128 is the only option, I will change it but I am afraid it may be too 
 short to store .table files. Did you encounter any problem after this 
 change?

 On Friday, 6 January 2012 18:43:22 UTC-6, howesc wrote:

 i don't know if i'm gonna regret this later, but in dal.py i changed that 
 field length to 128:

 self.db.executesql(CREATE TABLE IF NOT EXISTS 
 web2py_filesystem (path VARCHAR(128), content LONGTEXT, PRIMARY KEY(path) ) 
 ENGINE=InnoDB;)

 now it works again.



-- 





[web2py] Re: videos not working in auth.wiki page

2012-11-16 Thread Massimo Di Pierro
No. You do not need it. You just cut and paste the link to the youtube 
video page and it will embed the video automatically.

On Thursday, 15 November 2012 22:32:17 UTC-6, Andrew W wrote:


 Does the plugin_wiki syntax work in auth.wiki ? (I'll try it tonight).   
 From the book (plugins section):

 For example, to embed a YouTube video in a plugin_wiki page, you can do

 ``
 name: youtube
 code: l7AWnfFRc7g
 ``:widget

 or to embed the same widget in a web2py view, you can do:

 {{=plugin_wiki.widget('youtube',code='l7AWnfFRc7g')}}




-- 





[web2py] Re: GAE - SQL cloud connection

2012-11-16 Thread Massimo Di Pierro
Please open a ticket and we will fix this asap.

On Friday, 16 November 2012 04:49:35 UTC-6, rif wrote:

 I created today a sql cloud database. And I got the same error.

 I changed to path VARCHAR(255) and now it works. Anybody else having the 
 same problem?

 -rif

 marți, 7 august 2012, 18:27:13 UTC+3, Massimo Di Pierro a scris:

 Why does 512 result in Specified key was too long; max key length is 767 
 bytes. Is one counting unicode and one bytes? If setting this length to 
 128 is the only option, I will change it but I am afraid it may be too 
 short to store .table files. Did you encounter any problem after this 
 change?

 On Friday, 6 January 2012 18:43:22 UTC-6, howesc wrote:

 i don't know if i'm gonna regret this later, but in dal.py i changed 
 that field length to 128:

 self.db.executesql(CREATE TABLE IF NOT EXISTS 
 web2py_filesystem (path VARCHAR(128), content LONGTEXT, PRIMARY KEY(path) ) 
 ENGINE=InnoDB;)

 now it works again.



-- 





[web2py] Re: GAE - SQL cloud connection

2012-11-16 Thread rif
Done (http://code.google.com/p/web2py/issues/detail?id=1172)

Are the migrations issues to GoogleSQL still present?

-rif

vineri, 16 noiembrie 2012, 12:57:14 UTC+2, Massimo Di Pierro a scris:

 Please open a ticket and we will fix this asap.

 On Friday, 16 November 2012 04:49:35 UTC-6, rif wrote:

 I created today a sql cloud database. And I got the same error.

 I changed to path VARCHAR(255) and now it works. Anybody else having the 
 same problem?

 -rif

 marți, 7 august 2012, 18:27:13 UTC+3, Massimo Di Pierro a scris:

 Why does 512 result in Specified key was too long; max key length is 
 767 bytes. Is one counting unicode and one bytes? If setting this length 
 to 128 is the only option, I will change it but I am afraid it may be too 
 short to store .table files. Did you encounter any problem after this 
 change?

 On Friday, 6 January 2012 18:43:22 UTC-6, howesc wrote:

 i don't know if i'm gonna regret this later, but in dal.py i changed 
 that field length to 128:

 self.db.executesql(CREATE TABLE IF NOT EXISTS 
 web2py_filesystem (path VARCHAR(128), content LONGTEXT, PRIMARY KEY(path) 
 ) 
 ENGINE=InnoDB;)

 now it works again.



-- 





Re: [web2py] Multilanguage website

2012-11-16 Thread David Sorrentino
Very last doubt, I promise! :P

Let us assume that I am visiting the page at this url:

/en/portfolio


and I want to change to /it/portfolio, how can I set URL in order to do
that?
If I set it like this:

URL('it')


I will obtain:

/en/it


which is an invalid function.

Cheers,
David


On 16 November 2012 11:33, David Sorrentino sorrentino...@gmail.com wrote:

 Hi Niphlod,

 Thanks for your example. It's crystal clear. ;)
 I got another doubt about multi-languages: on the online book I read that
 in order to tell web2py which language is the default one, I have to use:

 T.set_current_languages('it')


 Now I am wondering if I need to use it in the controller and call it every
 time I load a page, or I can put it somewhere else and tell web2py just
 once which one is the default language.

 Sorry for all these doubts! :P

 Cheers,
 David



 On 15 November 2012 21:46, Niphlod niph...@gmail.com wrote:

 I'd do the following
 1. choose a storage option for your content (you may want to use a simple
 table with a 'text' field for editing online, or code something to save the
 content to a txt file)
 2. code something that inspects the uri_language and does
 (semi-programming-language):
 if exists nameoftherequestedarticle:
   if uri_language in translationsofthearticle:
   content = translatedarticle
   else:
   content = originalarticle (english ?)
 else:
 raise 404

  --







-- 





[web2py] Hash-flooding DoS attack in Ruby

2012-11-16 Thread Ralo Tannahill
Hash-flooding DoS attack reported for the Hash function (Ruby)
http://www.ruby-lang.org/en/news/2012/11/09/ruby19-hashdos-cve-2012-5371

Just for information, not a Dos for web2py.
In web2py can we limit the size of the parsed data? just in case there was 
a DoS like this one

Kind regards


-- 





[web2py] Re: auth.wiki( extra=dict() )

2012-11-16 Thread villas

Hi Massimo,  
I've just been checking it.
I think you need to change this...

Wiki  __init__()

This line:

self.extra = self.extra or {}

should be:

self.extra = extra or {} 


-- 





Re: [web2py] GAE - SQL cloud connection

2012-11-16 Thread Massimo DiPierro

On Nov 16, 2012, at 5:17 AM, rif wrote:

 Done (http://code.google.com/p/web2py/issues/detail?id=1172)
 
 Are the migrations issues to GoogleSQL still present?

I am not aware of any issue. Can you point me to some something about this?

 
 -rif
 
 vineri, 16 noiembrie 2012, 12:57:14 UTC+2, Massimo Di Pierro a scris:
 Please open a ticket and we will fix this asap.
 
 On Friday, 16 November 2012 04:49:35 UTC-6, rif wrote:
 I created today a sql cloud database. And I got the same error.
 
 I changed to path VARCHAR(255) and now it works. Anybody else having the same 
 problem?
 
 -rif
 
 marți, 7 august 2012, 18:27:13 UTC+3, Massimo Di Pierro a scris:
 Why does 512 result in Specified key was too long; max key length is 767 
 bytes. Is one counting unicode and one bytes? If setting this length to 128 
 is the only option, I will change it but I am afraid it may be too short to 
 store .table files. Did you encounter any problem after this change?
 
 On Friday, 6 January 2012 18:43:22 UTC-6, howesc wrote:
 i don't know if i'm gonna regret this later, but in dal.py i changed that 
 field length to 128:
 
 self.db.executesql(CREATE TABLE IF NOT EXISTS web2py_filesystem 
 (path VARCHAR(128), content LONGTEXT, PRIMARY KEY(path) ) ENGINE=InnoDB;)
 
 now it works again.
 
 -- 
  
  
  

-- 





Re: [web2py] GAE - SQL cloud connection

2012-11-16 Thread rif
I was referring to http://web2py.com/books/default/chapter/29/06#Gotchas

vineri, 16 noiembrie 2012, 15:04:47 UTC+2, Massimo Di Pierro a scris:


 On Nov 16, 2012, at 5:17 AM, rif wrote:

 Done (http://code.google.com/p/web2py/issues/detail?id=1172)

 Are the migrations issues to GoogleSQL still present?


 I am not aware of any issue. Can you point me to some something about this?


 -rif

 vineri, 16 noiembrie 2012, 12:57:14 UTC+2, Massimo Di Pierro a scris:

 Please open a ticket and we will fix this asap.

 On Friday, 16 November 2012 04:49:35 UTC-6, rif wrote:

 I created today a sql cloud database. And I got the same error.

 I changed to path VARCHAR(255) and now it works. Anybody else having 
 the same problem?

 -rif

 marți, 7 august 2012, 18:27:13 UTC+3, Massimo Di Pierro a scris:

 Why does 512 result in Specified key was too long; max key length is 
 767 bytes. Is one counting unicode and one bytes? If setting this length 
 to 128 is the only option, I will change it but I am afraid it may be too 
 short to store .table files. Did you encounter any problem after this 
 change?

 On Friday, 6 January 2012 18:43:22 UTC-6, howesc wrote:

 i don't know if i'm gonna regret this later, but in dal.py i changed 
 that field length to 128:

 self.db.executesql(CREATE TABLE IF NOT EXISTS 
 web2py_filesystem (path VARCHAR(128), content LONGTEXT, PRIMARY KEY(path) 
 ) 
 ENGINE=InnoDB;)

 now it works again.


 -- 
  
  
  




-- 





[web2py] Width not working when resizing an image to use it as a submit button

2012-11-16 Thread Francisco Barretto
Hi there!

I'm having some troubles using an image as a substitute for a submit 
button...

I'm generating the form in the controller and using a local image as 
follows:
INPUT(_type=image, _value=Editar, _width=16, _height=16, _alt=
Editar,  _src=/+request.application+/static/images/edit.png),

The problem is the image is rendered with the right height but the width 
atributte seems to have absolutely no effect. The image's width is always 
210px. The funny thing is that the original hosted image is 128x128, so the 
render is resizing it with a bigger width than the original png width.

Any ideas? Thanks!


-- 





[web2py] Get request.var by it's name

2012-11-16 Thread Francisco Barretto
Hi there! How do I get a var value which is being passed by post into a 
controller by its name?

I mean, I don't want to get the values using request.args(0), because I'll 
be stuck with the index. I'd rather do something like 
request.args['dnsClass'], for example.

Any hints?
vars:dnsClass:INownername:



-- 





[web2py] Re: Get request.var by it's name

2012-11-16 Thread Niphlod
request.vars is a dict.
request.vars.keys() is a list of all the variables
request.vars['dnsClass'] is what you're searching for.

PS: your address bar will be 
app/controller/function?dnsClass=INownername=

On Friday, November 16, 2012 2:46:14 PM UTC+1, Francisco Barretto wrote:

 Hi there! How do I get a var value which is being passed by post into a 
 controller by its name?

 I mean, I don't want to get the values using request.args(0), because I'll 
 be stuck with the index. I'd rather do something like 
 request.args['dnsClass'], for example.

 Any hints?
 vars:dnsClass:INownername:





-- 





Re: [web2py] Multilanguage website

2012-11-16 Thread Niphlod
URL('it') is go to the it function in the same controller I'm in.
haven't played with that, but I guess web2py expects something like 
/a/lang/c/f so, by some means of request.something 
(function,controller,args,etc) you should be able to. 



On Friday, November 16, 2012 12:23:52 PM UTC+1, David Sorrentino wrote:

 Very last doubt, I promise! :P

 Let us assume that I am visiting the page at this url:

 /en/portfolio


 and I want to change to /it/portfolio, how can I set URL in order to do 
 that?
 If I set it like this:

 URL('it')


 I will obtain:

 /en/it


 which is an invalid function.

 Cheers,
 David


 On 16 November 2012 11:33, David Sorrentino sorren...@gmail.comjavascript:
  wrote:

 Hi Niphlod,

 Thanks for your example. It's crystal clear. ;)
 I got another doubt about multi-languages: on the online book I read that 
 in order to tell web2py which language is the default one, I have to use:

 T.set_current_languages('it')


 Now I am wondering if I need to use it in the controller and call it 
 every time I load a page, or I can put it somewhere else and tell web2py 
 just once which one is the default language.

 Sorry for all these doubts! :P

 Cheers,
 David



 On 15 November 2012 21:46, Niphlod nip...@gmail.com javascript:wrote:

 I'd do the following
 1. choose a storage option for your content (you may want to use a 
 simple table with a 'text' field for editing online, or code something to 
 save the content to a txt file)
 2. code something that inspects the uri_language and does 
 (semi-programming-language):
 if exists nameoftherequestedarticle:
   if uri_language in translationsofthearticle:
   content = translatedarticle
   else:
   content = originalarticle (english ?)
 else:
 raise 404

  -- 
  
  
  





-- 





[web2py] error export represet

2012-11-16 Thread www.diazluis.com
{{
import cStringIO
stream=cStringIO.StringIO()
estudiante_arancel_rows.export_to_csv_file(ofile=stream, represent=True)
response.headers['Content-Type']='application/vnd.ms-excel'
response.headers['Content-Disposition'] =  attachment; filename=%s % 
'data_sga.csv'
response.write(stream.getvalue(), escape=False)
}}


Traceback (most recent call last):
  File /home/diazluis2007/web2py/gluon/restricted.py, line 212, in 
restricted
exec ccode in environment
  File 
/home/diazluis2007/web2py/applications/sga/views/estudiante_arancel/exportar_excel.html,
 
line 3, in module
stream=cStringIO.StringIO()
  File /home/diazluis2007/web2py/gluon/dal.py, line 9249, in 
export_to_csv_file
value = field.represent(value)
TypeError: lambda() takes exactly 2 arguments (1 given)

 web2py: 2.2.1

-- 





[web2py] web2py 2.2.1 routes not redirecting

2012-11-16 Thread Vasile Ermicioi
hi,

instead of showing 'app' application it shows it show init app
but if I go
http://mysite.com/app
it works

routes.py

#!/usr/bin/python
# -*- coding: utf-8 -*-

routes_in = (
('(.*):https?://(.*)mysite\.com:(.*)/', '/app/'),
)


def __routes_doctest():
pass

if __name__ == '__main__':
import doctest
from gluon.rewrite import *
load(routes=__file__)
doctest.testmod()

-- 





[web2py] manual file upload fails when storing file in database - field is NULL

2012-11-16 Thread Cliff Kachinske
The title describes the problem.

Any suggestions as to what I might do?  Would it be simpler if I just 
uploaded to a directory?  I'm archiving for auditability, so I suppose 
there would still be a way to get at earlier versions of uploaded files.

Here is the model:

db.define_table('attachments',
Field('attachment', 'upload', uploadfield='payload'),
Field('filename', length=512),
Field('Description', 'text'),
Field('payload', 'blob'),
migrate=init_migrate,
)
Common fields are auth.signature and a field called tenant_link, which is 
how I implemented the request_tenant functionality before Massimo announced 
it.

Here is the controller code:
   for r in rows:
...
myfile = mypath + r.attachments.file_name + '.' + 
r.attachments.file_ext
try:
stream = open(myfile, 'rb')
except IOError:
no_finds.append(DIV('unable to find {}'.format(myfile)))
continue
else:
ok.append(DIV('found {}.{}, aka {}'.format(
r.attachments.file_name, r.attachments.file_ext, fname
)))
att_id = db2.attachments.insert(
attachment = db2.attachments.attachment.store(
stream, '{}.{}'.format(
r.attachments.file_name, r.attachments.file_ext
)
),
filename = fname,
Description = 
r.attachments.attachment_brief_description,
)

The insert is successful except the payload field is never populated.  Here 
is a snippet  of the results from this postgres query, SELECT id, 
filename, octet_length(payload) from attachments;

  9 | apt-get-output.txt   
   |10772
  10 | a_h_hits.txt 
   |24164
  11 | a_h_hits.txt 
   |24164
  12 | greg-free-bizcard   
|   215288
  27 | Tank Thickness ML.doc   
| 
  28 | Tank Thickness ML.doc(1) 
   | 
  29 | A short short file   
   | 
  30 | hello.txt   
|

Records 9, 10 and 11 were uploaded while testing the interface. Records 12 
and up were created using the above script. 

-- 





[web2py] Re: Width not working when resizing an image to use it as a submit button

2012-11-16 Thread villas
Note that CSS usually overrides html attributes.  
Try setting the width with _style='width:16px' instead.  (Only 16px?)
You can use Firefox with plugin Firebug to see what CSS rules are being 
applied.
Regards,  D


On Friday, November 16, 2012 1:18:39 PM UTC, Francisco Barretto wrote:

 Hi there!

 I'm having some troubles using an image as a substitute for a submit 
 button...

 I'm generating the form in the controller and using a local image as 
 follows:
 INPUT(_type=image, _value=Editar, _width=16, _height=16, _alt=
 Editar,  _src=/+request.application+/static/images/edit.png),

 The problem is the image is rendered with the right height but the width 
 atributte seems to have absolutely no effect. The image's width is always 
 210px. The funny thing is that the original hosted image is 128x128, so the 
 render is resizing it with a bigger width than the original png width.

 Any ideas? Thanks!




-- 





[web2py] Re: Very simple issue: redirect on login - auth.settings.login_next

2012-11-16 Thread Rob_McC
Thanks !

I spend some more time wrestling with this, and expanding my knowledge of 
this feature of web2py, which I enjoy doing.

*GOOD NEWS*, I finally got it to work, on a simple web2py app. - just by 
adding  2 lines in the right place.
(copy of working code below)

Now, I'm not sure if a bug exists, I only know that if I add
auth.navbar(referrer_actions=None)
The behavior I want will not work  (ie redirect to user/profile page, 
after  successful login).

Anthony, if it looks like a bug to you, I would be happy to submit a bug, 
and do whatever testing that would be helpful to 
this excellent community of web2py users.

Sure appreciate the help.
Rob


# - - - - - - - - - - - - - - - - - - 
# RAM START : it would seem, TWO of  these lines are required in 
# app name: AuthRedirect  - just a NEW application, with no modication
# web2py Version 2.2.1 (2012-10-21 16:57:04) stable
#
# CODE BELOW placed in : 
# /models/db.py - located BELOW the ## configure auth policy lines
#
# it is curious, that when I go to login page, 
# the URL page reads: 
# 
http://127.0.0.1:8000/AuthRedirect/default/user/login?_next=/AuthRedirect/default/index
# which sure looks like it is the DEFAULT behavior, ie redierected to HOME 
page
# yet, when I press Login button, I'm directed to 
# http://127.0.0.1:8000/AuthRedirect/default/user/profile
# which is EXACTLY what I wanted to happen.
#
# THIS does not work here  auth.navbar(referrer_actions=None)
# it seems I only need these two lines for login_next to work.

auth.next = None
auth.settings.login_next = URL('user/profile') 

# RAM END - - - - - - - - - - - - - - 



-- 





Re: [web2py] Re: Web2Py and MS Access

2012-11-16 Thread Simon Carr
I will take a look at this.

Thanks

On Friday, 16 November 2012 09:53:13 UTC, Vasile Ermicioi wrote:

 man do a favor for yourself and don't use ms access database, 
 move to sqlite which is built in python :)

 why?

 http://database-management-systems.findthebest.com/saved_compare/Access-vs-SQLite
 http://sqlite.phxsoftware.com/forums/p/666/3106.aspx

 and you will find more reasons on google

 how?
 use a converter 
 didn't use it but looks good 
 http://code.google.com/p/mdb-sqlite/



-- 





[web2py] Re: Web2Py and MS Access

2012-11-16 Thread Simon Carr
Glad you saw you the humorous side of it, I wasn't sure after I replied if 
it would be taken the wrong way. 

By the way I tried to create an adapter today for Access from the 
MSSQLAdapter library. I managed to get Web2Py creating tables in Access but 
only to the point where it had to create relationships, then it gave me 
errors. 

Any way, I am thinking about just sticking with SQLite which I have been 
using without a problem for a time, but I will have to do a lot of testing 
with it on a network drive before using in production.

Thanks for every ones help and suggestions.

Simon

On Friday, 16 November 2012 10:25:36 UTC, Tim Richardson wrote:



 On Friday, 16 November 2012 20:32:23 UTC+11, Simon Carr wrote:

 Which SQL Standard?


 :)
 But seriously, the SQL you develop to get anything working with Access 
 will be unusually idiosyncratic. I have bad memories ... 


-- 





[web2py] Unsigned int in DAL

2012-11-16 Thread Joseph.Piron
Hi all!

I have quite a problematic issue, I would like to know how to define a 
Field as unsigned in the DAL ?
I tested:
Field('triggerValue', 'unsigned integer', requires=IS_NOT_EMPTY(),notnull
=True),
and 
Field('triggerValue', 'integer', unsigned=True, 
requires=IS_NOT_EMPTY(),notnull
=True),

But it does not work. 
Could someone please enlighten me ? :D

Thanks in advance !!!

-- 





Re: [web2py] Unsigned int in DAL

2012-11-16 Thread Richard Vézina
Which backend do you use? I think that this feature is database specific...

Richard

On Fri, Nov 16, 2012 at 11:12 AM, Joseph.Piron joseph.pi...@gmail.comwrote:

 Hi all!

 I have quite a problematic issue, I would like to know how to define a
 Field as unsigned in the DAL ?
 I tested:
 Field('triggerValue', 'unsigned integer', requires=IS_NOT_EMPTY(),notnull
 =True),
 and
 Field('triggerValue', 'integer', unsigned=True, requires=IS_NOT_EMPTY
 (), notnull=True),

 But it does not work.
 Could someone please enlighten me ? :D

 Thanks in advance !!!

  --





-- 





Re: [web2py] Unsigned int in DAL

2012-11-16 Thread Marin Pranjić
You can use integer for development. In production, you can alter the
database with raw sql to change the field.
DAL will still think it's an integer. If needed, you can add validators to
make sure you're not working with negative numbers.


On Fri, Nov 16, 2012 at 5:15 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 Which backend do you use? I think that this feature is database specific...

 Richard


 On Fri, Nov 16, 2012 at 11:12 AM, Joseph.Piron joseph.pi...@gmail.comwrote:

 Hi all!

 I have quite a problematic issue, I would like to know how to define a
 Field as unsigned in the DAL ?
 I tested:
 Field('triggerValue', 'unsigned integer', requires=IS_NOT_EMPTY(),notnull
 =True),
 and
 Field('triggerValue', 'integer', unsigned=True, requires=IS_NOT_EMPTY
 (), notnull=True),

 But it does not work.
 Could someone please enlighten me ? :D

 Thanks in advance !!!

  --





  --





-- 





[web2py] Re: Manually setting email for auth registration form

2012-11-16 Thread pbreit
The problem might be in the code you stripped out. What does the code 
around line 138 look like?

It appears you are referencing items somewhere where it does not exist.

What does the code look like that processes the form? Do you have a 
redirect after 


For the email field, you might need to override the default requires:

table_user.email.requires = [IS_IN_DB(self.db, table_user.email,
error_message=self.messages.invalid_email)]

with

auth.settings.table_user.email.requires = None

Alternatively, you could set the email address yourself before processing 
the form if you have it:

form.vars.email = 'j...@yahoo.com'
if form.process().accepted:
   ...



On Thursday, November 15, 2012 7:42:16 PM UTC-8, Florian Letsch wrote:

 I have some custom requirements for registration, but I still want to use 
 auth.register() with a custom form view to rely on web2py's form validation.

 Background: I have a table of allowed email addresses with a generated 
 secret hash. (kind of like an invitation only registration). When you 
 access the secret invite link I look up the secret hash in the database and 
 want to use the auth.register() form  without the email field so I can set 
 the user's email to the one I already have.

 I have come across 2 problems:
 1. When my custom form doesn't include an email field, the form does not 
 seem to be processed and just redirects to itself. (see comment in view 
 below)
 2. When I set the email field to be not writable, the registration fails 
 and I get a ticket:
  Traceback (most recent call last):
  File /Users/flo/Applications/web2py/gluon/restricted.py, line 205, 
 inrestricted
  exec ccode in environment
  File 
 /Users/flo/Applications/web2py/applications/main/controllers/signup.pyhttp://127.0.0.1:8000/admin/default/edit/main/controllers/signup.py
 , line 138, in module
  File /Users/flo/Applications/web2py/gluon/globals.py, line 173, in 
 lambda
  self._caller = lambda f: f()
  File 
 /Users/flo/Applications/web2py/applications/main/controllers/signup.pyhttp://127.0.0.1:8000/admin/default/edit/main/controllers/signup.py
 , line 62, in complete
  form = auth.register(onaccept=on_accept)
  File /Users/flo/Applications/web2py/gluon/tools.py, line 1959, in 
 register
  user = Storage(table_user._filter_fields(user, id=True))
  File /Users/flo/Applications/web2py/gluon/dal.py, line 6683, 
 in_filter_fields
  return dict([(k, v) for (k, v) in record.items() if k
 AttributeError: 'NoneType' object has no attribute 'items'

 Here is the code that I think is relevant for this:

 Inside my controller:
 signup_data = 
 db(db.signup.signup_key==signup_key).select(db.signup.ALL).first()
 def on_accept(form):
 # does a whole bunch of setting up additional db entries
 pass # stripped out for the example
 auth.settings.table_user.email.default = signup_data.email
 auth.settings.table_user.email.writable = False # causes error
 form = auth.register(onaccept=on_accept) # line 62 (see error log)

 Inside my view:
 {{=form.custom.begin }}
 div style=display: none;
   {{ # removing this field from markup causes the form submission to 
 fail. :/}}
   {{=form.custom.widget.email }} 
 /div
 {{=form.custom.widget.first_name }}
 ... all the other widgets ...
 {{=form.custom.end}}




-- 





[web2py] Re: Migrating with postgres

2012-11-16 Thread pbreit
I think you might want to try:
1. copy all of the files in databases somewhere safe
2. delete all the files in databases
3. in the DB connection string, include (..., migrate=True, 
fake_migrate_all=True)
4. Access /appadmin to trigger a migration
5. Revert DB connection string to (..., migrate_enable=False, 
fake_migrate_all=False)

I believe this is safe but if you can try it out on a backup or test db, 
might be prudent.


On Wednesday, November 14, 2012 7:24:39 PM UTC-8, Richard Penman wrote:

 Having trouble migrating with postgres.

 With fake_migrate=True the the .table files are created.

 If migrate=True then error: auth_user already exists.

 Tried all combinations of these and deleting and removing .table files, 
 but no joy.

 Is web2py meant to support modify the tables with postgres? If so which 
 combination of options would you recommend?
 With sqlite this works fine.


-- 





Re: [web2py] Unsigned int in DAL

2012-11-16 Thread Joseph Piron
I am working with mysql, there's no way to do this without an alter table ?
(Which would be executed at each request moreover)
On Nov 16, 2012 5:25 PM, Marin Pranjić marin.pran...@gmail.com wrote:

 You can use integer for development. In production, you can alter the
 database with raw sql to change the field.
 DAL will still think it's an integer. If needed, you can add validators to
 make sure you're not working with negative numbers.


 On Fri, Nov 16, 2012 at 5:15 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Which backend do you use? I think that this feature is database
 specific...

 Richard


 On Fri, Nov 16, 2012 at 11:12 AM, Joseph.Piron joseph.pi...@gmail.comwrote:

 Hi all!

 I have quite a problematic issue, I would like to know how to define a
 Field as unsigned in the DAL ?
 I tested:
 Field('triggerValue', 'unsigned integer', 
 requires=IS_NOT_EMPTY(),notnull
 =True),
 and
 Field('triggerValue', 'integer', unsigned=True, requires=
 IS_NOT_EMPTY(), notnull=True),

 But it does not work.
 Could someone please enlighten me ? :D

 Thanks in advance !!!

  --





  --





  --





-- 





[web2py] Re: Unsigned int in DAL

2012-11-16 Thread villas
I don't think that DAL has this field type.   
You can use a validator to make sure the integer is positive.  
See IS_INT_IN_RANGE and  IS_EXPR in the online book.


On Friday, November 16, 2012 4:12:45 PM UTC, Joseph.Piron wrote:

 Hi all!

 I have quite a problematic issue, I would like to know how to define a 
 Field as unsigned in the DAL ?
 I tested:
 Field('triggerValue', 'unsigned integer', requires=IS_NOT_EMPTY(),notnull
 =True),
 and 
 Field('triggerValue', 'integer', unsigned=True, requires=IS_NOT_EMPTY
 (), notnull=True),

 But it does not work. 
 Could someone please enlighten me ? :D

 Thanks in advance !!!



-- 





[web2py] Re: Very simple issue: redirect on login - auth.settings.login_next

2012-11-16 Thread Anthony
How does someone arrive at your login page? Is it via the Login link 
generated by the auth.navbar()?

Anthony

On Friday, November 16, 2012 10:42:48 AM UTC-5, Rob_McC wrote:

 Thanks !

 I spend some more time wrestling with this, and expanding my knowledge of 
 this feature of web2py, which I enjoy doing.

 *GOOD NEWS*, I finally got it to work, on a simple web2py app. - just by 
 adding  2 lines in the right place.
 (copy of working code below)

 Now, I'm not sure if a bug exists, I only know that if I add
 auth.navbar(referrer_actions=None)
 The behavior I want will not work  (ie redirect to user/profile page, 
 after  successful login).

 Anthony, if it looks like a bug to you, I would be happy to submit a bug, 
 and do whatever testing that would be helpful to 
 this excellent community of web2py users.

 Sure appreciate the help.
 Rob


 # - - - - - - - - - - - - - - - - - - 
 # RAM START : it would seem, TWO of  these lines are required in 
 # app name: AuthRedirect  - just a NEW application, with no modication
 # web2py Version 2.2.1 (2012-10-21 16:57:04) stable
 #
 # CODE BELOW placed in : 
 # /models/db.py - located BELOW the ## configure auth policy lines
 #
 # it is curious, that when I go to login page, 
 # the URL page reads: 
 # 
 http://127.0.0.1:8000/AuthRedirect/default/user/login?_next=/AuthRedirect/default/index
 # which sure looks like it is the DEFAULT behavior, ie redierected to HOME 
 page
 # yet, when I press Login button, I'm directed to 
 # http://127.0.0.1:8000/AuthRedirect/default/user/profile
 # which is EXACTLY what I wanted to happen.
 #
 # THIS does not work here  auth.navbar(referrer_actions=None)
 # it seems I only need these two lines for login_next to work.

 auth.next = None
 auth.settings.login_next = URL('user/profile') 

 # RAM END - - - - - - - - - - - - - - 





-- 





[web2py] Jquery function not triggered for fields in LOAD component

2012-11-16 Thread vivek
I have a SQLFORM.grid which I load using LOAD component.

Now i want to perform few onscreen auto calculations when I add data into 
this table via sqlform.grid. So i have setup few jquery functions to do it. 
 It used to run smoothly before when I didnt have the SQLFORM.grid run via 
LOAD. But now these functions arent being triggered. I tried placing these 
scripts in the qindex.load ( this is the load view in my case) but it 
doesnt work

All help is much appreciated 

Thank you
Vivek

-- 





[web2py] Re: Empty db stats and db tables in response.toolbar() despite database connection - MySQL

2012-11-16 Thread Cédric Mayer
I confirm the bug using 2.2.1 (I am not using trunk...)

It is because in gluon/globals THREAD_LOCAL.instances do not exist and the 
replacement THREAD_LOCAL.db_instances has a different architecture.

To correct (I hope it's in the trunk already):

dbstats = [TABLE(*[TR(PRE(row[0]), '%.2fms' % (row[1] * 1000))
   for row in l[0]._timings])
   for i,l in THREAD_LOCAL.db_instances.iteritems()]
dbtables = dict([(regex_nopasswd.sub('**', l[0]._uri),
  {'defined':
   sorted(list(set(l[0].tables) -
   set(l[0]._LAZY_TABLES.keys( 
or
   '[no defined tables]',
   'lazy': sorted(l[0]._LAZY_TABLES.keys()) or
   '[no lazy tables]'})
 for i,l in THREAD_LOCAL.db_instances.iteritems
()])



Le mercredi 14 novembre 2012 15:40:40 UTC+1, Massimo Di Pierro a écrit :

 Any chance you can try trunk? I remember we made some changes about it 
 recently because of a bug.

 On Tuesday, 13 November 2012 11:01:51 UTC-6, Maciej Kwiecień wrote:

 Dear All, 

 I'm using 2.2.1 version on Apache 2.2.19 with ssl, on Windows 7 (64 bit). 
 The database engine is MySQL. 

 No matter how my models look like I never get anything in db stats and 
 db tables info in response.toolbar().
 When I explicitly output db._timings in the view, at least 3 queries are 
 shown.

 What can be the reason?

 Thank you!
 Maciek



-- 





Re: [web2py] Jquery function not triggered for fields in LOAD component

2012-11-16 Thread Richard Vézina
I have similar problem, trying to set some bootstrap style... I think that
how LOAD works it remove everything but html...

I will investigate about that soon.

Interested in any input since then.

Richard

On Fri, Nov 16, 2012 at 1:05 PM, vivek vi...@digambernath.org wrote:

 I have a SQLFORM.grid which I load using LOAD component.

 Now i want to perform few onscreen auto calculations when I add data into
 this table via sqlform.grid. So i have setup few jquery functions to do it.
  It used to run smoothly before when I didnt have the SQLFORM.grid run via
 LOAD. But now these functions arent being triggered. I tried placing these
 scripts in the qindex.load ( this is the load view in my case) but it
 doesnt work

 All help is much appreciated

 Thank you
 Vivek

 --





-- 





Re: [web2py] Multilanguage website

2012-11-16 Thread David Sorrentino
Niphlod,

I understand that web2py expects something like /a/lang/c/f or /lang/c/f,
but playing with request.something I didn't manage to obtain that. :)
Any tips?
Thanks for your help.

Have a good night.
David


On 16 November 2012 15:25, Niphlod niph...@gmail.com wrote:

 URL('it') is go to the it function in the same controller I'm in.
 haven't played with that, but I guess web2py expects something like
 /a/lang/c/f so, by some means of request.something
 (function,controller,args,etc) you should be able to.



 On Friday, November 16, 2012 12:23:52 PM UTC+1, David Sorrentino wrote:

 Very last doubt, I promise! :P

 Let us assume that I am visiting the page at this url:

 /en/portfolio


 and I want to change to /it/portfolio, how can I set URL in order to do
 that?
 If I set it like this:

 URL('it')


 I will obtain:

 /en/it


 which is an invalid function.

 Cheers,
 David


 On 16 November 2012 11:33, David Sorrentino sorren...@gmail.com wrote:

 Hi Niphlod,

 Thanks for your example. It's crystal clear. ;)
 I got another doubt about multi-languages: on the online book I read
 that in order to tell web2py which language is the default one, I have to
 use:

 T.set_current_languages('it')


 Now I am wondering if I need to use it in the controller and call it
 every time I load a page, or I can put it somewhere else and tell web2py
 just once which one is the default language.

 Sorry for all these doubts! :P

 Cheers,
 David



 On 15 November 2012 21:46, Niphlod nip...@gmail.com wrote:

 I'd do the following
 1. choose a storage option for your content (you may want to use a
 simple table with a 'text' field for editing online, or code something to
 save the content to a txt file)
 2. code something that inspects the uri_language and does
 (semi-programming-language):
 if exists nameoftherequestedarticle:
   if uri_language in translationsofthearticle:
   content = translatedarticle
   else:
   content = originalarticle (english ?)
 else:
 raise 404

  --






  --





-- 





[web2py] Re: Jquery function not triggered for fields in LOAD component

2012-11-16 Thread LightDot
To execute JavaScript as the component loads, use response.js in the 
controller of the component you're loading. Search for response.js in the 
book or on this forum to get started...

Regards,
Ales



On Friday, November 16, 2012 7:05:48 PM UTC+1, vivek wrote:

 I have a SQLFORM.grid which I load using LOAD component.

 Now i want to perform few onscreen auto calculations when I add data into 
 this table via sqlform.grid. So i have setup few jquery functions to do it. 
  It used to run smoothly before when I didnt have the SQLFORM.grid run via 
 LOAD. But now these functions arent being triggered. I tried placing these 
 scripts in the qindex.load ( this is the load view in my case) but it 
 doesnt work

 All help is much appreciated 

 Thank you
 Vivek


-- 





[web2py] How do I include text from a file in static in my email templates?

2012-11-16 Thread Jason Brower
I want to include the text from static in my email templates.  I 
currently have this, but it doesn't work:

style type=text/css
{{=LOAD(url=URL('static', 'css/web2py.css', scheme='http'),ajax=False)}}
{{=LOAD(url=URL('static', 'css/style.css', scheme='http'),ajax=False)}}
/style
But this doesn't work as I can't use js in email messages.
BR,
Jason Brower

--





Re: [web2py] Jquery function not triggered for fields in LOAD component

2012-11-16 Thread Niphlod
load is just a convenience wrapper to load a fragment and to trap form 
submissions. Something in your js is not firing, but you need to show us 
the code to pinpoint the cause

-- 





[web2py] Re: Empty db stats and db tables in response.toolbar() despite database connection - MySQL

2012-11-16 Thread Niphlod
yet in trunk!

On Friday, November 16, 2012 7:24:44 PM UTC+1, Cédric Mayer wrote:

 I confirm the bug using 2.2.1 (I am not using trunk...)

 It is because in gluon/globals THREAD_LOCAL.instances do not exist and the 
 replacement THREAD_LOCAL.db_instances has a different architecture.

 To correct (I hope it's in the trunk already):

 dbstats = [TABLE(*[TR(PRE(row[0]), '%.2fms' % (row[1] * 1000))
for row in l[0]._timings])
for i,l in THREAD_LOCAL.db_instances.iteritems()]
 dbtables = dict([(regex_nopasswd.sub('**', l[0]._uri),
   {'defined':
sorted(list(set(l[0].tables) -
set(l[0]._LAZY_TABLES.keys( 
 or
'[no defined tables]',
'lazy': sorted(l[0]._LAZY_TABLES.keys()) or
'[no lazy tables]'})
  for i,l in THREAD_LOCAL.db_instances.
 iteritems()])



 Le mercredi 14 novembre 2012 15:40:40 UTC+1, Massimo Di Pierro a écrit :

 Any chance you can try trunk? I remember we made some changes about it 
 recently because of a bug.

 On Tuesday, 13 November 2012 11:01:51 UTC-6, Maciej Kwiecień wrote:

 Dear All, 

 I'm using 2.2.1 version on Apache 2.2.19 with ssl, on Windows 7 (64 
 bit). The database engine is MySQL. 

 No matter how my models look like I never get anything in db stats and 
 db tables info in response.toolbar().
 When I explicitly output db._timings in the view, at least 3 queries are 
 shown.

 What can be the reason?

 Thank you!
 Maciek



-- 





Re: [web2py] Re: Jquery function not triggered for fields in LOAD component

2012-11-16 Thread Richard Vézina
Haha!

Thanks LightDot

Richard

On Fri, Nov 16, 2012 at 2:44 PM, LightDot light...@gmail.com wrote:

 To execute JavaScript as the component loads, use response.js in the
 controller of the component you're loading. Search for response.js in the
 book or on this forum to get started...

 Regards,
 Ales




 On Friday, November 16, 2012 7:05:48 PM UTC+1, vivek wrote:

 I have a SQLFORM.grid which I load using LOAD component.

 Now i want to perform few onscreen auto calculations when I add data into
 this table via sqlform.grid. So i have setup few jquery functions to do it.
  It used to run smoothly before when I didnt have the SQLFORM.grid run via
 LOAD. But now these functions arent being triggered. I tried placing these
 scripts in the qindex.load ( this is the load view in my case) but it
 doesnt work

 All help is much appreciated

 Thank you
 Vivek

  --





-- 





Re: [web2py] Unsigned int in DAL

2012-11-16 Thread Niphlod


On Friday, November 16, 2012 5:56:18 PM UTC+1, Joseph.Piron wrote:

 I am working with mysql, there's no way to do this without an alter table 
 ? (Which would be executed at each request moreover)

PS: once the table is altered externally there's no need to perform 
anything on web2py. it's just for form validation (i.e. some of your users 
insist on filling that field with, e.g. -10 that you should enforce a 
IS_INT_IN_RANGE(minimum=0) to show the error to the user.)

-- 





[web2py] Re: Unsigned int in DAL

2012-11-16 Thread Joseph.Piron
No I can't, here I have to stock and let the user enter 2**31 and not 
2**31-1
As everything else is possible, shouldn't it be possible to add a aprameter 
to the field constructor to set unsigned ?
That would be really handy in situation such as mine where I have to deploy 
the solution on many servers.

Le vendredi 16 novembre 2012 18:19:26 UTC+1, villas a écrit :

 I don't think that DAL has this field type.   
 You can use a validator to make sure the integer is positive.  
 See IS_INT_IN_RANGE and  IS_EXPR in the online book.


 On Friday, November 16, 2012 4:12:45 PM UTC, Joseph.Piron wrote:

 Hi all!

 I have quite a problematic issue, I would like to know how to define a 
 Field as unsigned in the DAL ?
 I tested:
 Field('triggerValue', 'unsigned integer', requires=IS_NOT_EMPTY(),notnull
 =True),
 and 
 Field('triggerValue', 'integer', unsigned=True, requires=IS_NOT_EMPTY
 (), notnull=True),

 But it does not work. 
 Could someone please enlighten me ? :D

 Thanks in advance !!!



-- 





Re: [web2py] Re: How to turn retrieved rows into a SELECT?

2012-11-16 Thread Jim S
Richard - I've been trying to get this working but am not having any luck. 
 I have the lazy_options_widget working with the first field being a 
suggest_widget, but am trying to implement with your suggestion above using 
a SELECT element as the first field, but it isn't working.  I'm using this 
in an edit for generated by a smartgrid and am using the following for the 
FIRSTFIELDNAME as you have it above.

benefit_benefitProgramId

This is the ID associated with the first field when I look at the HTML that 
is generated.  I think I'm following along with the javascript ok, but 
don't understand why my code isn't working. 

Any tips on what to look for?  Did you actually have this working in a 
sample?

Any help would be appreciated.

-Jim

On Wednesday, August 29, 2012 9:25:07 AM UTC-5, Richard wrote:

 Here the code for use a regular drop down and avoid use of autocomplete 
 plugin dependency.

 In controller :
 conditional_field_trigger_selected_event_js = 
 '$(select[name=FIRSTFIELDNAME]).change(function() {var val = 
 $(this).children(:selected).attr(value);$(this).trigger($(this).attr(id)
  
 + __selected, [val]);});'

 In view :
 script type=text/javascript
 {{=XML(conditional_field_trigger_selected_event_js)}}
 /script

 Richard

 On Wed, Aug 29, 2012 at 10:21 AM, Anthony abas...@gmail.com javascript:
  wrote:

 See 
 http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
  for 
 links to some other related recipes.

 Anthony


 On Wednesday, August 29, 2012 3:04:10 AM UTC-4, lyn2py wrote:

 Thank you Anthony and Richard, I have tried to use IS_IN_DB in the form 
 of return IS_IN_DB(...) but it doesn't work.

 The reason why I am looking for this function is because I am trying to 
 load the options or a second field, based on what is chosen in the first 
 field. Both are SELECTs.

 Like this example here:
 http://dev.s-cubism.com/plugin_lazy_options_widget
 but the first field is a select instead of autocomplete.

 I am unable to find a function that will return a SELECT field (based on 
 the chosen rows) for the ajax success function.

 On Wednesday, August 29, 2012 12:50:13 AM UTC+8, Anthony wrote:

 Yes. By default, a reference field gets a validator like this: 
 IS_IN_DB(db, db.sometable._id, db.sometable._format). However, the 
 IS_IN_DB() validator can take a Set object as the first argument instead 
 of 
 db, and the list will be based on the records defined by that Set. In that 
 case, you'll have to explicitly define the validator:

 requires=IS_IN_DB(db([your query]), db.sometable.id, db.sometable.
 _format)

 Note, when you define your own validator, you also lose the automatic 
 represent attribute for the reference field, so you might want to set 
 your own:

 represent=db.sometable._format

 Anthony

 On Tuesday, August 28, 2012 12:28:10 PM UTC-4, lyn2py wrote:

 Hello experts,

 Generally, when we do a SQLFORM, the 'reference table' fields 
 automatically gets *all* the available options for choosing as a dropdown 
 menu.

 However, I would like to get a filtered list instead of *all* of the 
 items. Is there an available function I can use to achieve a filtered 
 list 
 for choosing in the dropdown menu?

 Another way to look at this is:
 I would like to generate a SELECT/OPTIONS html using a specific query, 
 i.e. it uses the retrieved Rows to generate the HTML. I wonder if there 
 is 
 a function in web2py for doing this.

 I hope my question is understood. Thank you.


 PS. If there isn't an available function, I appreciate any tips or 
 pointers how I can make this work. Thanks!

 -- 
  
  
  




-- 





Re: [web2py] Multilanguage website

2012-11-16 Thread Niphlod
ok, I played with it and understood an underlying design decision to let 
the current request.uri_language to propagate to all URL() generated links. 
In fact, parameter based router was thought to let different versions of 
the same site to behave in a consistent way (i.e., if you accessed 
myapp/it/something, it's likely that you'd like to navigate the entire site 
from there mapped to the it language).

In this case, generating(showing) an url containing a different language is 
forbidden by the URL syntax but can be easily managedjust not 
using the URL() function :P

You can use some replace with request.env.path_info, but I found a nicer 
method: you can in fact alter the language mapping of the URL just 
(re)setting the request.uri_language variable.
I mean:
/myapp/it/default/index
URL('something', 'else') -- /myapp/it/something/else
but:
/myapp/it/default/index
request.uri_language = 'jp'
URL('something', 'else') -- /myapp/jp/something/else

My advice would be to save the actual request.uri_language in some 
variable and altering that just to generate the URLs, then reset it back to 
the original value (so static and other links won't be 'altered', and you 
get the shortest possible link, etc etc)  e.g.

def index():
orig_lang = request.uri_lang
request.uri_lang = 'en'
this_page_in_eng_url = URL()
request.uri_lang = 'it'
this_page_in_it_url = URL()
request.uri_lang = orig_lang
return dict()








On Friday, November 16, 2012 8:33:34 PM UTC+1, David Sorrentino wrote:

 Niphlod,

 I understand that web2py expects something like /a/lang/c/f or /lang/c/f, 
 but playing with request.something I didn't manage to obtain that. :)
 Any tips?
 Thanks for your help.

 Have a good night.
 David


 On 16 November 2012 15:25, Niphlod nip...@gmail.com javascript: wrote:

 URL('it') is go to the it function in the same controller I'm in.
 haven't played with that, but I guess web2py expects something like 
 /a/lang/c/f so, by some means of request.something 
 (function,controller,args,etc) you should be able to. 



 On Friday, November 16, 2012 12:23:52 PM UTC+1, David Sorrentino wrote:

 Very last doubt, I promise! :P

 Let us assume that I am visiting the page at this url:

 /en/portfolio


 and I want to change to /it/portfolio, how can I set URL in order to do 
 that?
 If I set it like this:

 URL('it')


 I will obtain:

 /en/it


 which is an invalid function.

 Cheers,
 David


 On 16 November 2012 11:33, David Sorrentino sorren...@gmail.com wrote:

 Hi Niphlod,

 Thanks for your example. It's crystal clear. ;)
 I got another doubt about multi-languages: on the online book I read 
 that in order to tell web2py which language is the default one, I have to 
 use:

 T.set_current_languages('it')


 Now I am wondering if I need to use it in the controller and call it 
 every time I load a page, or I can put it somewhere else and tell web2py 
 just once which one is the default language.

 Sorry for all these doubts! :P

 Cheers,
 David



 On 15 November 2012 21:46, Niphlod nip...@gmail.com wrote:

 I'd do the following
 1. choose a storage option for your content (you may want to use a 
 simple table with a 'text' field for editing online, or code something to 
 save the content to a txt file)
 2. code something that inspects the uri_language and does 
 (semi-programming-language):
 if exists nameoftherequestedarticle:
   if uri_language in translationsofthearticle:
   content = translatedarticle
   else:
   content = originalarticle (english ?)
 else:
 raise 404

  -- 
  
  
  



  -- 
  
  
  




-- 





[web2py] Re: Unsigned int in DAL

2012-11-16 Thread Niphlod


On Friday, November 16, 2012 9:23:33 PM UTC+1, Joseph.Piron wrote:

 No I can't, here I have to stock and let the user enter 2**31 and not 
 2**31-1
 As everything else is possible, shouldn't it be possible to add a 
 aprameter to the field constructor to set unsigned ?
 That would be really handy in situation such as mine where I have to 
 deploy the solution on many servers.


 2**31 is not even allowed in a normal 'integer' field. That is a math 
notation not supported and requires a whole different validation (and 
parsing).
 
What we are saying is that :
a) if you place a requires=IS_INT_IN_RANGE(0) there's no way any user can 
enter -12 and submit that value, no matter what the underlying column 
type is set on the db
b) you can alter the column type a posteriori and web2py will be happy 
with that even if your model specifies 'integer'

PS: c) 
- deploy your app to the 1st server
- take the sql.log you can find in the databases/ folder
- alter the column format as you wish in the declaration
- execute those statements on all the other servers
- deploy your app with migrate=False (which you should do in any case if 
your model doesn't change)

-- 





Re: [web2py] Jquery function not triggered for fields in LOAD component

2012-11-16 Thread Richard Vézina
Hmm...

I pass by reponse.js many little script that works just fine... But it
seems that I have to pass bootstrap.js to in order to have the all the
bootstrap feature to work. Is ti normal?

Richard

On Fri, Nov 16, 2012 at 2:53 PM, Niphlod niph...@gmail.com wrote:

 load is just a convenience wrapper to load a fragment and to trap form
 submissions. Something in your js is not firing, but you need to show us
 the code to pinpoint the cause

  --





-- 





[web2py] Re: Web2Py and MS Access

2012-11-16 Thread Tim Richardson
Humour me back ... download SQL Server express edition and the accompanying 
SQL Server Management Studio (Express edition) and have a look at it. It 
runs well on Windows 7  XP desktops. People could also recommend postgres, 
but for getting up and running quickly, and for its very friendly 
management tools, SQL Server could be a great fit. It has the best 
graphical query editor ever seen  
Of course, if you are supporting multiple users with a network approach, 
then there must be a file server, so you'd need to get it installed on the 
file server or sneakily use another always-on computer as the server. 
It's a bit of mucking around, but once you win the argument with your IT 
people and get control over SQL Server, or at least one database on it, 
you'll be deploying web2py apps faster than you can blink. And you won't 
have to waste a second testing it. 


-- 





Re: [web2py] Re: How to turn retrieved rows into a SELECT?

2012-11-16 Thread Richard Vézina
Hi Jim,

I am not sure I follow...

What you have done so far?

On Fri, Nov 16, 2012 at 3:31 PM, Jim S j...@qlf.com wrote:

 Richard - I've been trying to get this working but am not having any luck.
  I have the lazy_options_widget working with the first field being a
 suggest_widget, but am trying to implement with your suggestion above using
 a SELECT element as the first field, but it isn't working.  I'm using this
 in an edit for generated by a smartgrid and am using the following for the
 FIRSTFIELDNAME as you have it above.

 benefit_benefitProgramId

 This is the ID associated with the first field when I look at the HTML
 that is generated.  I think I'm following along with the javascript ok, but
 don't understand why my code isn't working.

 Any tips on what to look for?  Did you actually have this working in a
 sample?

 Any help would be appreciated.

 -Jim

 On Wednesday, August 29, 2012 9:25:07 AM UTC-5, Richard wrote:

 Here the code for use a regular drop down and avoid use of autocomplete
 plugin dependency.

 In controller :
 conditional_field_trigger_selected_event_js =
 '$(select[name=FIRSTFIELDNAME]).change(function() {var val =
 $(this).children(:selected).attr(value);$(this).trigger($(this).attr(id)
 + __selected, [val]);});'

 In view :
 script type=text/javascript
 {{=XML(conditional_field_trigger_selected_event_js)}}
 /script

 Richard

 On Wed, Aug 29, 2012 at 10:21 AM, Anthony abas...@gmail.com wrote:

 See
 http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
  for
 links to some other related recipes.

 Anthony


 On Wednesday, August 29, 2012 3:04:10 AM UTC-4, lyn2py wrote:

 Thank you Anthony and Richard, I have tried to use IS_IN_DB in the form
 of return IS_IN_DB(...) but it doesn't work.

 The reason why I am looking for this function is because I am trying to
 load the options or a second field, based on what is chosen in the first
 field. Both are SELECTs.

 Like this example here:
 http://dev.s-cubism.com/plugin_lazy_options_widget
 but the first field is a select instead of autocomplete.

 I am unable to find a function that will return a SELECT field (based
 on the chosen rows) for the ajax success function.

 On Wednesday, August 29, 2012 12:50:13 AM UTC+8, Anthony wrote:

 Yes. By default, a reference field gets a validator like this:
 IS_IN_DB(db, db.sometable._id, db.sometable._format). However, the
 IS_IN_DB() validator can take a Set object as the first argument instead 
 of
 db, and the list will be based on the records defined by that Set. In that
 case, you'll have to explicitly define the validator:

 requires=IS_IN_DB(db([your query]), db.sometable.id, db.sometable.
 _format)

 Note, when you define your own validator, you also lose the automatic
 represent attribute for the reference field, so you might want to set
 your own:

 represent=db.sometable._format

 Anthony

 On Tuesday, August 28, 2012 12:28:10 PM UTC-4, lyn2py wrote:

 Hello experts,

 Generally, when we do a SQLFORM, the 'reference table' fields
 automatically gets *all* the available options for choosing as a dropdown
 menu.

 However, I would like to get a filtered list instead of *all* of the
 items. Is there an available function I can use to achieve a filtered 
 list
 for choosing in the dropdown menu?

 Another way to look at this is:
 I would like to generate a SELECT/OPTIONS html using a specific
 query, i.e. it uses the retrieved Rows to generate the HTML. I wonder if
 there is a function in web2py for doing this.

 I hope my question is understood. Thank you.


 PS. If there isn't an available function, I appreciate any tips or
 pointers how I can make this work. Thanks!

 --





  --





-- 





Re: [web2py] Re: How to turn retrieved rows into a SELECT?

2012-11-16 Thread Richard Vézina
It may be related to smartgrid...

Have you try with a straight sqlform??

Richard

On Fri, Nov 16, 2012 at 3:31 PM, Jim S j...@qlf.com wrote:

 Richard - I've been trying to get this working but am not having any luck.
  I have the lazy_options_widget working with the first field being a
 suggest_widget, but am trying to implement with your suggestion above using
 a SELECT element as the first field, but it isn't working.  I'm using this
 in an edit for generated by a smartgrid and am using the following for the
 FIRSTFIELDNAME as you have it above.

 benefit_benefitProgramId

 This is the ID associated with the first field when I look at the HTML
 that is generated.  I think I'm following along with the javascript ok, but
 don't understand why my code isn't working.

 Any tips on what to look for?  Did you actually have this working in a
 sample?

 Any help would be appreciated.

 -Jim

 On Wednesday, August 29, 2012 9:25:07 AM UTC-5, Richard wrote:

 Here the code for use a regular drop down and avoid use of autocomplete
 plugin dependency.

 In controller :
 conditional_field_trigger_selected_event_js =
 '$(select[name=FIRSTFIELDNAME]).change(function() {var val =
 $(this).children(:selected).attr(value);$(this).trigger($(this).attr(id)
 + __selected, [val]);});'

 In view :
 script type=text/javascript
 {{=XML(conditional_field_trigger_selected_event_js)}}
 /script

 Richard

 On Wed, Aug 29, 2012 at 10:21 AM, Anthony abas...@gmail.com wrote:

 See
 http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
  for
 links to some other related recipes.

 Anthony


 On Wednesday, August 29, 2012 3:04:10 AM UTC-4, lyn2py wrote:

 Thank you Anthony and Richard, I have tried to use IS_IN_DB in the form
 of return IS_IN_DB(...) but it doesn't work.

 The reason why I am looking for this function is because I am trying to
 load the options or a second field, based on what is chosen in the first
 field. Both are SELECTs.

 Like this example here:
 http://dev.s-cubism.com/plugin_lazy_options_widget
 but the first field is a select instead of autocomplete.

 I am unable to find a function that will return a SELECT field (based
 on the chosen rows) for the ajax success function.

 On Wednesday, August 29, 2012 12:50:13 AM UTC+8, Anthony wrote:

 Yes. By default, a reference field gets a validator like this:
 IS_IN_DB(db, db.sometable._id, db.sometable._format). However, the
 IS_IN_DB() validator can take a Set object as the first argument instead 
 of
 db, and the list will be based on the records defined by that Set. In that
 case, you'll have to explicitly define the validator:

 requires=IS_IN_DB(db([your query]), db.sometable.id, db.sometable.
 _format)

 Note, when you define your own validator, you also lose the automatic
 represent attribute for the reference field, so you might want to set
 your own:

 represent=db.sometable._format

 Anthony

 On Tuesday, August 28, 2012 12:28:10 PM UTC-4, lyn2py wrote:

 Hello experts,

 Generally, when we do a SQLFORM, the 'reference table' fields
 automatically gets *all* the available options for choosing as a dropdown
 menu.

 However, I would like to get a filtered list instead of *all* of the
 items. Is there an available function I can use to achieve a filtered 
 list
 for choosing in the dropdown menu?

 Another way to look at this is:
 I would like to generate a SELECT/OPTIONS html using a specific
 query, i.e. it uses the retrieved Rows to generate the HTML. I wonder if
 there is a function in web2py for doing this.

 I hope my question is understood. Thank you.


 PS. If there isn't an available function, I appreciate any tips or
 pointers how I can make this work. Thanks!

 --





  --





-- 





Re: [web2py] Re: How to turn retrieved rows into a SELECT?

2012-11-16 Thread Jim S
Well, I can get it to work with smartgrid if I use a suggest_widget for the 
first field.  But, I'm trying to make my second SELECT element reload its 
options based on the option selected in the first SELECT element.  I was 
trying to follow the JS that you posted earlier, but I can't get it to 
trigger the reload of the second SELECT element.

With the smartgrid, the html element IDs are a bit different, but I've 
accommodated for that with the version I have working with the 
suggest_widget.

I'm looking for a way to debug this thing and see what is actually going 
on.  I can't say I'm a strong javascript'er but my understanding is that 
this code should end up somewhere on the 'view page source' html, and it 
isn't.  Would I be able to return it to the script and have it execute if I 
use the response.js variable?  Seems like it never gets executed.

-Jim

On Friday, November 16, 2012 3:19:40 PM UTC-6, Richard wrote:

 It may be related to smartgrid...

 Have you try with a straight sqlform??

 Richard

 On Fri, Nov 16, 2012 at 3:31 PM, Jim S j...@qlf.com javascript: wrote:

 Richard - I've been trying to get this working but am not having any 
 luck.  I have the lazy_options_widget working with the first field being a 
 suggest_widget, but am trying to implement with your suggestion above using 
 a SELECT element as the first field, but it isn't working.  I'm using this 
 in an edit for generated by a smartgrid and am using the following for the 
 FIRSTFIELDNAME as you have it above.

 benefit_benefitProgramId

 This is the ID associated with the first field when I look at the HTML 
 that is generated.  I think I'm following along with the javascript ok, but 
 don't understand why my code isn't working. 

 Any tips on what to look for?  Did you actually have this working in a 
 sample?

 Any help would be appreciated.

 -Jim

 On Wednesday, August 29, 2012 9:25:07 AM UTC-5, Richard wrote:

 Here the code for use a regular drop down and avoid use of autocomplete 
 plugin dependency.

 In controller :
 conditional_field_trigger_selected_event_js = 
 '$(select[name=FIRSTFIELDNAME]).change(function() {var val = 
 $(this).children(:selected).attr(value);$(this).trigger($(this).attr(id)
  
 + __selected, [val]);});'

 In view :
 script type=text/javascript
 {{=XML(conditional_field_trigger_selected_event_js)}}
 /script

 Richard

  On Wed, Aug 29, 2012 at 10:21 AM, Anthony abas...@gmail.com wrote:

 See 
 http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
  for 
 links to some other related recipes.

 Anthony


 On Wednesday, August 29, 2012 3:04:10 AM UTC-4, lyn2py wrote:

 Thank you Anthony and Richard, I have tried to use IS_IN_DB in the 
 form of return IS_IN_DB(...) but it doesn't work.

 The reason why I am looking for this function is because I am trying 
 to load the options or a second field, based on what is chosen in the 
 first 
 field. Both are SELECTs.

 Like this example here:
 http://dev.s-cubism.com/plugin_lazy_options_widget
 but the first field is a select instead of autocomplete.

 I am unable to find a function that will return a SELECT field (based 
 on the chosen rows) for the ajax success function.

 On Wednesday, August 29, 2012 12:50:13 AM UTC+8, Anthony wrote:

 Yes. By default, a reference field gets a validator like this: 
 IS_IN_DB(db, db.sometable._id, db.sometable._format). However, the 
 IS_IN_DB() validator can take a Set object as the first argument instead 
 of 
 db, and the list will be based on the records defined by that Set. In 
 that 
 case, you'll have to explicitly define the validator:

 requires=IS_IN_DB(db([your query]), db.sometable.id, db.sometable.
 _format)

 Note, when you define your own validator, you also lose the automatic 
 represent attribute for the reference field, so you might want to set 
 your own:

  represent=db.sometable._format

 Anthony

 On Tuesday, August 28, 2012 12:28:10 PM UTC-4, lyn2py wrote:

 Hello experts,

 Generally, when we do a SQLFORM, the 'reference table' fields 
 automatically gets *all* the available options for choosing as a 
 dropdown 
 menu.

 However, I would like to get a filtered list instead of *all* of the 
 items. Is there an available function I can use to achieve a filtered 
 list 
 for choosing in the dropdown menu?

 Another way to look at this is:
 I would like to generate a SELECT/OPTIONS html using a specific 
 query, i.e. it uses the retrieved Rows to generate the HTML. I wonder 
 if 
 there is a function in web2py for doing this.

 I hope my question is understood. Thank you.


 PS. If there isn't an available function, I appreciate any tips or 
 pointers how I can make this work. Thanks!

 -- 
  
  
  


  -- 
  
  
  




-- 





Re: [web2py] Jquery function not triggered for fields in LOAD component

2012-11-16 Thread Niphlod
if you have the default layout bootstrap.js is put at the end of the page.
trying to call something relying on that on a fragment that is put before 
the last piece of the page is loaded will obviously not run.
and again, LOAD() (when not called with ajax=False) is just a nice shortcut 
to $.ajax .
response.js allows you to have something called on a response, but you may 
embed the script on the returned component to get it executed as soon as 
it loads.
 

-- 





[web2py] Re: auth.wiki( extra=dict() )

2012-11-16 Thread Andrew W


Yes, it's broken: AttributeError: 'Wiki' object has no attribute 'extra'

I made the change below and it works.


On Saturday, November 17, 2012 12:54:14 AM UTC+13, villas wrote:

 Hi Massimo,  
 I've just been checking it.
 I think you need to change this...

 Wiki  __init__()

 This line:

 self.extra = self.extra or {}

 should be:

 self.extra = extra or {} 




-- 





[web2py] Re: videos not working in auth.wiki page

2012-11-16 Thread Andrew W
Thanks.
That's what I did.  

On Friday, November 16, 2012 11:56:49 PM UTC+13, Massimo Di Pierro wrote:

 No. You do not need it. You just cut and paste the link to the youtube 
 video page and it will embed the video automatically.

 On Thursday, 15 November 2012 22:32:17 UTC-6, Andrew W wrote:


 Does the plugin_wiki syntax work in auth.wiki ? (I'll try it tonight).   
 From the book (plugins section):

 For example, to embed a YouTube video in a plugin_wiki page, you can do

 ``
 name: youtube
 code: l7AWnfFRc7g
 ``:widget

 or to embed the same widget in a web2py view, you can do:

 {{=plugin_wiki.widget('youtube',code='l7AWnfFRc7g')}}




-- 





Re: [web2py] Re: How to turn retrieved rows into a SELECT?

2012-11-16 Thread Richard Vézina
Jim,

You can put the jQuery directly in html create/update form like this :
script
$(select[name=FIRSTFIELDNAME]).change(function() {
var val = $(this).children(:selected).attr(value);
$(this).trigger($(this).attr(id) + __selected, [val]);
});
/script

To make sure you selector are good you can set a background color like this
:

$(this).children(:selected).css('background-color','red');

Richard


On Fri, Nov 16, 2012 at 4:30 PM, Jim S j...@qlf.com wrote:

 Well, I can get it to work with smartgrid if I use a suggest_widget for
 the first field.  But, I'm trying to make my second SELECT element reload
 its options based on the option selected in the first SELECT element.  I
 was trying to follow the JS that you posted earlier, but I can't get it to
 trigger the reload of the second SELECT element.

 With the smartgrid, the html element IDs are a bit different, but I've
 accommodated for that with the version I have working with the
 suggest_widget.

 I'm looking for a way to debug this thing and see what is actually going
 on.  I can't say I'm a strong javascript'er but my understanding is that
 this code should end up somewhere on the 'view page source' html, and it
 isn't.  Would I be able to return it to the script and have it execute if I
 use the response.js variable?  Seems like it never gets executed.

 -Jim

 On Friday, November 16, 2012 3:19:40 PM UTC-6, Richard wrote:

 It may be related to smartgrid...

 Have you try with a straight sqlform??

 Richard


 On Fri, Nov 16, 2012 at 3:31 PM, Jim S j...@qlf.com wrote:

 Richard - I've been trying to get this working but am not having any
 luck.  I have the lazy_options_widget working with the first field being a
 suggest_widget, but am trying to implement with your suggestion above using
 a SELECT element as the first field, but it isn't working.  I'm using this
 in an edit for generated by a smartgrid and am using the following for the
 FIRSTFIELDNAME as you have it above.

 benefit_benefitProgramId

 This is the ID associated with the first field when I look at the HTML
 that is generated.  I think I'm following along with the javascript ok, but
 don't understand why my code isn't working.

 Any tips on what to look for?  Did you actually have this working in a
 sample?

 Any help would be appreciated.

 -Jim

 On Wednesday, August 29, 2012 9:25:07 AM UTC-5, Richard wrote:

 Here the code for use a regular drop down and avoid use of autocomplete
 plugin dependency.

 In controller :
 conditional_field_trigger_selected_event_js =
 '$(select[name=FIRSTFIELDNAME]).change(function() {var val =
 $(this).children(:selected).attr(value);$(this).trigger($(this).attr(id)
 + __selected, [val]);});'

 In view :
 script type=text/javascript
 {{=XML(conditional_field_trigger_selected_event_js)}}
 /script

 Richard

  On Wed, Aug 29, 2012 at 10:21 AM, Anthony abas...@gmail.com wrote:

 See
 http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
  for
 links to some other related recipes.

 Anthony


 On Wednesday, August 29, 2012 3:04:10 AM UTC-4, lyn2py wrote:

 Thank you Anthony and Richard, I have tried to use IS_IN_DB in the
 form of return IS_IN_DB(...) but it doesn't work.

 The reason why I am looking for this function is because I am trying
 to load the options or a second field, based on what is chosen in the 
 first
 field. Both are SELECTs.

 Like this example here:
 http://dev.s-cubism.com/plugin_lazy_options_widget
 but the first field is a select instead of autocomplete.

 I am unable to find a function that will return a SELECT field (based
 on the chosen rows) for the ajax success function.

 On Wednesday, August 29, 2012 12:50:13 AM UTC+8, Anthony wrote:

 Yes. By default, a reference field gets a validator like this:
 IS_IN_DB(db, db.sometable._id, db.sometable._format). However, the
 IS_IN_DB() validator can take a Set object as the first argument 
 instead of
 db, and the list will be based on the records defined by that Set. In 
 that
 case, you'll have to explicitly define the validator:

 requires=IS_IN_DB(db([your query]), db.sometable.id, db.sometable.
 _format)

 Note, when you define your own validator, you also lose the
 automatic represent attribute for the reference field, so you might 
 want
 to set your own:

  represent=db.sometable._format

 Anthony

 On Tuesday, August 28, 2012 12:28:10 PM UTC-4, lyn2py wrote:

 Hello experts,

 Generally, when we do a SQLFORM, the 'reference table' fields
 automatically gets *all* the available options for choosing as a 
 dropdown
 menu.

 However, I would like to get a filtered list instead of *all* of
 the items. Is there an available function I can use to achieve a 
 filtered
 list for choosing in the dropdown menu?

 Another way to look at this is:
 I would like to generate a SELECT/OPTIONS html using a specific
 query, i.e. it uses the retrieved Rows to generate the HTML. I wonder 
 if
 there 

Re: [web2py] Re: How to turn retrieved rows into a SELECT?

2012-11-16 Thread Richard Vézina
I have to go... Sorry...

It surely a selector that not catch what it suppose to...

My form use formestyle=divs that maybe affect somehow...

Richard

On Fri, Nov 16, 2012 at 4:40 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 Jim,

 You can put the jQuery directly in html create/update form like this :
 script
 $(select[name=FIRSTFIELDNAME]).change(function() {
 var val = $(this).children(:selected).attr(value);
 $(this).trigger($(this).attr(id) + __selected, [val]);
 });
 /script

 To make sure you selector are good you can set a background color like
 this :

 $(this).children(:selected).css('background-color','red');

 Richard


 On Fri, Nov 16, 2012 at 4:30 PM, Jim S j...@qlf.com wrote:

 Well, I can get it to work with smartgrid if I use a suggest_widget for
 the first field.  But, I'm trying to make my second SELECT element reload
 its options based on the option selected in the first SELECT element.  I
 was trying to follow the JS that you posted earlier, but I can't get it to
 trigger the reload of the second SELECT element.

 With the smartgrid, the html element IDs are a bit different, but I've
 accommodated for that with the version I have working with the
 suggest_widget.

 I'm looking for a way to debug this thing and see what is actually going
 on.  I can't say I'm a strong javascript'er but my understanding is that
 this code should end up somewhere on the 'view page source' html, and it
 isn't.  Would I be able to return it to the script and have it execute if I
 use the response.js variable?  Seems like it never gets executed.

 -Jim

 On Friday, November 16, 2012 3:19:40 PM UTC-6, Richard wrote:

 It may be related to smartgrid...

 Have you try with a straight sqlform??

 Richard


 On Fri, Nov 16, 2012 at 3:31 PM, Jim S j...@qlf.com wrote:

 Richard - I've been trying to get this working but am not having any
 luck.  I have the lazy_options_widget working with the first field being a
 suggest_widget, but am trying to implement with your suggestion above using
 a SELECT element as the first field, but it isn't working.  I'm using this
 in an edit for generated by a smartgrid and am using the following for the
 FIRSTFIELDNAME as you have it above.

 benefit_benefitProgramId

 This is the ID associated with the first field when I look at the HTML
 that is generated.  I think I'm following along with the javascript ok, but
 don't understand why my code isn't working.

 Any tips on what to look for?  Did you actually have this working in a
 sample?

 Any help would be appreciated.

 -Jim

 On Wednesday, August 29, 2012 9:25:07 AM UTC-5, Richard wrote:

 Here the code for use a regular drop down and avoid use of
 autocomplete plugin dependency.

 In controller :
 conditional_field_trigger_selected_event_js =
 '$(select[name=FIRSTFIELDNAME]).change(function() {var val =
 $(this).children(:selected).attr(value);$(this).trigger($(this).attr(id)
 + __selected, [val]);});'

 In view :
 script type=text/javascript
 {{=XML(conditional_field_trigger_selected_event_js)}}
 /script

 Richard

  On Wed, Aug 29, 2012 at 10:21 AM, Anthony abas...@gmail.com wrote:

 See
 http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
  for
 links to some other related recipes.

 Anthony


 On Wednesday, August 29, 2012 3:04:10 AM UTC-4, lyn2py wrote:

 Thank you Anthony and Richard, I have tried to use IS_IN_DB in the
 form of return IS_IN_DB(...) but it doesn't work.

 The reason why I am looking for this function is because I am trying
 to load the options or a second field, based on what is chosen in the 
 first
 field. Both are SELECTs.

 Like this example here:
 http://dev.s-cubism.com/plugin_lazy_options_widget
 but the first field is a select instead of autocomplete.

 I am unable to find a function that will return a SELECT field
 (based on the chosen rows) for the ajax success function.

 On Wednesday, August 29, 2012 12:50:13 AM UTC+8, Anthony wrote:

 Yes. By default, a reference field gets a validator like this:
 IS_IN_DB(db, db.sometable._id, db.sometable._format). However, the
 IS_IN_DB() validator can take a Set object as the first argument 
 instead of
 db, and the list will be based on the records defined by that Set. In 
 that
 case, you'll have to explicitly define the validator:

 requires=IS_IN_DB(db([your query]), db.sometable.id, db.sometable.
 _format)

 Note, when you define your own validator, you also lose the
 automatic represent attribute for the reference field, so you might 
 want
 to set your own:

  represent=db.sometable._format

 Anthony

 On Tuesday, August 28, 2012 12:28:10 PM UTC-4, lyn2py wrote:

 Hello experts,

 Generally, when we do a SQLFORM, the 'reference table' fields
 automatically gets *all* the available options for choosing as a 
 dropdown
 menu.

 However, I would like to get a filtered list instead of *all* of
 the items. Is there an available function I can 

Re: [web2py] Re: How to turn retrieved rows into a SELECT?

2012-11-16 Thread Jim S
Thanks Richard, didn't think of changing the background to help me 
diagnose.  Will work on it more this afternoon but pick it up again on 
Monday.  Have a good weekend!

-Jim

On Friday, November 16, 2012 3:44:16 PM UTC-6, Richard wrote:

 I have to go... Sorry...

 It surely a selector that not catch what it suppose to... 

 My form use formestyle=divs that maybe affect somehow...

 Richard

 On Fri, Nov 16, 2012 at 4:40 PM, Richard Vézina 
 ml.richa...@gmail.comjavascript:
  wrote:

 Jim,

 You can put the jQuery directly in html create/update form like this :
 script
 $(select[name=FIRSTFIELDNAME]).change(function() {
 var val = $(this).children(:selected).attr(value);
 $(this).trigger($(this).attr(id) + __selected, [val]);
 });
 /script

 To make sure you selector are good you can set a background color like 
 this :

 $(this).children(:selected).css('background-color','red');

 Richard
  

 On Fri, Nov 16, 2012 at 4:30 PM, Jim S j...@qlf.com javascript:wrote:

 Well, I can get it to work with smartgrid if I use a suggest_widget for 
 the first field.  But, I'm trying to make my second SELECT element reload 
 its options based on the option selected in the first SELECT element.  I 
 was trying to follow the JS that you posted earlier, but I can't get it to 
 trigger the reload of the second SELECT element.

 With the smartgrid, the html element IDs are a bit different, but I've 
 accommodated for that with the version I have working with the 
 suggest_widget.

 I'm looking for a way to debug this thing and see what is actually going 
 on.  I can't say I'm a strong javascript'er but my understanding is that 
 this code should end up somewhere on the 'view page source' html, and it 
 isn't.  Would I be able to return it to the script and have it execute if I 
 use the response.js variable?  Seems like it never gets executed.

 -Jim

 On Friday, November 16, 2012 3:19:40 PM UTC-6, Richard wrote:

 It may be related to smartgrid...

 Have you try with a straight sqlform??

 Richard


 On Fri, Nov 16, 2012 at 3:31 PM, Jim S j...@qlf.com wrote:

 Richard - I've been trying to get this working but am not having any 
 luck.  I have the lazy_options_widget working with the first field being 
 a 
 suggest_widget, but am trying to implement with your suggestion above 
 using 
 a SELECT element as the first field, but it isn't working.  I'm using 
 this 
 in an edit for generated by a smartgrid and am using the following for 
 the 
 FIRSTFIELDNAME as you have it above.

 benefit_benefitProgramId

 This is the ID associated with the first field when I look at the HTML 
 that is generated.  I think I'm following along with the javascript ok, 
 but 
 don't understand why my code isn't working. 

 Any tips on what to look for?  Did you actually have this working in a 
 sample?

 Any help would be appreciated.

 -Jim

 On Wednesday, August 29, 2012 9:25:07 AM UTC-5, Richard wrote:

 Here the code for use a regular drop down and avoid use of 
 autocomplete plugin dependency.

 In controller :
 conditional_field_trigger_selected_event_js = 
 '$(select[name=FIRSTFIELDNAME]).change(function() {var val = 
 $(this).children(:selected).attr(value);$(this).trigger($(this).attr(id)
  
 + __selected, [val]);});'

 In view :
 script type=text/javascript
 {{=XML(conditional_field_trigger_selected_event_js)}}
 /script

 Richard

  On Wed, Aug 29, 2012 at 10:21 AM, Anthony abas...@gmail.com wrote:

 See 
 http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
  for 
 links to some other related recipes.

 Anthony


 On Wednesday, August 29, 2012 3:04:10 AM UTC-4, lyn2py wrote:

 Thank you Anthony and Richard, I have tried to use IS_IN_DB in the 
 form of return IS_IN_DB(...) but it doesn't work.

 The reason why I am looking for this function is because I am 
 trying to load the options or a second field, based on what is chosen 
 in 
 the first field. Both are SELECTs.

 Like this example here:
 http://dev.s-cubism.com/plugin_lazy_options_widget
 but the first field is a select instead of autocomplete.

 I am unable to find a function that will return a SELECT field 
 (based on the chosen rows) for the ajax success function.

 On Wednesday, August 29, 2012 12:50:13 AM UTC+8, Anthony wrote:

 Yes. By default, a reference field gets a validator like this: 
 IS_IN_DB(db, db.sometable._id, db.sometable._format). However, the 
 IS_IN_DB() validator can take a Set object as the first argument 
 instead of 
 db, and the list will be based on the records defined by that Set. In 
 that 
 case, you'll have to explicitly define the validator:

 requires=IS_IN_DB(db([your query]), db.sometable.id, db.sometable.
 _format)

 Note, when you define your own validator, you also lose the 
 automatic represent attribute for the reference field, so you might 
 want 
 to set your own:

  represent=db.sometable._format

 Anthony

 On Tuesday, August 28, 2012 

Re: [web2py] Jquery function not triggered for fields in LOAD component

2012-11-16 Thread Richard Vézina
Will look at that.

Thanks Niphlod.

It is bizzard all my script work, but when I add this one they all stop
working, I thougth that it was because of web2py.js or bootstrap.js or
orther .js, but I don't think so now.

# Works fine
response.js = 'jQuery(document).ready(function(){
jQuery(.input_wrapper).has(.error).addClass(inputError);
jQuery(.w2p_fw).has(.error).addClass(control-group error);
jQuery(.w2p_fw).each(function(){
$(this).find(.error_wrapper).appendTo(this); }); });'
response.js += 'jQuery(document).ready(function(){
jQuery(textarea).elastic(); });'
response.js += '$(document).ready(function () {
$([rel=tooltip]).tooltip(); });'

# This one brake them all
response.js += 'jQuery(document).ready(function () { var date_format =
(typeof w2p_ajax_date_format != undefined) ? w2p_ajax_date_format :
%Y-%m-%d; jQuery(.icon-calendar).click(function() {
Calendar.setup({inputField:jQuery(this).parent().prev().focus(),
ifFormat:date_format, showsTime:false });
jQuery(this).parent().prev().trigger(onclick); }); });'


By the way, those little js are pretty cool for someone who wants to use
bootstrap features like icon-calendar with input-append add-on... They
are mostly workaround I found to make work things rapidly before I find a
better solution to use bootstrap features. To use them someone has to use
widget to modify the class of the input field and set required bootstrap
class.

Richard


On Fri, Nov 16, 2012 at 4:34 PM, Niphlod niph...@gmail.com wrote:

 if you have the default layout bootstrap.js is put at the end of the page.
 trying to call something relying on that on a fragment that is put before
 the last piece of the page is loaded will obviously not run.
 and again, LOAD() (when not called with ajax=False) is just a nice
 shortcut to $.ajax .
 response.js allows you to have something called on a response, but you may
 embed the script on the returned component to get it executed as soon as
 it loads.


 --





-- 





Re: [web2py] Jquery function not triggered for fields in LOAD component

2012-11-16 Thread Richard Vézina
The last problematic script use to work if I use it with normal form (not a
form in a component).

Richard

On Fri, Nov 16, 2012 at 4:53 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 Will look at that.

 Thanks Niphlod.

 It is bizzard all my script work, but when I add this one they all stop
 working, I thougth that it was because of web2py.js or bootstrap.js or
 orther .js, but I don't think so now.

 # Works fine
 response.js = 'jQuery(document).ready(function(){
 jQuery(.input_wrapper).has(.error).addClass(inputError);
 jQuery(.w2p_fw).has(.error).addClass(control-group error);
 jQuery(.w2p_fw).each(function(){
 $(this).find(.error_wrapper).appendTo(this); }); });'
 response.js += 'jQuery(document).ready(function(){
 jQuery(textarea).elastic(); });'
 response.js += '$(document).ready(function () {
 $([rel=tooltip]).tooltip(); });'

 # This one brake them all
 response.js += 'jQuery(document).ready(function () { var date_format =
 (typeof w2p_ajax_date_format != undefined) ? w2p_ajax_date_format :
 %Y-%m-%d; jQuery(.icon-calendar).click(function() {
 Calendar.setup({inputField:jQuery(this).parent().prev().focus(),
 ifFormat:date_format, showsTime:false });
 jQuery(this).parent().prev().trigger(onclick); }); });'


 By the way, those little js are pretty cool for someone who wants to use
 bootstrap features like icon-calendar with input-append add-on... They
 are mostly workaround I found to make work things rapidly before I find a
 better solution to use bootstrap features. To use them someone has to use
 widget to modify the class of the input field and set required bootstrap
 class.

 Richard


 On Fri, Nov 16, 2012 at 4:34 PM, Niphlod niph...@gmail.com wrote:

 if you have the default layout bootstrap.js is put at the end of the page.
 trying to call something relying on that on a fragment that is put before
 the last piece of the page is loaded will obviously not run.
 and again, LOAD() (when not called with ajax=False) is just a nice
 shortcut to $.ajax .
 response.js allows you to have something called on a response, but you
 may embed the script on the returned component to get it executed as soon
 as it loads.


 --







-- 





Re: [web2py] Re: How to turn retrieved rows into a SELECT?

2012-11-16 Thread Richard Vézina
You too!

Bye!

Richard

On Fri, Nov 16, 2012 at 4:47 PM, Jim S j...@qlf.com wrote:

 Thanks Richard, didn't think of changing the background to help me
 diagnose.  Will work on it more this afternoon but pick it up again on
 Monday.  Have a good weekend!

 -Jim

 On Friday, November 16, 2012 3:44:16 PM UTC-6, Richard wrote:

 I have to go... Sorry...

 It surely a selector that not catch what it suppose to...

 My form use formestyle=divs that maybe affect somehow...

 Richard

 On Fri, Nov 16, 2012 at 4:40 PM, Richard Vézina ml.richa...@gmail.comwrote:

 Jim,

 You can put the jQuery directly in html create/update form like this :
 script
 $(select[name=FIRSTFIELDNAME]).change(function() {
 var val = $(this).children(:selected).attr(value);
 $(this).trigger($(this).attr(id) + __selected, [val]);
 });
 /script

 To make sure you selector are good you can set a background color like
 this :

 $(this).children(:selected).css('background-color','red');

 Richard


 On Fri, Nov 16, 2012 at 4:30 PM, Jim S j...@qlf.com wrote:

 Well, I can get it to work with smartgrid if I use a suggest_widget for
 the first field.  But, I'm trying to make my second SELECT element reload
 its options based on the option selected in the first SELECT element.  I
 was trying to follow the JS that you posted earlier, but I can't get it to
 trigger the reload of the second SELECT element.

 With the smartgrid, the html element IDs are a bit different, but I've
 accommodated for that with the version I have working with the
 suggest_widget.

 I'm looking for a way to debug this thing and see what is actually
 going on.  I can't say I'm a strong javascript'er but my understanding is
 that this code should end up somewhere on the 'view page source' html, and
 it isn't.  Would I be able to return it to the script and have it execute
 if I use the response.js variable?  Seems like it never gets executed.

 -Jim

 On Friday, November 16, 2012 3:19:40 PM UTC-6, Richard wrote:

 It may be related to smartgrid...

 Have you try with a straight sqlform??

 Richard


 On Fri, Nov 16, 2012 at 3:31 PM, Jim S j...@qlf.com wrote:

 Richard - I've been trying to get this working but am not having any
 luck.  I have the lazy_options_widget working with the first field being 
 a
 suggest_widget, but am trying to implement with your suggestion above 
 using
 a SELECT element as the first field, but it isn't working.  I'm using 
 this
 in an edit for generated by a smartgrid and am using the following for 
 the
 FIRSTFIELDNAME as you have it above.

 benefit_benefitProgramId

 This is the ID associated with the first field when I look at the
 HTML that is generated.  I think I'm following along with the javascript
 ok, but don't understand why my code isn't working.

 Any tips on what to look for?  Did you actually have this working in
 a sample?

 Any help would be appreciated.

 -Jim

 On Wednesday, August 29, 2012 9:25:07 AM UTC-5, Richard wrote:

 Here the code for use a regular drop down and avoid use of
 autocomplete plugin dependency.

 In controller :
 conditional_field_trigger_selected_event_js =
 '$(select[name=FIRSTFIELDNAME]).change(function() {var val =
 $(this).children(:selected).attr(value);$(this).trigger($(this).attr(id)
 + __selected, [val]);});'

 In view :
 script type=text/javascript
 {{=XML(conditional_field_trigger_selected_event_js)}}
 /script

 Richard

  On Wed, Aug 29, 2012 at 10:21 AM, Anthony abas...@gmail.comwrote:

 See
 http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
  for
 links to some other related recipes.

 Anthony


 On Wednesday, August 29, 2012 3:04:10 AM UTC-4, lyn2py wrote:

 Thank you Anthony and Richard, I have tried to use IS_IN_DB in the
 form of return IS_IN_DB(...) but it doesn't work.

 The reason why I am looking for this function is because I am
 trying to load the options or a second field, based on what is chosen 
 in
 the first field. Both are SELECTs.

 Like this example here:
 http://dev.s-cubism.com/plugin_lazy_options_widget
 but the first field is a select instead of autocomplete.

 I am unable to find a function that will return a SELECT field
 (based on the chosen rows) for the ajax success function.

 On Wednesday, August 29, 2012 12:50:13 AM UTC+8, Anthony wrote:

 Yes. By default, a reference field gets a validator like this:
 IS_IN_DB(db, db.sometable._id, db.sometable._format). However, the
 IS_IN_DB() validator can take a Set object as the first argument 
 instead of
 db, and the list will be based on the records defined by that Set. 
 In that
 case, you'll have to explicitly define the validator:

 requires=IS_IN_DB(db([your query]), db.sometable.id, db.sometable
 ._format)

 Note, when you define your own validator, you also lose the
 automatic represent attribute for the reference field, so you 
 might want
 to set your own:

  represent=db.sometable._format

 Anthony

 On Tuesday, 

Re: [web2py] Re: How to turn retrieved rows into a SELECT?

2012-11-16 Thread Jim S
FYI - I got it working by putting the JS in layout.html within my   
$(document).ready(function() code.  But, now it is working ok for adding a 
new record, but doesn't display the value in the second SELECT on edit. 
 That one doesn't work with suggest_widget on the first field either.  Even 
if I get it working it seems too delicate.  I'm going to find another way 
to handle this one.

But, thanks for your JS help, I do appreciate it.

-Jim


On Friday, November 16, 2012 3:54:37 PM UTC-6, Richard wrote:

 You too!

 Bye!

 Richard

 On Fri, Nov 16, 2012 at 4:47 PM, Jim S j...@qlf.com javascript: wrote:

 Thanks Richard, didn't think of changing the background to help me 
 diagnose.  Will work on it more this afternoon but pick it up again on 
 Monday.  Have a good weekend!

 -Jim

 On Friday, November 16, 2012 3:44:16 PM UTC-6, Richard wrote:

 I have to go... Sorry...

 It surely a selector that not catch what it suppose to... 

 My form use formestyle=divs that maybe affect somehow...

 Richard

 On Fri, Nov 16, 2012 at 4:40 PM, Richard Vézina 
 ml.richa...@gmail.comwrote:

  Jim,

 You can put the jQuery directly in html create/update form like this :
 script
 $(select[name=FIRSTFIELDNAME]).change(function() {
 var val = $(this).children(:selected).attr(value);
 $(this).trigger($(this).attr(id) + __selected, [val]);
 });
 /script

 To make sure you selector are good you can set a background color like 
 this :

 $(this).children(:selected).css('background-color','red');

 Richard
  

 On Fri, Nov 16, 2012 at 4:30 PM, Jim S j...@qlf.com wrote:

 Well, I can get it to work with smartgrid if I use a suggest_widget 
 for the first field.  But, I'm trying to make my second SELECT element 
 reload its options based on the option selected in the first SELECT 
 element.  I was trying to follow the JS that you posted earlier, but I 
 can't get it to trigger the reload of the second SELECT element.

 With the smartgrid, the html element IDs are a bit different, but I've 
 accommodated for that with the version I have working with the 
 suggest_widget.

 I'm looking for a way to debug this thing and see what is actually 
 going on.  I can't say I'm a strong javascript'er but my understanding is 
 that this code should end up somewhere on the 'view page source' html, 
 and 
 it isn't.  Would I be able to return it to the script and have it execute 
 if I use the response.js variable?  Seems like it never gets executed.

 -Jim

 On Friday, November 16, 2012 3:19:40 PM UTC-6, Richard wrote:

 It may be related to smartgrid...

 Have you try with a straight sqlform??

 Richard


 On Fri, Nov 16, 2012 at 3:31 PM, Jim S j...@qlf.com wrote:

 Richard - I've been trying to get this working but am not having any 
 luck.  I have the lazy_options_widget working with the first field 
 being a 
 suggest_widget, but am trying to implement with your suggestion above 
 using 
 a SELECT element as the first field, but it isn't working.  I'm using 
 this 
 in an edit for generated by a smartgrid and am using the following for 
 the 
 FIRSTFIELDNAME as you have it above.

 benefit_benefitProgramId

 This is the ID associated with the first field when I look at the 
 HTML that is generated.  I think I'm following along with the 
 javascript 
 ok, but don't understand why my code isn't working. 

 Any tips on what to look for?  Did you actually have this working in 
 a sample?

 Any help would be appreciated.

 -Jim

 On Wednesday, August 29, 2012 9:25:07 AM UTC-5, Richard wrote:

 Here the code for use a regular drop down and avoid use of 
 autocomplete plugin dependency.

 In controller :
 conditional_field_trigger_selected_event_js = 
 '$(select[name=FIRSTFIELDNAME]).change(function() {var val = 
 $(this).children(:selected).attr(value);$(this).trigger($(this).attr(id)
  
 + __selected, [val]);});'

 In view :
 script type=text/javascript
 {{=XML(conditional_field_trigger_selected_event_js)}}
 /script

 Richard

  On Wed, Aug 29, 2012 at 10:21 AM, Anthony abas...@gmail.comwrote:

 See 
 http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
  for 
 links to some other related recipes.

 Anthony


 On Wednesday, August 29, 2012 3:04:10 AM UTC-4, lyn2py wrote:

 Thank you Anthony and Richard, I have tried to use IS_IN_DB in 
 the form of return IS_IN_DB(...) but it doesn't work.

 The reason why I am looking for this function is because I am 
 trying to load the options or a second field, based on what is 
 chosen in 
 the first field. Both are SELECTs.

 Like this example here:
 http://dev.s-cubism.com/plugin_lazy_options_widget
 but the first field is a select instead of autocomplete.

 I am unable to find a function that will return a SELECT field 
 (based on the chosen rows) for the ajax success function.

 On Wednesday, August 29, 2012 12:50:13 AM UTC+8, Anthony wrote:

 Yes. By default, a reference field gets a validator like this: 
 

Re: [web2py] Re: How to turn retrieved rows into a SELECT?

2012-11-16 Thread Jim S
FWIW, I just found why it didn't work earlier.  I was editing the wrong 
.html file.  Meat Head.  Blame it on Friday afternoon...

-Jim


On Friday, November 16, 2012 4:06:33 PM UTC-6, Jim S wrote:

 FYI - I got it working by putting the JS in layout.html within my   
 $(document).ready(function() code.  But, now it is working ok for adding a 
 new record, but doesn't display the value in the second SELECT on edit. 
  That one doesn't work with suggest_widget on the first field either.  Even 
 if I get it working it seems too delicate.  I'm going to find another way 
 to handle this one.

 But, thanks for your JS help, I do appreciate it.

 -Jim


 On Friday, November 16, 2012 3:54:37 PM UTC-6, Richard wrote:

 You too!

 Bye!

 Richard

 On Fri, Nov 16, 2012 at 4:47 PM, Jim S j...@qlf.com wrote:

 Thanks Richard, didn't think of changing the background to help me 
 diagnose.  Will work on it more this afternoon but pick it up again on 
 Monday.  Have a good weekend!

 -Jim

 On Friday, November 16, 2012 3:44:16 PM UTC-6, Richard wrote:

 I have to go... Sorry...

 It surely a selector that not catch what it suppose to... 

 My form use formestyle=divs that maybe affect somehow...

 Richard

 On Fri, Nov 16, 2012 at 4:40 PM, Richard Vézina 
 ml.richa...@gmail.comwrote:

  Jim,

 You can put the jQuery directly in html create/update form like this :
 script
 $(select[name=FIRSTFIELDNAME]).change(function() {
 var val = $(this).children(:selected).attr(value);
 $(this).trigger($(this).attr(id) + __selected, [val]);
 });
 /script

 To make sure you selector are good you can set a background color like 
 this :

 $(this).children(:selected).css('background-color','red');

 Richard
  

 On Fri, Nov 16, 2012 at 4:30 PM, Jim S j...@qlf.com wrote:

 Well, I can get it to work with smartgrid if I use a suggest_widget 
 for the first field.  But, I'm trying to make my second SELECT element 
 reload its options based on the option selected in the first SELECT 
 element.  I was trying to follow the JS that you posted earlier, but I 
 can't get it to trigger the reload of the second SELECT element.

 With the smartgrid, the html element IDs are a bit different, but 
 I've accommodated for that with the version I have working with the 
 suggest_widget.

 I'm looking for a way to debug this thing and see what is actually 
 going on.  I can't say I'm a strong javascript'er but my understanding 
 is 
 that this code should end up somewhere on the 'view page source' html, 
 and 
 it isn't.  Would I be able to return it to the script and have it 
 execute 
 if I use the response.js variable?  Seems like it never gets executed.

 -Jim

 On Friday, November 16, 2012 3:19:40 PM UTC-6, Richard wrote:

 It may be related to smartgrid...

 Have you try with a straight sqlform??

 Richard


 On Fri, Nov 16, 2012 at 3:31 PM, Jim S j...@qlf.com wrote:

 Richard - I've been trying to get this working but am not having 
 any luck.  I have the lazy_options_widget working with the first field 
 being a suggest_widget, but am trying to implement with your 
 suggestion 
 above using a SELECT element as the first field, but it isn't working. 
  I'm 
 using this in an edit for generated by a smartgrid and am using the 
 following for the FIRSTFIELDNAME as you have it above.

 benefit_benefitProgramId

 This is the ID associated with the first field when I look at the 
 HTML that is generated.  I think I'm following along with the 
 javascript 
 ok, but don't understand why my code isn't working. 

 Any tips on what to look for?  Did you actually have this working 
 in a sample?

 Any help would be appreciated.

 -Jim

 On Wednesday, August 29, 2012 9:25:07 AM UTC-5, Richard wrote:

 Here the code for use a regular drop down and avoid use of 
 autocomplete plugin dependency.

 In controller :
 conditional_field_trigger_selected_event_js = 
 '$(select[name=FIRSTFIELDNAME]).change(function() {var val = 
 $(this).children(:selected).attr(value);$(this).trigger($(this).attr(id)
  
 + __selected, [val]);});'

 In view :
 script type=text/javascript
 {{=XML(conditional_field_trigger_selected_event_js)}}
 /script

 Richard

  On Wed, Aug 29, 2012 at 10:21 AM, Anthony abas...@gmail.comwrote:

 See 
 http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
  for 
 links to some other related recipes.

 Anthony


 On Wednesday, August 29, 2012 3:04:10 AM UTC-4, lyn2py wrote:

 Thank you Anthony and Richard, I have tried to use IS_IN_DB in 
 the form of return IS_IN_DB(...) but it doesn't work.

 The reason why I am looking for this function is because I am 
 trying to load the options or a second field, based on what is 
 chosen in 
 the first field. Both are SELECTs.

 Like this example here:
 http://dev.s-cubism.com/plugin_lazy_options_widget
 but the first field is a select instead of autocomplete.

 I am unable to find a function that will return a SELECT 

[web2py] Re: Hash-flooding DoS attack in Ruby

2012-11-16 Thread Massimo Di Pierro
This was discussed on this list and it is my understanding it has been 
fixed at the Pyhton level:
http://www.h-online.com/security/news/item/Python-updates-for-hash-collision-DoS-problems-Update-1519585.html

On Friday, 16 November 2012 05:34:26 UTC-6, Ralo Tannahill wrote:

 Hash-flooding DoS attack reported for the Hash function (Ruby)
 http://www.ruby-lang.org/en/news/2012/11/09/ruby19-hashdos-cve-2012-5371

 Just for information, not a Dos for web2py.
 In web2py can we limit the size of the parsed data? just in case there was 
 a DoS like this one

 Kind regards




-- 





Re: [web2py] Jquery function not triggered for fields in LOAD component

2012-11-16 Thread Niphlod
have you inspected where it goes on error ? My bet would be on the calendar 
setup ... seems that you're trying to bind a click on an element to trigger 
the parent to show the calendar. But the calendar is supposedly yet 
present on the input field. If so, why don't you just use live ?
e.g.

jQuery('.icon-calendar').on('click', function() 
{$(this).parent().prev().trigger(onclick);})

PS: you are not using bootstrap features embedded in bootstrap.js, just 
some classes to add icon classes around.

-- 





[web2py] Re: error export represet

2012-11-16 Thread Massimo Di Pierro
some where you have a Field(...,represent=something)

and something takes two arguments, not one. Can you show us the model?

On Friday, 16 November 2012 08:51:32 UTC-6, www.diazluis.com wrote:

 {{
 import cStringIO
 stream=cStringIO.StringIO()
 estudiante_arancel_rows.export_to_csv_file(ofile=stream, represent=True)
 response.headers['Content-Type']='application/vnd.ms-excel'
 response.headers['Content-Disposition'] =  attachment; filename=%s % 
 'data_sga.csv'
 response.write(stream.getvalue(), escape=False)
 }}


 Traceback (most recent call last):
   File /home/diazluis2007/web2py/gluon/restricted.py, line 212, in 
 restricted
 exec ccode in environment
   File 
 /home/diazluis2007/web2py/applications/sga/views/estudiante_arancel/exportar_excel.html,
  
 line 3, in module
 stream=cStringIO.StringIO()
   File /home/diazluis2007/web2py/gluon/dal.py, line 9249, in 
 export_to_csv_file
 value = field.represent(value)
 TypeError: lambda() takes exactly 2 arguments (1 given)

  web2py: 2.2.1


-- 





[web2py] Re: manual file upload fails when storing file in database - field is NULL

2012-11-16 Thread Massimo Di Pierro
Yes:

att_id = db2.attachments.insert(
attachment = db2.attachments.attachment.store(...),
filename = fname,
Description = 
r.attachments.attachment_brief_description,
)
needs

att_id = db2.attachments.insert(
attachment = db2.attachments.attachment.store(...),
payload = stream.read(),
filename = fname,
Description = 
r.attachments.attachment_brief_description,
)

On Friday, 16 November 2012 09:18:47 UTC-6, Cliff Kachinske wrote:

 The title describes the problem.

 Any suggestions as to what I might do?  Would it be simpler if I just 
 uploaded to a directory?  I'm archiving for auditability, so I suppose 
 there would still be a way to get at earlier versions of uploaded files.

 Here is the model:

 db.define_table('attachments',
 Field('attachment', 'upload', uploadfield='payload'),
 Field('filename', length=512),
 Field('Description', 'text'),
 Field('payload', 'blob'),
 migrate=init_migrate,
 )
 Common fields are auth.signature and a field called tenant_link, which 
 is how I implemented the request_tenant functionality before Massimo 
 announced it.

 Here is the controller code:
for r in rows:
 ...
 myfile = mypath + r.attachments.file_name + '.' + 
 r.attachments.file_ext
 try:
 stream = open(myfile, 'rb')
 except IOError:
 no_finds.append(DIV('unable to find {}'.format(myfile)))
 continue
 else:
 ok.append(DIV('found {}.{}, aka {}'.format(
 r.attachments.file_name, r.attachments.file_ext, fname
 )))
 att_id = db2.attachments.insert(
 attachment = db2.attachments.attachment.store(
 stream, '{}.{}'.format(
 r.attachments.file_name, r.attachments.file_ext
 )
 ),
 filename = fname,
 Description = 
 r.attachments.attachment_brief_description,
 )

 The insert is successful except the payload field is never populated. 
  Here is a snippet  of the results from this postgres query, SELECT id, 
 filename, octet_length(payload) from attachments;

   9 | apt-get-output.txt   
|10772
   10 | a_h_hits.txt   
  |24164
   11 | a_h_hits.txt   
  |24164
   12 | greg-free-bizcard   
 |   215288
   27 | Tank Thickness ML.doc   
 | 
   28 | Tank Thickness ML.doc(1)   
  | 
   29 | A short short file 
  | 
   30 | hello.txt   
 |

 Records 9, 10 and 11 were uploaded while testing the interface. Records 12 
 and up were created using the above script. 



-- 





[web2py] Re: How do I include text from a file in static in my email templates?

2012-11-16 Thread Massimo Di Pierro
style type=text/css 
{{=open(os.path.join(request.folder,'static','css/web2py.css')).read()}}
{{=open(os.path.join(request.folder,'static','css/style.css')).read()}}
/style 

On Friday, 16 November 2012 13:47:10 UTC-6, encompass wrote:

 I want to include the text from static in my email templates.  I 
 currently have this, but it doesn't work: 
 style type=text/css 
 {{=LOAD(url=URL('static', 'css/web2py.css', scheme='http'),ajax=False)}} 
 {{=LOAD(url=URL('static', 'css/style.css', scheme='http'),ajax=False)}} 
 /style 
 But this doesn't work as I can't use js in email messages. 
 BR, 
 Jason Brower 



-- 





[web2py] Re: Web2Py and MS Access

2012-11-16 Thread Simon Carr
There is no way I will get away with that at work. However Oracle is 
available so I might see if I can get a business case together for them to 
set me up with a schema.

Again many thanks.

On Friday, 16 November 2012 21:08:49 UTC, Tim Richardson wrote:

 Humour me back ... download SQL Server express edition and the 
 accompanying SQL Server Management Studio (Express edition) and have a look 
 at it. It runs well on Windows 7  XP desktops. People could also recommend 
 postgres, but for getting up and running quickly, and for its very friendly 
 management tools, SQL Server could be a great fit. It has the best 
 graphical query editor ever seen  
 Of course, if you are supporting multiple users with a network approach, 
 then there must be a file server, so you'd need to get it installed on the 
 file server or sneakily use another always-on computer as the server. 
 It's a bit of mucking around, but once you win the argument with your IT 
 people and get control over SQL Server, or at least one database on it, 
 you'll be deploying web2py apps faster than you can blink. And you won't 
 have to waste a second testing it. 




-- 





[web2py] Re: Very simple issue: redirect on login - auth.settings.login_next

2012-11-16 Thread peter
I have already issued a bug report. for
auth.navbar(referrer_actions=None)
 
Peter

On Friday, 16 November 2012 18:03:12 UTC, Anthony wrote:

 How does someone arrive at your login page? Is it via the Login link 
 generated by the auth.navbar()?

 Anthony

 On Friday, November 16, 2012 10:42:48 AM UTC-5, Rob_McC wrote:

 Thanks !

 I spend some more time wrestling with this, and expanding my knowledge of 
 this feature of web2py, which I enjoy doing.

 *GOOD NEWS*, I finally got it to work, on a simple web2py app. - just by 
 adding  2 lines in the right place.
 (copy of working code below)

 Now, I'm not sure if a bug exists, I only know that if I add
 auth.navbar(referrer_actions=None)
 The behavior I want will not work  (ie redirect to user/profile page, 
 after  successful login).

 Anthony, if it looks like a bug to you, I would be happy to submit a bug, 
 and do whatever testing that would be helpful to 
 this excellent community of web2py users.

 Sure appreciate the help.
 Rob


 # - - - - - - - - - - - - - - - - - - 
 # RAM START : it would seem, TWO of  these lines are required in 
 # app name: AuthRedirect  - just a NEW application, with no modication
 # web2py Version 2.2.1 (2012-10-21 16:57:04) stable
 #
 # CODE BELOW placed in : 
 # /models/db.py - located BELOW the ## configure auth policy lines
 #
 # it is curious, that when I go to login page, 
 # the URL page reads: 
 # 
 http://127.0.0.1:8000/AuthRedirect/default/user/login?_next=/AuthRedirect/default/index
 # which sure looks like it is the DEFAULT behavior, ie redierected to 
 HOME page
 # yet, when I press Login button, I'm directed to 
 # http://127.0.0.1:8000/AuthRedirect/default/user/profile
 # which is EXACTLY what I wanted to happen.
 #
 # THIS does not work here  auth.navbar(referrer_actions=None)
 # it seems I only need these two lines for login_next to work.

 auth.next = None
 auth.settings.login_next = URL('user/profile') 

 # RAM END - - - - - - - - - - - - - - 





-- 





[web2py] Session files not always created

2012-11-16 Thread villas
Using latest trunk with Apache/Linux.

I'm having log in problems,  especially with IE 9.

I've noticed that in the browser I get the cookie set:

 NAME session_id_myapp VALUE 
75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b DOMAIN mydomain.com PATH 
/ EXPIRES At the end of the Session
So that's good.  However,  it doesn't always create session file 
75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b

If I cannot find a session file with that name,  it seems that I cannot log 
in.  

When I restart the browser,  sometimes the session file and cookie are 
created OK.  Then I can log in too.  With Firefox it is more reliable, but 
again, it doesn't always work.

Why is the session file not always created?  Does anyone know what the 
problem is?

Is it related to this change?
http://code.google.com/p/web2py/source/detail?r=80a653289fb58322521d7c4b8f1082098a8f2618

Regards,
David

-- 





Re: [web2py] Re: Migrating with postgres

2012-11-16 Thread Richard Baron Penman
That is the process I first tried, based on info in the web2py book.
The problem for this was when web2py was regenerating the tables it
raised an error that auth_user already exists.


On Sat, Nov 17, 2012 at 3:55 AM, pbreit pbreitenb...@gmail.com wrote:
 I think you might want to try:
 1. copy all of the files in databases somewhere safe
 2. delete all the files in databases
 3. in the DB connection string, include (..., migrate=True,
 fake_migrate_all=True)
 4. Access /appadmin to trigger a migration
 5. Revert DB connection string to (..., migrate_enable=False,
 fake_migrate_all=False)

 I believe this is safe but if you can try it out on a backup or test db,
 might be prudent.


 On Wednesday, November 14, 2012 7:24:39 PM UTC-8, Richard Penman wrote:

 Having trouble migrating with postgres.

 With fake_migrate=True the the .table files are created.

 If migrate=True then error: auth_user already exists.

 Tried all combinations of these and deleting and removing .table files,
 but no joy.

 Is web2py meant to support modify the tables with postgres? If so which
 combination of options would you recommend?
 With sqlite this works fine.

 --




-- 





[web2py] Re: Session files not always created

2012-11-16 Thread Adi
hmm... i got the latest trunk, and also started having a problem with 
session... but still investigating.  

On Friday, November 16, 2012 5:50:02 PM UTC-5, villas wrote:

 Using latest trunk with Apache/Linux.

 I'm having log in problems,  especially with IE 9.

 I've noticed that in the browser I get the cookie set:

  NAME session_id_myapp VALUE 
 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b DOMAIN mydomain.com PATH 
 / EXPIRES At the end of the Session
 So that's good.  However,  it doesn't always create session file 
 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b

 If I cannot find a session file with that name,  it seems that I cannot 
 log in.  

 When I restart the browser,  sometimes the session file and cookie are 
 created OK.  Then I can log in too.  With Firefox it is more reliable, but 
 again, it doesn't always work.

 Why is the session file not always created?  Does anyone know what the 
 problem is?

 Is it related to this change?

 http://code.google.com/p/web2py/source/detail?r=80a653289fb58322521d7c4b8f1082098a8f2618

 Regards,
 David


-- 





[web2py] Data does not make it to the db table when NyroModal is used once sqlform submitted !! please help !

2012-11-16 Thread Don_X
Hello everyone .. it has been a while  ! ... I am back .. alive .. and 
kicking at it again...

OK ! .. I have a problem with data that does not make it to the table when 
the related form is shown to the user through a Modal ( in this case it is 
the NyroModal that I chose to use for this exercise ! ) 
and the form to be displayed is using the solidform plugin scheme !

Here is some code 
my model is a table ( pretty straight forward with 19 fields and some of 
them are set as writable=readable=false  for ultarior purposes) :
db.define_table('soc_league',
 Field ( ),
 F )
 )

in my controller I have :
from plugin_solidform import SOLIDFORM

def createleague(): 
   request_fields = request.vars.fields or 'default'  
   fields = [['league_name','Name_description'],
 ['league_adrss','league_city'],
 ['league_prov','league_postalcode'],
 ['league_country','league_tel'],
 'league_website',
 'league_pic',
 'Affiliated_with',
 'league_jurisdiction']
   form = SOLIDFORM(db.soc_league,fields=fields)  
   if form.accepts(request.vars, session):
   session.flash = 'submitted %s' % form.vars
   redirect(URL('createleague'))  
   style = STYLE(input[type=text], textarea {width:100%; max-height: 
70px;}
 .w2p_fw {padding-right: 40px; max-width:200px;}
 .w2p_fl {background: #eee;})  
   return dict(form=DIV(style, form))

I created a simple view for it :
createleague.html in which there is only one line :
{{=form}}

then .. on another view, .. like .. test1.html ...  I wanted to test the 
popup modal form ... and the submission of the form through  with 
 NyroModal like this : 
link rel=stylesheet href={{=URL('static','css/nyroModal.css')}} 
type=text/css media=screen /
script src={{=URL('static','js/jquery.nyroModal.custom.js')}} 
type=text/javascript/script 

div
a href={{=URL('default','createleague.html')}}  class=nyroModal 
input name=submit type=submit class=button radius 
style=font-style:normal;font-size:14px;  value={{=T('CREATE LEAGUE')}} 
raquo //a
/div

script type=text/javascript
$(function() {
  $('.nyroModal').nyroModal();
});
/script


the form shows-up just the way I wanted it  .. no problem there .. ... but 
when I filled it out  ..all the data entered does not make it to the table 
!! ??? ...  
can anyone help me with this .. please .. thank you

Don

-- 





[web2py] Re: Very simple issue: redirect on login - auth.settings.login_next

2012-11-16 Thread Rob_McC
Hey Anthony:

Q
How does someone arrive at your login page? Is it via the Login link 
generated by the auth.navbar()?

A:

I have tested a few ways... here are my findings

*Method 1*
- From home page, 
   
http://127.0.0.1:8000/AuthRedirect/default/user/login?_next=/AuthRedirect/default/index
  Click on Login menu, then Login (ie via the Login link generated by the 
auth.navbar() )
  This takes me to the Login screen with this URL at top:
  
http://127.0.0.1:8000/AuthRedirect/default/user/login?_next=/AuthRedirect/default/index
 


*Method 2*
- Say I'm on the Login page, and press login again, 
 (via the Login link generated by the auth.navbar())

  This takes me to the Login screen with the URL at top:
   http://127.0.0.1:8000/AuthRedirect/default/user/login

*Method 3*
- if I come from CNN.com, and Paste the login URL, it behaves as Method 2 
above.

---
but the good news, is all of these will take me to the PROFILE page, which 
is what I want.


--
I hope that answers your questions... the only thing that was throwing me 
off, is when I saw the  URL:
   
http://127.0.0.1:8000/AuthRedirect/default/user/login?_next=/AuthRedirect/default/index
 

I didn't expect to be redirected to PROFILE page.


Thanks..

Rob


-- 





[web2py] Re: Session files not always created

2012-11-16 Thread Adi
tested the same code in Version 2.2.1 (2012-10-21 16:57:04) stable, and 
session works as expected, but not in trunk. 

simplified version of what i'm doing:
def a():
   products=db(db.products1).select()
   session.category_products_keys = products.as_dict().keys()
   print session.category_products_keys # all results displayed properly

def b():
   print session.category_products_keys # no results

a()
b()










On Friday, November 16, 2012 5:50:02 PM UTC-5, villas wrote:

 Using latest trunk with Apache/Linux.

 I'm having log in problems,  especially with IE 9.

 I've noticed that in the browser I get the cookie set:

  NAME session_id_myapp VALUE 
 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b DOMAIN mydomain.com PATH 
 / EXPIRES At the end of the Session
 So that's good.  However,  it doesn't always create session file 
 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b

 If I cannot find a session file with that name,  it seems that I cannot 
 log in.  

 When I restart the browser,  sometimes the session file and cookie are 
 created OK.  Then I can log in too.  With Firefox it is more reliable, but 
 again, it doesn't always work.

 Why is the session file not always created?  Does anyone know what the 
 problem is?

 Is it related to this change?

 http://code.google.com/p/web2py/source/detail?r=80a653289fb58322521d7c4b8f1082098a8f2618

 Regards,
 David


-- 





[web2py] Re: Session files not always created

2012-11-16 Thread Adi
correction... rearranged the code a bit, and all works as expected on my 
side... 

On Friday, November 16, 2012 8:43:24 PM UTC-5, Adi wrote:

 tested the same code in Version 2.2.1 (2012-10-21 16:57:04) stable, and 
 session works as expected, but not in trunk. 

 simplified version of what i'm doing:
 def a():
products=db(db.products1).select()
session.category_products_keys = products.as_dict().keys()
print session.category_products_keys # all results displayed properly

 def b():
print session.category_products_keys # no results

 a()
 b()










 On Friday, November 16, 2012 5:50:02 PM UTC-5, villas wrote:

 Using latest trunk with Apache/Linux.

 I'm having log in problems,  especially with IE 9.

 I've noticed that in the browser I get the cookie set:

  NAME session_id_myapp VALUE 
 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b DOMAIN mydomain.com PATH 
 / EXPIRES At the end of the Session
 So that's good.  However,  it doesn't always create session file 
 75.141.38.104-8a5232dc-03d5-4312-bc65-2157590a973b

 If I cannot find a session file with that name,  it seems that I cannot 
 log in.  

 When I restart the browser,  sometimes the session file and cookie are 
 created OK.  Then I can log in too.  With Firefox it is more reliable, but 
 again, it doesn't always work.

 Why is the session file not always created?  Does anyone know what the 
 problem is?

 Is it related to this change?

 http://code.google.com/p/web2py/source/detail?r=80a653289fb58322521d7c4b8f1082098a8f2618

 Regards,
 David



-- 





Re: [web2py] Re: wxpython app using web2py username and password

2012-11-16 Thread dlypka
I intend to create some sample code fragments.
I will try to post something by Monday.

On Thursday, November 15, 2012 9:16:09 PM UTC-6, Jim S wrote:

 I would be interested in learning more. do you have any samples you could 
 share?
 On Nov 15, 2012 8:52 PM, dlypka dly...@gmail.com javascript: wrote:

 I recently devised some changes to globals.py and main.py to allow a 
 non-cookies client to log into web2py and keep the same
 session record between requests, just as a browser does. In my case the 
 client is a PhoneGap app and I hit web2py through
 HTTP. I store the web2py session record id on the client in HTML 5 local 
 storage, so that the client can sent it along with
 each request to tell web2py what session to reconnect to.  A similar 
 approach would probably work from a Windows App.

 On Thursday, November 15, 2012 4:34:22 PM UTC-6, Jim S wrote:

 My main concern is that with this being a desktop app that I don't want 
 to have to keep the latest versions of those files on the client machines.

 I switched my desktop authorization to read the Windows username and 
 then match it to a username in the auth_user table and rely on the Windows 
 authentication to ensure that user is logged in properly.  I validate that 
 they are on the proper domain and they are logged in with an id in the 
 table.

 Now I don't need to worry about keep those files current on multiple 
 clients.

 -Jim

 On Thursday, November 15, 2012 2:01:12 PM UTC-6, Niphlod wrote:

 ehm validators.py (if not all, just crypt and lazycrypt, plus 
 Validator original class), utils.py and pbkdf2 is all you need.

 On Thursday, November 15, 2012 6:32:03 PM UTC+1, Jim S wrote:

 Sounds like there is no easy way to do it.  I looked through that code 
 and it seems pretty involved.  I was hoping to do this without needing 
 the 
 web2py libs and such.

 -Jim

 On Thursday, November 15, 2012 11:14:09 AM UTC-6, Niphlod wrote:

 https://github.com/web2py/**web2py/blob/master/gluon/**tools.py#L1776https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1776
 that basically calls the validators attached by default to a password 
 field 
 https://github.com/web2py/**web2py/blob/master/gluon/**tools.py#L1479https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1479
 i.e. you just have to import the validator CRYPT and check with that 
 passing the correct parameters
 https://github.com/web2py/**web2py/blob/master/gluon/**
 validators.py#L2659https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2659

 PS: CRYPT was easier to follow before the introduction of the pdfbk2 
 algo, but it's quite straightforward if you are willing to cut off 
 backward-compatibility
  (that required lazycrypt https://github.com/web2py/**
 web2py/blob/master/gluon/**validators.py#L2581https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2581
 )

  -- 
  
  
  



-- 





[web2py] Re: How do I include text from a file in static in my email templates?

2012-11-16 Thread encompass
Never thought about doing it that way.
Better to use the python way in this case I suppose. :)
BR,
Jason

On Saturday, November 17, 2012 12:22:52 AM UTC+2, Massimo Di Pierro wrote:

 style type=text/css 
 {{=open(os.path.join(request.folder,'static','css/web2py.css')).read()}}
 {{=open(os.path.join(request.folder,'static','css/style.css')).read()}}
 /style 

 On Friday, 16 November 2012 13:47:10 UTC-6, encompass wrote:

 I want to include the text from static in my email templates.  I 
 currently have this, but it doesn't work: 
 style type=text/css 
 {{=LOAD(url=URL('static', 'css/web2py.css', scheme='http'),ajax=False)}} 
 {{=LOAD(url=URL('static', 'css/style.css', scheme='http'),ajax=False)}} 
 /style 
 But this doesn't work as I can't use js in email messages. 
 BR, 
 Jason Brower 



-- 





[web2py] How do I handle more than 32768 characters in the database?

2012-11-16 Thread Jason Brower
I was including the css I use in my emails and it's telling me it is 
more than 32768 Chars.


'message':'enter from 0 to 32768 characters'

Any way I can get around this issue?  I suppose I could try to shorten 
my css but I wish there was a better way. (Compressing the CSS would be 
cool too.)

BR,
Jason Brower

--