[web2py] Re: deploying web2py on IIS

2011-09-07 Thread Web2Py Freak
why cant i use SQLite ??


Re: [web2py] appadmin and db.Table definition

2011-09-07 Thread Manuele

On 05/09/2011 21:21, pbreit wrote:

Is there some reason your table definitions depart so significantly from what 
is shown in the docs?

what do you mean?


[web2py] Module Object has no attribute SSL - running from trunk in windows - No SSL?

2011-09-07 Thread António Ramos
hello i was trying to run web2by from trunk in windows using ssl port

python.exe c:\web2pymercurial\web2py -i 10.0.0.100 -p 443 -c cert.cert -k
cert.key -N

and got the error
Module Object has no attribute SSL

what is missing?


[web2py] Re: contrib module for cache stored in redis

2011-09-07 Thread Niphlod
I think to have it covered

Is it the "natural" behaviuor to have class istantiated for every call
to @cache ?

In this way it's needed a "hack" to reuse the connection storing the
connection object in @cache.ram



[web2py] Re: Using a lambda to set a default

2011-09-07 Thread Ray (a.k.a. Iceberg)
On Sep 7, 3:00 am, Lennon  wrote:
> I'm try to use a lambda to set a default value based on a value in
> another table.  Here is my model:
>
> db.define_table('trip_instance', timestamp, sos_table,
>     Field('trip_type_id',  db.trip_type, label='Trip Type',
> widget=trip_select_widget, requires = IS_IN_DB(db, 'trip_type.id', '%
> (name)s'), represent=lambda id:db.trip_type(id)['name']),
>     Field('total_slots', 'integer', default=lambda r:
> db.trip_type(r.trip_type_id)['total_slots']),
>
> Locally this causes an error that says:
>
> TypeError: () takes exactly 1 argument (0 given)
>
> And on my server (Linode) there is no error but when I try and create
> a new trip instance with sqlform the total slots field is pre-
> populated with this:
>
>  at 0x7f27684b7140>
>
> My lambda looks almost identical to the one that works fine for
> represent in the trip_type_id field except I'm using the table instead
> of the field.  Is that what I'm doing wrong?


Looks like the default parameter does not want a lambda. Try to give
it a computed value instead.

Regards,
Ray


Re: [web2py] Re: Using a lambda to set a default

2011-09-07 Thread Michele Comitini
In the controller:

db.trip_instance.trip_type.default=

mic


2011/9/7 Ray (a.k.a. Iceberg) :
> On Sep 7, 3:00 am, Lennon  wrote:
>> I'm try to use a lambda to set a default value based on a value in
>> another table.  Here is my model:
>>
>> db.define_table('trip_instance', timestamp, sos_table,
>>     Field('trip_type_id',  db.trip_type, label='Trip Type',
>> widget=trip_select_widget, requires = IS_IN_DB(db, 'trip_type.id', '%
>> (name)s'), represent=lambda id:db.trip_type(id)['name']),
>>     Field('total_slots', 'integer', default=lambda r:
>> db.trip_type(r.trip_type_id)['total_slots']),
>>
>> Locally this causes an error that says:
>>
>> TypeError: () takes exactly 1 argument (0 given)
>>
>> And on my server (Linode) there is no error but when I try and create
>> a new trip instance with sqlform the total slots field is pre-
>> populated with this:
>>
>>  at 0x7f27684b7140>
>>
>> My lambda looks almost identical to the one that works fine for
>> represent in the trip_type_id field except I'm using the table instead
>> of the field.  Is that what I'm doing wrong?
>
>
> Looks like the default parameter does not want a lambda. Try to give
> it a computed value instead.
>
> Regards,
> Ray


Re: [web2py] Re: short but useful facebook api info

2011-09-07 Thread Michele Comitini
Nice!

mic

2011/9/7 Massimo Di Pierro :
> Please send me a patch. Make sure it includes is own license (MIT, BSD
> or LGPL).
>
> On Sep 6, 6:07 pm, Bruno Rocha  wrote:
>> There is no dependency, I just put fbconsole.py in my /modules and did
>> something like this:
>>
>>     import fbconsole
>>     fbconsole.APP_ID = CLIENT_ID # comes from facebook auth, (Michelle's
>> code)
>>     fbconsole.SERVER_PORT = 8000
>>     fbconsole.REDIRECT_URI = 'http://localhost:%s/tutor'%
>> fbconsole.SERVER_PORT
>>     fbconsole.ACCESS_TOKEN = session.token['access_token'] # I am already
>> using facebook for auth, no need to Auth again.
>>     fbconsole.LOCAL_FILE = '%s_fb_access_token' % auth.user_id
>>     fbconsole.AUTH_SCOPE =
>> ['publish_stream,create_event,user_events,user_photos']
>>     photo = fbconsole.graph_post("/me/photos", {"message":"My Photo",
>> "source":open("/home/rochacbruno/myphoto.png")})
>>
>> I think it is a good idea to have it in contrib!


Re: [web2py] Re: blog post on web2py + db2

2011-09-07 Thread António Ramos
ProgrammingError: ('42000', '[42000] [IBM][Controlador ODBC do iSeries
Access][DB2 UDB]SQL0551 - Not authorized to object AUTH_USER in MYLIB type
*FILE. (-551) (SQLExecDirectW)')



2011/9/7 Omi Chiba 

> >How about using auth with as400 users. Is it possible?
> I'm not sure about it since I'm still new for web2py but your problem
> should be related to the permission just like your error says.
>
> My library is like...
>
> Object secured by authorization list  . . . . . . . . . . . .
> *NONE
>
> Object
> UserGroup
> Authority
> *PUBLIC
> *CHANGE
> QSECOFR
> *ALL
>
> and my user has...
> Special authority  . . . . . . . SPCAUT *ALLOBJ
>
> Maybe create new library and connect with the most high authority user
> might help.
>
>
>
>
> On Sep 6, 4:49 pm, António Ramos  wrote:
> > Ok, seems to get someting now.
> >
> > I have to change in AS400 the permissions to allow my username to create
> a
> > table
> >
> > ProgrammingError: ('42000', '[42000] [IBM][Controlador ODBC do iSeries
> > Access][DB2 UDB]SQL0551 - Not authorized to object  in *N type
> *USRPRF.
> > (-551) (SQLExecDirectW)')
> >
> > How about using auth with as400 users. Is it possible?
> >
> > Thank you
> >
> > Em 6 de setembro de 2011 22:07, António Ramos  >escreveu:
> >
> >
> >
> >
> >
> >
> >
> > > I tried the DAL Example and i could not connect to my AS400
> > > does the DAL only works with db2 on windows or linux?
> >
> > > i have my db2 in a OS400 machine
> >
> > > Thank you
> >
> > > António
> >
> > > Em 6 de setembro de 2011 21:56, António Ramos  >escreveu:
> >
> > > Great
> > >> i tested the example from the python shell and i connected to my
> company
> > >> AS400 with success.
> >
> > >> FANTASTIC
> >
> > >> Tomorrow i will kick the ass of the RPG guy.
> >
> > >> :)
> >
> > >> 2011/9/6 Massimo Di Pierro 
> >
> > >>>
> http://ochiba77.blogspot.com/2011/09/how-to-connect-db2-with-python-p...


[web2py] Re: Date Picker Widget

2011-09-07 Thread annet

> Very nice style annet!

Thanks.

> I think we should make the headers gray and replace calendar.css in welcome
> app

Good idea. I didn't restyle the time-picker part though just the date-
picker, so that probably needs some attention?


Kind regards,

Annet


[web2py] fluxflex cron question

2011-09-07 Thread ion_hdd
in crontab file I have this:
35 19 * * 1-5 root *default/mmail

in default controller
def mmail():
mail.send('x...@gmail.com','message','subject')

on my own machine cron seems to work (it send me an email), but same
app installed on fluxflex does not ..

can anyone give me a suggestion, please ?


Re: [web2py] Re: testing scheduler in windows

2011-09-07 Thread Martín Mulone
http://code.google.com/p/web2py/issues/detail?id=411

2011/9/5 Brian M 

> OK, I've got the scheduler reliably (I think) working now under Linux - I
> just changed my patch mentioned above a bit to make it so that WEB2PY_PATH
> would work even if you didn't launch from the same folder as web2py is in.
>
> At line 61, replace:
>
>
> if 'WEB2PY_PATH' in os.environ:
> sys.path.append(os.environ['WEB2PY_PATH'])
>
>
> with:
>
>
> if 'WEB2PY_PATH' in os.environ:
> sys.path.append(os.environ['WEB2PY_PATH'])
> else:
> os.environ['WEB2PY_PATH'] = os.getcwd()
>
> Unfortunately, this doesn't seem to do it for Windows, will have to
> experiment a bit more there.
>
> ~Brian
>



-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: Iterate through form.vars

2011-09-07 Thread Anthony
form.vars (as well as request.vars) is an instance of the Storage class, 
which inherits from dict 
(see http://web2py.com/book/default/chapter/04#request for some details 
about Storage objects). So, you can use regular Python dict methods on 
form.vars. For example, to get a list of the values of the variables in 
form.vars, just do:

form.vars.values()

Note, however, that Python dictionaries do not preserve order, so the order 
of the values yielded by the above line may not be as expected. If you want 
to know the order, you can get the variable names associated with the values 
(in the same order) with:

form.vars.keys()

To specify the order yourself, you could do something like:

[form.vars[var] for var in ('x0','x1','x2')]

Also, note that form.vars will also include values for the hidden fields 
(i.e., _formname and _formkey), which you may or may not want.

Anthony

On Tuesday, September 6, 2011 11:48:29 PM UTC-4, Noel Villamor wrote:
>
> Code: 
> if form.accepts(request.vars, session): 
> arr = ['a','b','c'] 
> for i in range(3): 
> arr[i] = form.vars.x 
>
> Desired: 
> In the for loop, I wanted to have 
> arr[0] = form.vars.x0 
> arr[1] = form.vars.x1 
> arr[2] = form.vars.x2 
>
> As you can see, I am not  yet a pythonista. 
>
> :) 
>
> Thanks! 
>


[web2py] Web2py Book typo? Database-Validators: IS_EMPTY_OR

2011-09-07 Thread juanduke
Hi!
Reading the validators section, it says:

IS_NULL_OR
Deprecated, an alias for IS_EMPTY_OR described below.

IS_EMPTY_OR
Sometimes you need to allow empty values on a field along with other
requirements. For example a field may be a date but it can also be
empty. The IS_EMPTY_OR validator allows this:

requires = IS_NULL_OR(IS_DATE())


I think the last sentence must be:
requires = IS_EMPTY_OR(IS_DATE())

Or please tell me if I'm wrong.

Bye.


PS: Sorry for my bad english


[web2py] billing app

2011-09-07 Thread niknok
is there any billing component among the web2py appliances that can be
used as a base or a billing appliance?

Just wondering if there's any such code out there before starting from
scratch.

Thanks.


Re: [web2py] Web2py Book typo? Database-Validators: IS_EMPTY_OR

2011-09-07 Thread Bruno Rocha
Both will work.

http://zerp.ly/rochacbruno
Em 07/09/2011 10:36, "juanduke"  escreveu:
> Hi!
> Reading the validators section, it says:
>
> IS_NULL_OR
> Deprecated, an alias for IS_EMPTY_OR described below.
>
> IS_EMPTY_OR
> Sometimes you need to allow empty values on a field along with other
> requirements. For example a field may be a date but it can also be
> empty. The IS_EMPTY_OR validator allows this:
>
> requires = IS_NULL_OR(IS_DATE())
>
>
> I think the last sentence must be:
> requires = IS_EMPTY_OR(IS_DATE())
>
> Or please tell me if I'm wrong.
>
> Bye.
>
>
> PS: Sorry for my bad english


[web2py] select box size (height) : how to change in View

2011-09-07 Thread Vineet
I wish to render a select box with size="3" sothat it will display 3
items (instead of default size 1)

I specified it in View as under--



opt1
opt2
opt3

etc.



But its height(size) remains unaltered (1).
It displays a scrollbar though.

The same code, if tested in a standalone html file, works correct
(i.e. the size is altered to 3)

Why my code in "View" is not able to override the default size of 1?

Thanks,

Vineet


[web2py] Re: Iterate through form.vars

2011-09-07 Thread DenesL

arr = [ form.vars['x%s'%x] for x in range(3) ]

On Sep 6, 11:48 pm, Noel Villamor  wrote:
> Code:
> if form.accepts(request.vars, session):
>     arr = ['a','b','c']
>     for i in range(3):
>         arr[i] = form.vars.x
>
> Desired:
> In the for loop, I wanted to have
>         arr[0] = form.vars.x0
>         arr[1] = form.vars.x1
>         arr[2] = form.vars.x2
>
> As you can see, I am not  yet a pythonista.
>
> :)
>
> Thanks!


[web2py] Re: How to customise the reset password function

2011-09-07 Thread Dave H
Thanks for your replies - I've decided to roll my own in the end, as I
also need to scope the user lookup inside an account. It's not too
complicated to adapt the code in the Auth module as it's quite
straightforward.

Cheers
Dave

On Sep 3, 9:04 pm, Anthony  wrote:
> Maybe something like this:
>
> def user():
>     form=auth()
>     if request.args(0)=='request_reset_password' and form.errors:
>         session.flash='If your user ID was found, we have sent you reset
> details by email.'
>         redirect(URL('user',args='login'))
>     return dict(form=form)
>
> Anthony
>
>
>
>
>
>
>
> On Saturday, September 3, 2011 12:55:56 PM UTC-4, Dave H wrote:
>
> > Hi, I'd like to customise the "reset password" part of the
> > authentication module. At the moment, it tells you if you have entered
> > an incorrect email address, and doesn't in fact try to send the email
> > unless the user is found in the database. I'd like to change it so
> > that if a valid email address is entered, it says something like
>
> > "if your user was found, we have sent you reset details by email"
>
> > so that someone couldn't discover if an email address was valid or not
> > just by using the password reset function.
>
> > I've tried to hook into the code using this:
>
> > auth.settings.reset_password_onvalidation = my_onvalidation_function
> > auth.settings.reset_password_onaccept = my_onaccept_function
>
> > but it seems to do the email check before then. (the second line above
> > actually gives an error and says the key doesn't exist).
>
> > Is there any way to do this without subclassing the auth module?
>
> > Any suggestions are greatly appreciated!
>
> > Many thanks
> > Dave


[web2py] Re: blog post on web2py + db2

2011-09-07 Thread DenesL

If I remember correctly from my tests a couple of years ago, the AS400
for some reason wants to journal the files (tables) created thru ODBC.
No journal is required when reading from existing tables.

Looking at the files in my WEB2PY library I see a data area specifying
the name of the journal:

Data area . . . . . . . :   QDFTJRN
  Library . . . . . . . : WEB2PY
Type  . . . . . . . . . :   *CHAR
Length  . . . . . . . . :   100
Text  . . . . . . . . . :

   Value
Offset  *...+1+2+3+4+5
0  'WEB2PYQDFTJRN   *FILE '
   50  '  '

and the journal and journal receiver files:

Object  Type  Library
QDFTJRNRCV  *JRNRCV   WEB2PY
QSQJRNRCV   *JRNRCV   WEB2PY
QDFTJRN *JRN  WEB2PY
QSQJRN  *JRN  WEB2PY
QDFTJRN *DTAARA   WEB2PY

Obviously your user has to be authorized to use these objects.
Hope it helps,
Denes.


On Sep 7, 7:07 am, António Ramos  wrote:
> ProgrammingError: ('42000', '[42000] [IBM][Controlador ODBC do iSeries
> Access][DB2 UDB]SQL0551 - Not authorized to object AUTH_USER in MYLIB type
> *FILE. (-551) (SQLExecDirectW)')
>
> 2011/9/7 Omi Chiba 
>
>
>
>
>
>
>
> > >How about using auth with as400 users. Is it possible?
> > I'm not sure about it since I'm still new for web2py but your problem
> > should be related to the permission just like your error says.
>
> > My library is like...
>
> > Object secured by authorization list  . . . . . . . . . . . .
> > *NONE
>
> > Object
> > User        Group
> > Authority
> > *PUBLIC
> > *CHANGE
> > QSECOFR
> > *ALL
>
> > and my user has...
> > Special authority  . . . . . . . SPCAUT         *ALLOBJ
>
> > Maybe create new library and connect with the most high authority user
> > might help.
>
> > On Sep 6, 4:49 pm, António Ramos  wrote:
> > > Ok, seems to get someting now.
>
> > > I have to change in AS400 the permissions to allow my username to create
> > a
> > > table
>
> > > ProgrammingError: ('42000', '[42000] [IBM][Controlador ODBC do iSeries
> > > Access][DB2 UDB]SQL0551 - Not authorized to object  in *N type
> > *USRPRF.
> > > (-551) (SQLExecDirectW)')
>
> > > How about using auth with as400 users. Is it possible?
>
> > > Thank you
>
> > > Em 6 de setembro de 2011 22:07, António Ramos  > >escreveu:
>
> > > > I tried the DAL Example and i could not connect to my AS400
> > > > does the DAL only works with db2 on windows or linux?
>
> > > > i have my db2 in a OS400 machine
>
> > > > Thank you
>
> > > > António
>
> > > > Em 6 de setembro de 2011 21:56, António Ramos  > >escreveu:
>
> > > > Great
> > > >> i tested the example from the python shell and i connected to my
> > company
> > > >> AS400 with success.
>
> > > >> FANTASTIC
>
> > > >> Tomorrow i will kick the ass of the RPG guy.
>
> > > >> :)
>
> > > >> 2011/9/6 Massimo Di Pierro 
>
> >http://ochiba77.blogspot.com/2011/09/how-to-connect-db2-with-python-p...


[web2py] Re: Web2py Book typo? Database-Validators: IS_EMPTY_OR

2011-09-07 Thread juanduke
Thanks for the reply Bruno.
I tryied both ways, and works perfectly.

But, if the book says that IS_NULL_OR is deprecated, don't you think,
it will be better to show a "un-deprecated" example? IMHO will be less
confusing.

bye.

PS: sorry again for my bad english.

On 7 sep, 10:43, Bruno Rocha  wrote:
> Both will work.
>
> http://zerp.ly/rochacbruno
> Em 07/09/2011 10:36, "juanduke"  escreveu:
>
>
>
>
>
>
>
> > Hi!
> > Reading the validators section, it says:
>
> > IS_NULL_OR
> > Deprecated, an alias for IS_EMPTY_OR described below.
>
> > IS_EMPTY_OR
> > Sometimes you need to allow empty values on a field along with other
> > requirements. For example a field may be a date but it can also be
> > empty. The IS_EMPTY_OR validator allows this:
>
> > requires = IS_NULL_OR(IS_DATE())
>
> > I think the last sentence must be:
> > requires = IS_EMPTY_OR(IS_DATE())
>
> > Or please tell me if I'm wrong.
>
> > Bye.
>
> > PS: Sorry for my bad english


[web2py] Re: How to customise the reset password function

2011-09-07 Thread Anthony
I'm not sure if this is relevant to what you're doing, but you might also 
check out web2py's new multi-tenant functionality, which might enable you to 
use Auth but maintain separate accounts for different groups of 
users: https://groups.google.com/d/topic/web2py/NrvxeWQJvH0/discussion

Anthony

On Wednesday, September 7, 2011 9:59:13 AM UTC-4, Dave H wrote:
>
> Thanks for your replies - I've decided to roll my own in the end, as I 
> also need to scope the user lookup inside an account. It's not too 
> complicated to adapt the code in the Auth module as it's quite 
> straightforward. 
>
> Cheers 
> Dave 
>
> On Sep 3, 9:04 pm, Anthony  wrote: 
> > Maybe something like this: 
> > 
> > def user(): 
> > form=auth() 
> > if request.args(0)=='request_reset_password' and form.errors: 
> > session.flash='If your user ID was found, we have sent you reset 
> > details by email.' 
> > redirect(URL('user',args='login')) 
> > return dict(form=form) 
> > 
> > Anthony 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Saturday, September 3, 2011 12:55:56 PM UTC-4, Dave H wrote: 
> > 
> > > Hi, I'd like to customise the "reset password" part of the 
> > > authentication module. At the moment, it tells you if you have entered 
> > > an incorrect email address, and doesn't in fact try to send the email 
> > > unless the user is found in the database. I'd like to change it so 
> > > that if a valid email address is entered, it says something like 
> > 
> > > "if your user was found, we have sent you reset details by email" 
> > 
> > > so that someone couldn't discover if an email address was valid or not 
> > > just by using the password reset function. 
> > 
> > > I've tried to hook into the code using this: 
> > 
> > > auth.settings.reset_password_onvalidation = my_onvalidation_function 
> > > auth.settings.reset_password_onaccept = my_onaccept_function 
> > 
> > > but it seems to do the email check before then. (the second line above 
> > > actually gives an error and says the key doesn't exist). 
> > 
> > > Is there any way to do this without subclassing the auth module? 
> > 
> > > Any suggestions are greatly appreciated! 
> > 
> > > Many thanks 
> > > Dave



[web2py] searching the group posts

2011-09-07 Thread DenesL

The new Google groups search seems to work much better than the old
groups one.
It is at the top of the page of https://groups.google.com/forum/#!forum/web2py


Re: [web2py] Re: blog post on web2py + db2

2011-09-07 Thread Jim Steil
No journaling is required if you change the commit mode to Commit 
Immediate (*NONE) as shown in the blog post.


-Jim

On 9/7/2011 9:06 AM, DenesL wrote:

If I remember correctly from my tests a couple of years ago, the AS400
for some reason wants to journal the files (tables) created thru ODBC.
No journal is required when reading from existing tables.

Looking at the files in my WEB2PY library I see a data area specifying
the name of the journal:

Data area . . . . . . . :   QDFTJRN
   Library . . . . . . . : WEB2PY
Type  . . . . . . . . . :   *CHAR
Length  . . . . . . . . :   100
Text  . . . . . . . . . :

Value
Offset  *...+1+2+3+4+5
 0  'WEB2PYQDFTJRN   *FILE '
50  '  '

and the journal and journal receiver files:

Object  Type  Library
QDFTJRNRCV  *JRNRCV   WEB2PY
QSQJRNRCV   *JRNRCV   WEB2PY
QDFTJRN *JRN  WEB2PY
QSQJRN  *JRN  WEB2PY
QDFTJRN *DTAARA   WEB2PY

Obviously your user has to be authorized to use these objects.
Hope it helps,
Denes.


On Sep 7, 7:07 am, António Ramos  wrote:

ProgrammingError: ('42000', '[42000] [IBM][Controlador ODBC do iSeries
Access][DB2 UDB]SQL0551 - Not authorized to object AUTH_USER in MYLIB type
*FILE. (-551) (SQLExecDirectW)')

2011/9/7 Omi Chiba








How about using auth with as400 users. Is it possible?

I'm not sure about it since I'm still new for web2py but your problem
should be related to the permission just like your error says.
My library is like...
Object secured by authorization list  . . . . . . . . . . . .
*NONE
Object
UserGroup
Authority
*PUBLIC
*CHANGE
QSECOFR
*ALL
and my user has...
Special authority  . . . . . . . SPCAUT *ALLOBJ
Maybe create new library and connect with the most high authority user
might help.
On Sep 6, 4:49 pm, António Ramos  wrote:

Ok, seems to get someting now.
I have to change in AS400 the permissions to allow my username to create

a

table
ProgrammingError: ('42000', '[42000] [IBM][Controlador ODBC do iSeries
Access][DB2 UDB]SQL0551 - Not authorized to object  in *N type

*USRPRF.

(-551) (SQLExecDirectW)')
How about using auth with as400 users. Is it possible?
Thank you
Em 6 de setembro de 2011 22:07, António Ramos
I tried the DAL Example and i could not connect to my AS400
does the DAL only works with db2 on windows or linux?
i have my db2 in a OS400 machine
Thank you
António
Em 6 de setembro de 2011 21:56, António Ramos
escreveu:

Great

i tested the example from the python shell and i connected to my

company

AS400 with success.
FANTASTIC
Tomorrow i will kick the ass of the RPG guy.
:)
2011/9/6 Massimo Di Pierro

http://ochiba77.blogspot.com/2011/09/how-to-connect-db2-with-python-p...


Re: [web2py] Re: Date Picker Widget

2011-09-07 Thread Richard Vézina
I had made it style too a wild ago, so I share :

.calendar{
z-index: 99;
position: relative;
display: none;
border-right: 1px solid #65605e;
border-left: 1px solid #65605e;
border-bottom: 1px solid #65605e;
font-size: 11px;
color: #008aff;
cursor: default;
background: #fafaed;
font-family: Arial, Helvetica,sans-serif;
}

.calendar .button {
text-align: center;
padding: 4px;
border-right: 1px solid #e7e9de;
border-left: 1px solid #e7e9de;
border-bottom: 1px solid #65605e;
border-top: 1px solid #65605e;

}

.calendar .nav{background:transparent}

.calendar thead .title{
font-weight:bold;
padding:4px;
border:0;
text-align:center;
text-transform: uppercase;
color: #65605e;
border-right: 1px solid #e7e9de;
border-left: 1px solid #e7e9de;
border-bottom: 1px solid #65605e;
border-top: 1px solid #65605e;
}

.calendar thead .name {
border:0;
padding:4px;
text-align:center;
background-color:#65605e;
color:#abc63b;
text-transform: uppercase;
border-right: 1px solid #65605e;
border-left: 1px solid #65605e;
border-bottom: 1px solid #fafaed;
border-top: 1px solid #65605e;
}

.calendar thead .weekend{
color:#52a103;
}


.calendar thead .hilite {
border-top:0;
text-decoration: underline;
color: #008aff;
border-right: 1px solid #e7e9de;
border-left: 1px solid #e7e9de;
border-bottom: 1px solid #65605e;
border-top: 1px solid #65605e;
}

.calendar thead .name.hilite {
border-top:0;
text-decoration: underline;
color: #b2f03d;
border-left: 1px solid #65605e;
border-right: 1px solid #65605e;
border-bottom: 1px solid #fafaed;
}

.calendar thead .active{
color: #b2f03d;

}

.calendar tbody .day {
width:2em;
text-align:right;
padding:4px;
font-weight: bold;
color: #65605e;
border: 1px solid #fafaed;
}

.calendar tbody .day.othermonth{
color:#aaa;
}

.calendar tbody .day.othermonth.oweekend {
color:#faa;
}

.calendar table thead .wn{
padding:4px;
color:#fff;
background-color: #65605e;
border-left: 1px solid #65605e;
border-right: 1px solid #65605e;
}

.calendar table .wn{
padding:4px;
background-color:#e7e9de;
border: 1px solid #e7e9de;
}

.calendar tbody .rowhilite td {
background:#e4e0d8;
border-right: 1px solid #e4e0d8;
border-left: 1px solid #e4e0d8;
border-bottom: 1px solid #fafaed;
border-top: 1px solid #fafaed;
}

.calendar tbody .rowhilite td.wn{
background:#d4d0c8;
border: 1px solid #d4d0c8;
}

.calendar tbody td.hilite{
padding:4px;
background-color: #65605e;
color: #fff;
text-decoration: underline;
border: 1px solid #65605e;
}

.calendar tbody td.active {
padding:4px;
border:0;
background-color: #78c0fe;
color: #65605e;
text-decoration: underline;
border: 1px solid #78c0fe;
}

.calendar tbody td.selected{
font-weight:bold;
border:0;
padding:4px;
color: #858c56;
text-decoration: underline;
 }

.calendar tbody td.weekend {
color: #83897b;
}

.calendar tbody td.today {
font-weight:bold;
color: #008aff;
}


.calendar tbody .disabled {
color:#999;
}

.calendar tbody .emptycell {
visibility:hidden;
}

.calendar tbody .emptyrow{
display:none;
border-right: 1px solid #fafaed;
}



.calendar tfoot .ttip{
background: url('bouton.png');
padding:4px;

background-color:#8ba130;
text-align:right;
color: #30312c;
border-right: 1px solid #8ba130;
}
.calendar tfoot .hilite{
padding: 4px;
border:0;
}
.calendar tfoot .active{
padding: 4px;
border:0;
}

.calendar
.combo{position:absolute;display:none;width:4em;top:0;left:0;cursor:default;border-top:1px
solid #fff;border-right:1px solid #000;border-bottom:1px solid
#000;border-left:1px solid #fff;background:#e3;padding:1px;z-index:100;}
.calendar .combo .label,.calendar .combo
.label-IEfix{text-align:center;padding:1px;}
.calendar .combo .label-IEfix{width:4em;}
.calendar .combo .active{background:#c4c0b8;padding:0;border-top:1px solid
#000;border-right:1px solid #fff;border-bottom:1px solid
#fff;border-left:1px solid #000;}
.calendar .combo .hilite{background:#048;color:#fea;}

.calendar td.time{border-top:1px solid #000;padding:1px
0;text-align:center;background-color:#f4f0e8;}
.calendar td.time .hour,.calendar td.time .minute,.calendar td.time
.ampm{padding:0 3px 0 4px;border:1px solid
#889;font-weight:bold;background-color:#fff;}
.calendar td.time .ampm{text-align:center;}
.calendar td.time .colon{padding:0 2px 0 3px;font-weight:bold;}
.calendar td.time
span.hilite{border-color:#000;background-color:#766;color:#fff;}
.calendar td.time
span.active{border-color:#f00;background-color:#000;color:#0f0;}

#CP_hourcont{z-index:99;padding:0;position:absolute;border:1px dashed
#666;background-color:#eee;display:none;}
#CP_minutecont{z-index:99;background-color:#ddd;pad

[web2py] Re: Using a lambda to set a default

2011-09-07 Thread Lennon
When using a computed field and SQLForm I was able to get the computed
field to show up in the form by specifying the fields for the SQLForm,
but whenever I submitted a value for the computed field, it always got
overwritten by the computed Lambda.  I only want the value "computed"
when the field is left blank.

I realize I could do this on the controller level after form.accepts
but due to other application restraints I'd rather do it on the model
level if possible.

On Sep 7, 6:10 am, "Ray (a.k.a. Iceberg)"  wrote:
> On Sep 7, 3:00 am, Lennon  wrote:
>
>
>
>
>
>
>
>
>
> > I'm try to use alambdato set adefaultvaluebased on avaluein
> > another table.  Here is my model:
>
> > db.define_table('trip_instance', timestamp, sos_table,
> >     Field('trip_type_id',  db.trip_type, label='Trip Type',
> > widget=trip_select_widget, requires = IS_IN_DB(db, 'trip_type.id', '%
> > (name)s'), represent=lambdaid:db.trip_type(id)['name']),
> >     Field('total_slots', 'integer',default=lambdar:
> > db.trip_type(r.trip_type_id)['total_slots']),
>
> > Locally this causes an error that says:
>
> > TypeError: () takes exactly 1 argument (0 given)
>
> > And on my server (Linode) there is no error but when I try and create
> > a new trip instance with sqlform the total slots field is pre-
> > populated with this:
>
> >  at 0x7f27684b7140>
>
> > Mylambdalooks almost identical to the one that works fine for
> > represent in the trip_type_id field except I'musingthe table instead
> > of the field.  Is that what I'm doing wrong?
>
> Looks like thedefaultparameter does not want alambda. Try to give
> it a computedvalueinstead.
>
> Regards,
> Ray


Re: [web2py] Re: Date Picker Widget

2011-09-07 Thread Richard Vézina
Finally, I think I had correct the little glitch...

There is maybe some line that are not use full, like the one that include a
.png file...

Richard

On Wed, Sep 7, 2011 at 10:51 AM, Richard Vézina  wrote:

> I had made it style too a wild ago, so I share :
>
> .calendar{
> z-index: 99;
> position: relative;
> display: none;
> border-right: 1px solid #65605e;
> border-left: 1px solid #65605e;
> border-bottom: 1px solid #65605e;
> font-size: 11px;
> color: #008aff;
> cursor: default;
> background: #fafaed;
> font-family: Arial, Helvetica,sans-serif;
> }
>
> .calendar .button {
> text-align: center;
> padding: 4px;
> border-right: 1px solid #e7e9de;
> border-left: 1px solid #e7e9de;
> border-bottom: 1px solid #65605e;
> border-top: 1px solid #65605e;
>
> }
>
> .calendar .nav{background:transparent}
>
> .calendar thead .title{
> font-weight:bold;
> padding:4px;
> border:0;
> text-align:center;
> text-transform: uppercase;
> color: #65605e;
> border-right: 1px solid #e7e9de;
> border-left: 1px solid #e7e9de;
> border-bottom: 1px solid #65605e;
> border-top: 1px solid #65605e;
> }
>
> .calendar thead .name {
> border:0;
> padding:4px;
> text-align:center;
> background-color:#65605e;
> color:#abc63b;
> text-transform: uppercase;
> border-right: 1px solid #65605e;
> border-left: 1px solid #65605e;
> border-bottom: 1px solid #fafaed;
> border-top: 1px solid #65605e;
> }
>
> .calendar thead .weekend{
> color:#52a103;
> }
>
>
> .calendar thead .hilite {
> border-top:0;
> text-decoration: underline;
> color: #008aff;
> border-right: 1px solid #e7e9de;
> border-left: 1px solid #e7e9de;
> border-bottom: 1px solid #65605e;
> border-top: 1px solid #65605e;
> }
>
> .calendar thead .name.hilite {
> border-top:0;
> text-decoration: underline;
> color: #b2f03d;
> border-left: 1px solid #65605e;
> border-right: 1px solid #65605e;
> border-bottom: 1px solid #fafaed;
> }
>
> .calendar thead .active{
> color: #b2f03d;
>
> }
>
> .calendar tbody .day {
> width:2em;
> text-align:right;
> padding:4px;
> font-weight: bold;
> color: #65605e;
> border: 1px solid #fafaed;
> }
>
> .calendar tbody .day.othermonth{
> color:#aaa;
> }
>
> .calendar tbody .day.othermonth.oweekend {
> color:#faa;
> }
>
> .calendar table thead .wn{
> padding:4px;
> color:#fff;
> background-color: #65605e;
> border-left: 1px solid #65605e;
> border-right: 1px solid #65605e;
> }
>
> .calendar table .wn{
> padding:4px;
> background-color:#e7e9de;
> border: 1px solid #e7e9de;
> }
>
> .calendar tbody .rowhilite td {
> background:#e4e0d8;
> border-right: 1px solid #e4e0d8;
> border-left: 1px solid #e4e0d8;
> border-bottom: 1px solid #fafaed;
> border-top: 1px solid #fafaed;
> }
>
> .calendar tbody .rowhilite td.wn{
> background:#d4d0c8;
> border: 1px solid #d4d0c8;
> }
>
> .calendar tbody td.hilite{
> padding:4px;
> background-color: #65605e;
> color: #fff;
> text-decoration: underline;
> border: 1px solid #65605e;
> }
>
> .calendar tbody td.active {
> padding:4px;
> border:0;
> background-color: #78c0fe;
> color: #65605e;
> text-decoration: underline;
> border: 1px solid #78c0fe;
> }
>
> .calendar tbody td.selected{
> font-weight:bold;
> border:0;
> padding:4px;
> color: #858c56;
> text-decoration: underline;
>  }
>
> .calendar tbody td.weekend {
> color: #83897b;
> }
>
> .calendar tbody td.today {
> font-weight:bold;
> color: #008aff;
> }
>
>
> .calendar tbody .disabled {
> color:#999;
> }
>
> .calendar tbody .emptycell {
> visibility:hidden;
> }
>
> .calendar tbody .emptyrow{
> display:none;
> border-right: 1px solid #fafaed;
> }
>
>
>
> .calendar tfoot .ttip{
> background: url('bouton.png');
> padding:4px;
>
> background-color:#8ba130;
> text-align:right;
> color: #30312c;
> border-right: 1px solid #8ba130;
> }
> .calendar tfoot .hilite{
> padding: 4px;
> border:0;
> }
> .calendar tfoot .active{
> padding: 4px;
> border:0;
> }
>
> .calendar
> .combo{position:absolute;display:none;width:4em;top:0;left:0;cursor:default;border-top:1px
> solid #fff;border-right:1px solid #000;border-bottom:1px solid
> #000;border-left:1px solid #fff;background:#e3;padding:1px;z-index:100;}
> .calendar .combo .label,.calendar .combo
> .label-IEfix{text-align:center;padding:1px;}
> .calendar .combo .label-IEfix{width:4em;}
> .calendar .combo .active{background:#c4c0b8;padding:0;border-top:1px solid
> #000;border-right:1px solid #fff;border-bottom:1px solid
> #fff;border-left:1px solid #000;}
> .calendar .combo .hilite{background:#048;color:#fea;}
>
> .calendar td.time{border-top:1px solid #000;padding:1px
> 0;text-align:center;background-color:#f4f0e8;}
> 

[web2py] Cron Jobs with Linode or Web2py?

2011-09-07 Thread Lennon
I'm hosting my web2py application with Apache on a Linode server and I
need to schedule some tasks.  They are simple email sending tasks with
minimal db querying but could eventually be sending hundreds of emails
at a time in case that makes a difference.

Seemingly I could either do this through the web2py cron or using the
Linode cron.

Does anybody have any reason on why I should choose one over the
other?  Do I even have this choice?

Thanks for any light you can shed on this.


[web2py] Re: Web2py Book typo? Database-Validators: IS_EMPTY_OR

2011-09-07 Thread villas
You are right,  it is really a typo but I see it has already been corrected 
in the online version of the book.  

http://web2py.com/book/default/chapter/07#Validators

The online version has had many corrections and additions since the printed 
book was published a year ago,  and it is therefore more accurate and 
reliable.


[web2py] SQLFORM.factory and Submit value

2011-09-07 Thread Massimiliano
Hi all,

I've a form generated by SQLFORM.factory

How do I change the Submit value to have a more explicative sentence?

Is there a way?

Thank you
-- 
Massimiliano


[web2py] Re: SQLFORM.factory and Submit value

2011-09-07 Thread Massimiliano
I've found the way :-)

form = SQLFORM.factory(
Field(...),
table_name=...,
submit_button='Your value'
)

Thank you

On Wed, Sep 7, 2011 at 5:16 PM, Massimiliano  wrote:

> Hi all,
>
> I've a form generated by SQLFORM.factory
>
> How do I change the Submit value to have a more explicative sentence?
>
> Is there a way?
>
> Thank you
> --
> Massimiliano
>



-- 
Massimiliano


[web2py] Re: Web2py Book typo? Database-Validators: IS_EMPTY_OR

2011-09-07 Thread juanduke
Hi, Villas:

When I report the typo, I was reading the online version of the book.
Also, I'm still reading the typo, (recently refreshed page), maybe
something is caching, I'll retry later.

Bye.

On 7 sep, 12:10, villas  wrote:
> You are right,  it is really a typo but I see it has already been corrected
> in the online version of the book.  
>
> http://web2py.com/book/default/chapter/07#Validators
>
> The online version has had many corrections and additions since the printed
> book was published a year ago,  and it is therefore more accurate and
> reliable.


[web2py] Re: Using a lambda to set a default

2011-09-07 Thread Anthony
On Wednesday, September 7, 2011 10:55:22 AM UTC-4, Lennon wrote:
>
> When using a computed field and SQLForm I was able to get the computed 
> field to show up in the form by specifying the fields for the SQLForm, 
> but whenever I submitted a value for the computed field, it always got 
> overwritten by the computed Lambda.  I only want the value "computed" 
> when the field is left blank.
>

Hmm, I seem to observe the opposite -- when I force a computed field to be 
displayed in a SQLFORM and then leave the input blank, the field is _not_ 
computed, and the blank is entered in the database. I think this is because 
the form still submits an (empty) value for the field, so the DAL ignores 
the compute attribute for the field (compute is only used if the field is 
not included in the insert/update at all).

Can you show some code?

Anthony 


Re: [web2py] Re: Date Picker Widget

2011-09-07 Thread Richard Vézina
I just make it better and grayed it :

.calendar{
z-index: 99;
position: relative;
display: none;
border-right: 1px solid #808080;
border-left: 1px solid #808080;
border-bottom: 1px solid #808080;
font-size: 11px;
color: #9A9A9A;
cursor: default;
background: #fafaed;
font-family: Arial, Helvetica,sans-serif;
}

.calendar .button {
text-align: center;
padding: 4px;
border-right: 1px solid #e7e9de;
border-left: 1px solid #e7e9de;
border-bottom: 1px solid #808080;
border-top: 1px solid #808080;

}

.calendar .nav{background:transparent}

.calendar thead .title{
font-weight:bold;
/*padding:4px;*/
border:0;
text-align:center;
text-transform: uppercase;
color: #808080;
border-right: 1px solid #e7e9de;
border-left: 1px solid #e7e9de;
border-bottom: 1px solid #808080;
border-top: 1px solid #808080;
}

.calendar thead .name {
border:0;
/*padding:4px;*/
text-align:center;
background-color:#656565;
color:#A6A6A6;
text-transform: uppercase;
border-right: 1px solid #656565;
border-left: 1px solid #656565;
border-bottom: 1px solid #fafaed;
border-top: 1px solid #656565;
}

.calendar thead .weekend{
color:#8E8E8E;
}


.calendar thead .hilite {
border-top:0;
/*text-decoration: underline;*/
color: #9A9A9A;
/*border-right: 1px solid #e7e9de;
border-left: 1px solid #e7e9de;*/
border-bottom: 1px solid #808080;
border-top: 1px solid #808080;
}

.calendar thead .name.hilite {
border-top:0;
/*text-decoration: underline;*/
color: #D8D8D8;
/*border-left: 1px solid #808080;
border-right: 1px solid #808080;*/
/*border-bottom: 1px solid #fafaed;*/
}

.calendar thead .active{
color: #D8D8D8;

}

.calendar tbody .day {
width:2em;
text-align:right;
/*padding:4px;*/
font-weight: bold;
color: #808080;
/*border: 1px solid #fafaed;*/
}

.calendar tbody .day.othermonth{
color:#aaa;
}

.calendar tbody .day.othermonth.oweekend {
color:#faa;
}

.calendar table thead .wn{
/*padding:4px;*/
color:#fff;
background-color: #656565;
/*border-left: 1px solid #656565;
border-right: 1px solid #656565;*/
}

.calendar table .wn{
/*padding:4px;*/
background-color:#e7e9de;
/*border-bottom: 1px solid #e7e9de;*/
}

.calendar tbody .rowhilite td {
background:#e4e0d8;
/*border-right: 1px solid #e4e0d8;
border-left: 1px solid #e4e0d8;*/
/*border-bottom: 1px solid #e4e0d8;
border-top: 1px solid #e4e0d8;*/
}

.calendar tbody .rowhilite td.wn{
background:#d4d0c8;
/*border: 1px solid #d4d0c8;*/
}

.calendar tbody td.weekend {
color: #83897b;
}

.calendar tbody td.hilite{
/*padding:4px;*/
background-color: #808080;
color: #fff;
/*text-decoration: underline;*/
/*border: 1px solid #808080;*/
}

.calendar tbody td.active {
/*padding:4px;*/
border:0;
background-color: #C2C2C2;
color: #808080;
/*text-decoration: underline;
border: 1px solid #C2C2C2;*/
}

.calendar tbody td.selected{
font-weight:bold;
border: 0;
/*padding:4px;*/
color: #57B3FF;
/*text-decoration: underline;*/
 }

.calendar tbody td.today {
font-weight:bold;
color: #57B3FF;
}


.calendar tbody .disabled {
color:#999;
}

.calendar tbody .emptycell {
visibility:hidden;
}

.calendar tbody .emptyrow{
display:none;
border-right: 1px solid #fafaed;
}



.calendar tfoot .ttip{
background: url('bouton.png');
padding:4px;

background-color:#ABABAB;
text-align:right;
color: #30312c;
border-right: 1px solid #ABABAB;
}
.calendar tfoot .hilite{
/*padding: 4px;*/
border:0;
}
.calendar tfoot .active{
/*padding: 4px;*/
border:0;
}

.calendar
.combo{position:absolute;display:none;width:4em;top:0;left:0;cursor:default;border-top:1px
solid #fff;border-right:1px solid #000;border-bottom:1px solid
#000;border-left:1px solid #fff;background:#e3;padding:1px;z-index:100;}
.calendar .combo .label,.calendar .combo
.label-IEfix{text-align:center;padding:1px;}
.calendar .combo .label-IEfix{width:4em;}
.calendar .combo .active{background:#c4c0b8;padding:0;border-top:1px solid
#000;border-right:1px solid #fff;border-bottom:1px solid
#fff;border-left:1px solid #000;}
.calendar .combo .hilite{background:#048;color:#fea;}

.calendar td.time{border-top:1px solid #000;padding:1px
0;text-align:center;background-color:#f4f0e8;}
.calendar td.time .hour,.calendar td.time .minute,.calendar td.time
.ampm{padding:0 3px 0 4px;border:1px solid
#889;font-weight:bold;background-color:#fff;}
.calendar td.time .ampm{text-align:center;}
.calendar td.time .colon{padding:0 2px 0 3px;font-weight:bold;}
.calendar td.time
span.hilite{border-color:#000;background-color:#766;color:#fff;}
.calendar td.time
span.active{border-color:#f00;background-color:#000;color:#0f0;}

#CP_hourcont{z-index:99;padding:0;position:absolute;border:1px das

[web2py] Saving Site or App specific data: Use a special db table with one huge record?

2011-09-07 Thread Rufus
For site persistant data, is it customary to put it
in a database table with one large record?

There are some statistical things I'd  like to keep track of on the
site.   Is it standard practice to define one data table that has
one large record containing the information?, for instance:

Number visitors since inception
emails sent
uploaded bytes stored
...

You don't want to pump through all your data base data for these
numbers, so it's probably more efficient to just keep them in a
file.

Is it normal to do this with a database table called something
like site_stats (or maybe app_stats, to stay in the application's
space), and simply do update_record with the changed field?
This is what I did:
 in models/sitedb.py -
db.define_table('app_stats',
Field('visitors', type='integer'),
Field('emails_sent', type='integer', default=0))
--

and in my controller I had (I left in the first misfire and comment
as a future warning to others):
--
#stat_rec = db().select(db.app_stats.visitors).last()
# the above line generates a KeyError for stat_rec.update_record
# the line below worked fine
stat_rec = db(db.app_stats).select().last()
if stat_rec:
   stat_rec.update_record(visitors = stat_rec.visitors + 1)
else:
   stat_rec = db.app_stats(db.app_stats.insert(visitors=1))
db.commit()
-

Are there other ways people save this kind of data?


Re: [web2py] Re: Published my collection of plugins

2011-09-07 Thread Richard Vézina
Hello Kenji,

You will maybe find the code of the actual datepicker here :
http://www.dynarch.com/projects/calendar/

If you clic on the "?" when the datepicker popup you will have the
disclaimer of the author of the plugin...

Richard

On Tue, Sep 6, 2011 at 8:59 PM, kenji4569  wrote:

> > After i upload a file i get a icon in the text.
> > How do i lauch the file that i just embedded in the text?
> The elrte editor prevents the icon link from clicking to download the
> file.
> So you have to first submit the editing html,
> and save the html in db,
> and then display the html in the view (as {{=XML(record.text)}}).
> But currently, the demo do not demonstrate this (so you need to
> implement this on your app).
> In the meantime, you can check the html source from the editor by
> clicking the "source" tab at the bottom of the editor.
>
> Kenji
>
>
> On 9月7日, 午前1:02, António Ramos  wrote:
> > After i upload a file i get a icon in the text.
> > How do i lauch the file that i just embedded in the text?
> >
> > Thank you
> >
> > 2011/9/6 kenji4569 
> >
> >
> >
> >
> >
> >
> >
> > > > web2py gives the file in the download
> > > > directory for example
> >
> > >
> 5e74c950-95b2-4843-b4c6-53bc8efca8fe >
> > >
> lrte_widget_file.file.9a877c8c8c9d285c.4361726f6c696e61323031305f612e646f63
> > > .doc>
> > > The former random string is a display file name, and just for demo.
> > > The latter one is an actual file name generated by web2py.
> >
> > > Now, I remove the former, since it's confusing:
> > >http://dev.s-cubism.com/plugin_elrte_widget
> >
> > > Changing the latter would require much work with deeper inspection
> > > into the web2py upload mechanism.
> >
> > > Changing the look and feel such as replacing icons would be easier,
> > > and you should see the file_upload_or_choose() function in the usage
> > > code of the demo.
> >
> > > Note that I do not implement a ready-made image/file chooser, and you
> > > have to implement it for your own application, starting from the usage
> > > code, including setting up your db and defining your image and file
> > > tables.
> >
> > > Regards,
> > > Kenji
> >
> > > On 9月6日, 午後6:01, António Ramos  wrote:
> > > > Hello Kenji,
> > > > Thank you for your fast work
> >
> > > > One problem!
> > > > The form is not very friendly.
> >
> > > > In the submit form i choose a pdf for example myfile.pdf but in the
> name
> > > > field you write the name that web2py gives the file in the download
> > > > directory for example
> >
> > >
> 5e74c950-95b2-4843-b4c6-53bc8efca8fe > >
> lrte_widget_file.file.9a877c8c8c9d285c.4361726f6c696e61323031305f612e646f63
> > > .doc>
> > > > This has no meaning to the user!
> >
> > > > Please see attached file for what i think it would be really
> helpfull.
> >
> > > > Thank you again
> >
> > > > António
> >
> > > > 2011/9/6 kenji4569 
> >
> > > > > Hi António,
> >
> > > > > I implemented a file chooser for the elrte widget.
> > > > > Please try it:
> > > > >http://dev.s-cubism.com/plugin_elrte_widget
> >
> > > > > Since the file chooser is very primitive, you may need to customize
> > > > > it.
> > > > > But, the customization would be easy with the expressive power of
> > > > > web2py (see the demo code).
> > > > > (Notice: I applied a small patch for the original elrte.js to make
> the
> > > > > file chooser available.)
> >
> > > > > Thanks again for your valuable feedback,
> > > > > Kenji
> >
> > > > > On 9月4日, 午後8:01, António Ramos  wrote:
> > > > > > Thank you.
> > > > > > I realy need your plugin ASAP but with the option to attach
> multiple
> > > pdf
> > > > > or
> > > > > > doc files.
> >
> > > > > > 2011/9/4 kenji4569 
> >
> > > > > > > >the elRTE WYSIWYG Widget does not allow to "import" a file
> other
> > > than
> > > > > an
> > > > > > > >image.
> > > > > > > >It would be nice to import for example a pdf or a doc file
> > > > > > > Thanks for your proposal.
> > > > > > > I think it would be easy to implement it, because the image
> chooser
> > > > > > > can be customized to anything.
> > > > > > > I'll try to do this.
> >
> > > > > > > Kenji
> >
> > > > > > > On 9月4日, 午後6:02, António Ramos  wrote:
> > > > > > > > Hello
> > > > > > > > the elRTE WYSIWYG Widget does not allow to "import" a file
> other
> > > than
> > > > > an
> > > > > > > > image.
> > > > > > > > It would be nice to import for example a pdf or a doc file
> >
> > > > > > > > Thank you
> > > > > > > > António
> >
> > > > > > > > 2011/9/4 kenji4569 
> >
> > > > > > > > > >Maybe the actual datepicker could be of some help to
> figure
> > > out
> > > > > how to
> > > > > > > > > make it moves...
> > > > > > > > > Thanks, but I couldn't read the source of the datepicker
> since
> > > it's
> > > > > > > > > compressed (I couldn't find the readable one in the host
> site).
> > > > > > > > > Other solution might be using jquery.ui.draggable, but it's
> not
> > > so
> > > > > > > > > light as to just make it draggable.
> > > > > > > > > So, for now, I leave the anytime.js unmodified

[web2py] form.accepts returning false

2011-09-07 Thread Christopher Baron
Hi web2py users,

When trying to update a row in a database table using the appadmin
interface, it does not work.  The same page returns with the original
values.

In the appadmin controller, form.accepts is returning false - this may
have to do with a hack I've made to the controllers.appadmin.py file
( I've made changes such that one can access the appadmin remotely
without an ssh tunnel or https )

How do I debug the form.accepts function in gluon ?

How can I make changes to the gluon.sqlhtml code and reload these
changes?

Thanks in advance,

Chris


[web2py] datepicker js littles issues first day name of week don't get hilite class and build up hilite and active class when mouse over buttons

2011-09-07 Thread Richard
Hello,

I notice that the datepicker js is not setting the hilite class
properly to the first day name of the week when passing over it.

Also when passing over the buttons ("?" and the "x") the js adds
hilite class and active class as long as it detect movement, so there
is a build up of hilite class and active class until on mouse over...

Richard


[web2py] Re: blog post on web2py + db2

2011-09-07 Thread Omi Chiba
Antonio,

You can contact me personally to solve the issue because it's really a
setting on your AS400. Are you AS400 guy ? If so, you can send me the
screen shot for the following.

WRKOBJ QSYS/MYLIB
Opt 2=Edit authority

By default, *public shulld be *CHANGE and authorization list = *NONE.

If you're secofr, you can also connect with QSECOFR.



On Sep 7, 9:18 am, Jim Steil  wrote:
> No journaling is required if you change the commit mode to Commit
> Immediate (*NONE) as shown in the blog post.
>
>      -Jim
>
> On 9/7/2011 9:06 AM, DenesL wrote:
>
>
>
>
>
>
>
> > If I remember correctly from my tests a couple of years ago, the AS400
> > for some reason wants to journal the files (tables) created thru ODBC.
> > No journal is required when reading from existing tables.
>
> > Looking at the files in my WEB2PY library I see a data area specifying
> > the name of the journal:
>
> > Data area . . . . . . . :   QDFTJRN
> >    Library . . . . . . . :     WEB2PY
> > Type  . . . . . . . . . :   *CHAR
> > Length  . . . . . . . . :   100
> > Text  . . . . . . . . . :
>
> >             Value
> > Offset      *...+1+2+3+4+5
> >      0      'WEB2PY    QDFTJRN   *FILE                         '
> >     50      '                                                  '
>
> > and the journal and journal receiver files:
>
> > Object      Type      Library
> > QDFTJRNRCV  *JRNRCV   WEB2PY
> > QSQJRNRCV   *JRNRCV   WEB2PY
> > QDFTJRN     *JRN      WEB2PY
> > QSQJRN      *JRN      WEB2PY
> > QDFTJRN     *DTAARA   WEB2PY
>
> > Obviously your user has to be authorized to use these objects.
> > Hope it helps,
> > Denes.
>
> > On Sep 7, 7:07 am, Ant nio Ramos  wrote:
> >> ProgrammingError: ('42000', '[42000] [IBM][Controlador ODBC do iSeries
> >> Access][DB2 UDB]SQL0551 - Not authorized to object AUTH_USER in MYLIB type
> >> *FILE. (-551) (SQLExecDirectW)')
>
> >> 2011/9/7 Omi Chiba
>
>  How about using auth with as400 users. Is it possible?
> >>> I'm not sure about it since I'm still new for web2py but your problem
> >>> should be related to the permission just like your error says.
> >>> My library is like...
> >>> Object secured by authorization list  . . . . . . . . . . . .
> >>> *NONE
> >>> Object
> >>> User        Group
> >>> Authority
> >>> *PUBLIC
> >>> *CHANGE
> >>> QSECOFR
> >>> *ALL
> >>> and my user has...
> >>> Special authority  . . . . . . . SPCAUT         *ALLOBJ
> >>> Maybe create new library and connect with the most high authority user
> >>> might help.
> >>> On Sep 6, 4:49 pm, Ant nio Ramos  wrote:
>  Ok, seems to get someting now.
>  I have to change in AS400 the permissions to allow my username to create
> >>> a
>  table
>  ProgrammingError: ('42000', '[42000] [IBM][Controlador ODBC do iSeries
>  Access][DB2 UDB]SQL0551 - Not authorized to object  in *N type
> >>> *USRPRF.
>  (-551) (SQLExecDirectW)')
>  How about using auth with as400 users. Is it possible?
>  Thank you
>  Em 6 de setembro de 2011 22:07, Ant nio Ramos  escreveu:
> > I tried the DAL Example and i could not connect to my AS400
> > does the DAL only works with db2 on windows or linux?
> > i have my db2 in a OS400 machine
> > Thank you
> > Ant nio
> > Em 6 de setembro de 2011 21:56, Ant nio Ramos  escreveu:
> > Great
> >> i tested the example from the python shell and i connected to my
> >>> company
> >> AS400 with success.
> >> FANTASTIC
> >> Tomorrow i will kick the ass of the RPG guy.
> >> :)
> >> 2011/9/6 Massimo Di Pierro
> >>>http://ochiba77.blogspot.com/2011/09/how-to-connect-db2-with-python-p...


[web2py] Re: form.accepts returning false

2011-09-07 Thread Rufus

Did you look at form.errors to find out why it returns false?

If form.errors doesn't exist, the accepts() method didn't see
it as having been submitted, and will return false.

See Example 28 in

http://web2py.com/examples/default/examples

for the three cases:  unsubmitted, submitted no error, submitted w/
error

Rufus


[web2py] accessing webserver

2011-09-07 Thread patrick moon
I've been able to get everything working...jquery/json/
web2py..ect...however, I can't seem to connect to the webserver from
another computer.  Everything is working locally right now.

Can someone point me to possible steps to take to figure this out?
Thanks


[web2py] Re: form.accepts returning false

2011-09-07 Thread Christopher Baron
Form.errors is an empty storage object.

So... it was unsubmitted ?

How is this possible when I'm using the controllers/appadmin.py that
comes with web2py ?

On Sep 7, 2:01 pm, Rufus  wrote:
> Did you look at form.errors to find out why it returns false?
>
> If form.errors doesn't exist, the accepts() method didn't see
> it as having been submitted, and will return false.
>
> See Example 28 in
>
> http://web2py.com/examples/default/examples
>
> for the three cases:  unsubmitted, submitted no error, submitted w/
> error
>
> Rufus


[web2py] Re: accessing webserver

2011-09-07 Thread Ross Peoples
If you are running web2py from the command line, you have to tell it to 
listen to connections from other computers. This is a security measure.

http://web2py.com/book/default/chapter/03?search=0.0.0.0

Or if you aren't using the GUI version, then your string would look 
something like this:

python web2py.py -i 0.0.0.0 -a password

The -i argument tells web2py to listen on the public interface.


[web2py] matplotlib output

2011-09-07 Thread Richard
Dear all,

On the Mac it ran but on windows I can't get started and do not get an
plot in an applications using:


In Controllers/default

def index():

import os
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('Agg')

x = np.arange(0, 5, 0.1);
y = np.sin(x)
plt.plot(x, y)

outputfile = os.path.join(request.folder,'static','mp1.png')
plt.savefig(outputfile,format='png')


In views/default/index.html

 Outfile from Matplotlib




Resulting in "None"

I think somebody can help me.

Thank, Richard



[web2py] widget for list:reference field in SQLFORM

2011-09-07 Thread monotasker
In a form generated by SQLFORM I'm finding that a list:reference field
is represented with a single list-box. What I expected based on the
section on list: in the manual was a series of select boxes. Was
I reading the manual wrong? If not, does anyone know why I might be
getting the wrong widget presented?

Here is the relevant part of my model:

db.define_table('tags',
Field('tag', 'string'), format='%(tag)s')

db.tags.tag.requires = IS_NOT_IN_DB(db, db.tags.tag)

db.define_table('questions',
Field('question', 'text', required=True),
Field('answer', 'string', required=True),
Field('score', default=1, required=True),
Field('answer2', 'string', default='null'),
Field('score2', 'double', default=0.5),
Field('answer3', 'string', default='null'),
Field('score3', 'double', default=0.3),
Field('readable_answer', 'string', default='null'),
Field('tags', 'list:reference tags'),
Field('nt_frequency', 'double'))

db.questions.tags.requires = IS_IN_DB(db, 'tags.id', db.tags._format,
multiple=True)

And here is the controller that creates the form:

def create_question():
form = SQLFORM(db.questions)
if form.accepts(request.vars, session):
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill out the form'
return dict(form=form)



[web2py] Re: matplotlib output

2011-09-07 Thread Anthony
On Wednesday, September 7, 2011 3:35:23 PM UTC-4, Richard wrote:
>
>
> 
>

Should be URL('static','mp1.png').

Anthony


Re: [web2py] matplotlib output

2011-09-07 Thread Richard Vézina
Look at the os.path.join()

There is particularity regarding the OS you should taking in account when
you want your command works everywhere...

Look in the python doc about that.

Richard

On Wed, Sep 7, 2011 at 3:35 PM, Richard  wrote:

> Dear all,
>
> On the Mac it ran but on windows I can't get started and do not get an
> plot in an applications using:
>
>
> In Controllers/default
>
> def index():
>
>import os
>import numpy as np
>import matplotlib
>import matplotlib.pyplot as plt
>matplotlib.use('Agg')
>
>x = np.arange(0, 5, 0.1);
>y = np.sin(x)
>plt.plot(x, y)
>
>outputfile = os.path.join(request.folder,'static','mp1.png')
>plt.savefig(outputfile,format='png')
>
>
> In views/default/index.html
>
>  Outfile from Matplotlib
> 
> 
>
>
> Resulting in "None"
>
> I think somebody can help me.
>
> Thank, Richard
>
>


[web2py] Re: widget for list:reference field in SQLFORM

2011-09-07 Thread Anthony
No, you should not get a series of select boxes, just a single multi-select 
box, like 
this: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select_multiple.

The book states that a list:reference field "produces a SELECT/OPTIONmultiple 
drop-box".

Anthony

On Wednesday, September 7, 2011 3:43:11 PM UTC-4, monotasker wrote:
>
> In a form generated by SQLFORM I'm finding that a list:reference field 
> is represented with a single list-box. What I expected based on the 
> section on list: in the manual was a series of select boxes. Was 
> I reading the manual wrong? If not, does anyone know why I might be 
> getting the wrong widget presented? 
>
> Here is the relevant part of my model: 
>
> db.define_table('tags', 
> Field('tag', 'string'), format='%(tag)s') 
>
> db.tags.tag.requires = IS_NOT_IN_DB(db, db.tags.tag) 
>
> db.define_table('questions', 
> Field('question', 'text', required=True), 
> Field('answer', 'string', required=True), 
> Field('score', default=1, required=True), 
> Field('answer2', 'string', default='null'), 
> Field('score2', 'double', default=0.5), 
> Field('answer3', 'string', default='null'), 
> Field('score3', 'double', default=0.3), 
> Field('readable_answer', 'string', default='null'), 
> Field('tags', 'list:reference tags'), 
> Field('nt_frequency', 'double')) 
>
> db.questions.tags.requires = IS_IN_DB(db, 'tags.id', db.tags._format, 
> multiple=True) 
>
> And here is the controller that creates the form: 
>
> def create_question(): 
> form = SQLFORM(db.questions) 
> if form.accepts(request.vars, session): 
> response.flash = 'form accepted' 
> elif form.errors: 
> response.flash = 'form has errors' 
> else: 
> response.flash = 'please fill out the form' 
> return dict(form=form) 
>
>

Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra

Only adding the .png extention is not sufficient.

outputfile = os.path.join(request.folder,'static','mp1.png')
plt.savefig(outputfile,format='png')


 Outfile from Matplotlib




Besides this issue; is using a temporarily file a mature solution or is 
streaming preferrable?


Richard


Op 7-9-2011 21:46, Anthony schreef:

On Wednesday, September 7, 2011 3:35:23 PM UTC-4, Richard wrote:





Should be URL('static','mp1.png').

Anthony


Geen virus gevonden in het binnenkomende-bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: 09/02/11 
08:34:00





[web2py] Re: Bug: Text field length default limit to 512 characters ?

2011-09-07 Thread Massimo Di Pierro
This is fixed in trunk anyway.

On Sep 6, 10:53 pm, Noel Villamor  wrote:
> Do an explicit length declaration in your model definition:
>
>     Field('txt','text', length=65536),
>
> Look here:
>
> http://www.web2py.com/book/default/chapter/06?search=Field+constructor
>
> On Sep 7, 3:10 pm, toan75  wrote:
>
>
>
>
>
>
>
> > Hi.
>
> > I found in 1.98.2, text field type default length is 512 not 65536?
> > It's correct?
>
> > Toan.


[web2py] Re: form.accepts returning false

2011-09-07 Thread Cliff
If your form doesn't have the default hidden fields, the controller
assumes it's a resubmit and fails silently.

Check out the book, Chapter 7, SQLFORMS.

But why would you want to do this?

On Sep 7, 2:05 pm, Christopher Baron  wrote:
> Hi web2py users,
>
> When trying to update a row in a database table using the appadmin
> interface, it does not work.  The same page returns with the original
> values.
>
> In the appadmin controller, form.accepts is returning false - this may
> have to do with a hack I've made to the controllers.appadmin.py file
> ( I've made changes such that one can access the appadmin remotely
> without an ssh tunnel or https )
>
> How do I debug the form.accepts function in gluon ?
>
> How can I make changes to the gluon.sqlhtml code and reload these
> changes?
>
> Thanks in advance,
>
> Chris


[web2py] Re: contrib module for cache stored in redis

2011-09-07 Thread Massimo Di Pierro
not necessarily but keep in mind there may be multi servers accessing
the same cache storage and each of the, may have concurrent requests
to access the same object. As long as you can deal with that, no
problem.

On Sep 7, 4:50 am, Niphlod  wrote:
> I think to have it covered
>
> Is it the "natural" behaviuor to have class istantiated for every call
> to @cache ?
>
> In this way it's needed a "hack" to reuse the connection storing the
> connection object in @cache.ram


[web2py] Re: form.accepts returning false

2011-09-07 Thread Christopher Baron
I don't believe I've taken the hidden fields out.  The only thing I've
changed in controllers/appadmin.py deals with redirection based on a
remote user.

I've written my own workaround, so I guess no one has to spend any
more time dealing with this.  Thanks for the assistance.

On Sep 7, 3:11 pm, Cliff  wrote:
> If your form doesn't have the default hidden fields, the controller
> assumes it's a resubmit and fails silently.
>
> Check out the book, Chapter 7, SQLFORMS.
>
> But why would you want to do this?
>
> On Sep 7, 2:05 pm, Christopher Baron  wrote:
>
>
>
>
>
>
>
> > Hi web2py users,
>
> > When trying to update a row in a database table using the appadmin
> > interface, it does not work.  The same page returns with the original
> > values.
>
> > In the appadmin controller, form.accepts is returning false - this may
> > have to do with a hack I've made to the controllers.appadmin.py file
> > ( I've made changes such that one can access the appadmin remotely
> > without an ssh tunnel or https )
>
> > How do I debug the form.accepts function in gluon ?
>
> > How can I make changes to the gluon.sqlhtml code and reload these
> > changes?
>
> > Thanks in advance,
>
> > Chris


[web2py] Re: Saving Site or App specific data: Use a special db table with one huge record?

2011-09-07 Thread Massimo Di Pierro
I have done it. Just make sure you retrieve it once and cache. Do not
retrieve every value only when needed.

On Sep 7, 12:13 pm, Rufus  wrote:
> For site persistant data, is it customary to put it
> in a database table with one large record?
>
> There are some statistical things I'd  like to keep track of on the
> site.   Is it standard practice to define one data table that has
> one large record containing the information?, for instance:
>
> Number visitors since inception
> emails sent
> uploaded bytes stored
> ...
>
> You don't want to pump through all your data base data for these
> numbers, so it's probably more efficient to just keep them in a
> file.
>
> Is it normal to do this with a database table called something
> like site_stats (or maybe app_stats, to stay in the application's
> space), and simply do update_record with the changed field?
> This is what I did:
>  in models/sitedb.py -
> db.define_table('app_stats',
>     Field('visitors', type='integer'),
>     Field('emails_sent', type='integer', default=0)    )
> --
>
> and in my controller I had (I left in the first misfire and comment
> as a future warning to others):
> --
> #    stat_rec = db().select(db.app_stats.visitors).last()
> # the above line generates a KeyError for stat_rec.update_record
> # the line below worked fine
>     stat_rec = db(db.app_stats).select().last()
>     if stat_rec:
>        stat_rec.update_record(visitors = stat_rec.visitors + 1)
>     else:
>        stat_rec = db.app_stats(db.app_stats.insert(visitors=1))
>     db.commit()
> -
>
> Are there other ways people save this kind of data?


Re: [web2py] Re: matplotlib output

2011-09-07 Thread Anthony
Have you confirmed that the file is actually getting saved in the expected 
location? Are you able to run the matplotlib code and save the file outside 
of web2py?


On Wednesday, September 7, 2011 4:05:08 PM UTC-4, Richard wrote:
>
>  Only adding the .png extention is not sufficient.
>
> outputfile = os.path.join(request.folder,'static','mp1.png')
> plt.savefig(outputfile,format='png')
>
>
>  Outfile from Matplotlib
> 
> 
>
>
> Besides this issue; is using a temporarily file a mature solution or is 
> streaming preferrable?
>
> Richard
>
>
> Op 7-9-2011 21:46, Anthony schreef: 
>
> On Wednesday, September 7, 2011 3:35:23 PM UTC-4, Richard wrote: 
>>
>>
>> 
>>
>
>  Should be URL('static','mp1.png').
>
>  Anthony
>
>  
> Geen virus gevonden in het binnenkomende-bericht.
> Gecontroleerd door AVG - www.avg.com 
> Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: 09/02/11 
> 08:34:00
>
>
>  
>  

[web2py] Re: appadmin and db.Table definition

2011-09-07 Thread Cliff
I think he means to ask why you are putting the table def in a class?

Much simpler to let the DAL do the work.

On Sep 7, 4:40 am, Manuele  wrote:
> On 05/09/2011 21:21, pbreit wrote:> Is there some reason your table 
> definitions depart so significantly from what is shown in the docs?
>
> what do you mean?


[web2py] form.custom - record is not created

2011-09-07 Thread Omi Chiba
I'm creating a simple twitter like app for fun. To submit worked with
{{=form}} and now I'm using form.custom.xxx for customization.

It works fine if I comment out the following from default.py but
form.vars will be empty and the record will not be created with the
two lines.

if form.accepts(request.vars, session):
redirect(URL())

Any idea what's happening and do you know how to solve this problem?


db.py
--
db.define_table('comment',
Field('body', 'text', length=140),
Field('created_on', 'datetime', default=request.now),
Field('created_by', db.auth_user, default=auth.user_id,
ondelete='NO ACTION'))

db.comment.body.requires = IS_NOT_EMPTY()
db.comment.created_on.writable = db.comment.created_on.readable =
False
db.comment.created_by.writable = db.comment.created_by.readable =
False

default.py
-
@auth.requires_login()
def index():
comments = db().select(db.comment.ALL,
orderby=~db.comment.created_on)
form = crud.create(db.comment)
if form.accepts(request.vars, session):
redirect(URL())
return dict(comments=comments, form=form)

default/index.html
--

{{extend 'layout.html'}}

What's happening ?
{{=form.custom.begin}}
{{=form.custom.widget.body}}
{{=form.custom.submit}}
{{=form.custom.end}}

{{=BEAUTIFY(request.vars)}}
{{=form.vars}}

What's happened ?
{{for comment in comments:}}
{{=db.auth_user[comment.created_by].first_name}}
{{=db.auth_user[comment.created_by].last_name}} - {{=comment.body}}


{{pass}}


[web2py] Re: contrib module for cache stored in redis

2011-09-07 Thread Niphlod
Hum, best way to test it ?
start 2 web2py instances with a cached query, let's say, and hit them
with ab ?
In theory the connection object to redis is itself a connection pool,
so there won't be problems.

I always defined cache (and see it defined) in models, where it gets
executed on every request is there a way to avoid class __init__
method (where the connection is built) on every request ?



Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra

Anthony,

plt.savefig('c:\web2py\outputfile.png',format='png')

does me give an accessable png-file

Op 7-9-2011 22:20, Anthony schreef:
Have you confirmed that the file is actually getting saved in the 
expected location? Are you able to run the matplotlib code and save 
the file outside of web2py?



On Wednesday, September 7, 2011 4:05:08 PM UTC-4, Richard wrote:

Only adding the .png extention is not sufficient.

outputfile = os.path.join(request.folder,'static','mp1.png')
plt.savefig(outputfile,format='png')


 Outfile from Matplotlib




Besides this issue; is using a temporarily file a mature solution
or is streaming preferrable?

Richard


Op 7-9-2011 21:46, Anthony schreef:

On Wednesday, September 7, 2011 3:35:23 PM UTC-4, Richard wrote:





Should be URL('static','mp1.png').

Anthony


Geen virus gevonden in het binnenkomende-bericht.
Gecontroleerd door AVG -www.avg.com  
Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: 
09/02/11 08:34:00





Geen virus gevonden in het binnenkomende-bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: 09/02/11 
08:34:00





[web2py] Re: form.custom - record is not created

2011-09-07 Thread Anthony
If you are using crud, you should not do form.accepts -- crud.create will 
handle the form.accepts for you. 
See http://web2py.com/book/default/chapter/07#CRUD.

Anthony

On Wednesday, September 7, 2011 4:29:24 PM UTC-4, Omi Chiba wrote:
>
> I'm creating a simple twitter like app for fun. To submit worked with 
> {{=form}} and now I'm using form.custom.xxx for customization. 
>
> It works fine if I comment out the following from default.py but 
> form.vars will be empty and the record will not be created with the 
> two lines. 
>
> if form.accepts(request.vars, session): 
> redirect(URL()) 
>
> Any idea what's happening and do you know how to solve this problem? 
>
>
> db.py 
> -- 
> db.define_table('comment', 
> Field('body', 'text', length=140), 
> Field('created_on', 'datetime', default=request.now), 
> Field('created_by', db.auth_user, default=auth.user_id, 
> ondelete='NO ACTION')) 
>
> db.comment.body.requires = IS_NOT_EMPTY() 
> db.comment.created_on.writable = db.comment.created_on.readable = 
> False 
> db.comment.created_by.writable = db.comment.created_by.readable = 
> False 
>
> default.py 
> - 
> @auth.requires_login() 
> def index(): 
> comments = db().select(db.comment.ALL, 
> orderby=~db.comment.created_on) 
> form = crud.create(db.comment) 
> if form.accepts(request.vars, session): 
> redirect(URL()) 
> return dict(comments=comments, form=form) 
>
> default/index.html 
> -- 
>
> {{extend 'layout.html'}} 
>
> What's happening ? 
> {{=form.custom.begin}} 
> {{=form.custom.widget.body}} 
> {{=form.custom.submit}} 
> {{=form.custom.end}} 
>
> {{=BEAUTIFY(request.vars)}} 
> {{=form.vars}} 
>
> What's happened ? 
> {{for comment in comments:}} 
> {{=db.auth_user[comment.created_by].first_name}} 
> {{=db.auth_user[comment.created_by].last_name}} - {{=comment.body}} 
>  
>  
> {{pass}} 
>


Re: [web2py] Re: matplotlib output

2011-09-07 Thread Anthony
But does 
plt.savefig(os.path.join(request.folder,'static','mp1.png'),format='png') 
result in a file being saved in c:\web2py\applications\your_app\static\?


On Wednesday, September 7, 2011 4:38:13 PM UTC-4, Richard wrote:
>
>  Anthony,
>
> plt.savefig('c:\web2py\outputfile.png',format='png')
>
> does me give an accessable png-file
>
> Op 7-9-2011 22:20, Anthony schreef: 
>
> Have you confirmed that the file is actually getting saved in the expected 
> location? Are you able to run the matplotlib code and save the file outside 
> of web2py? 
>
>  
> On Wednesday, September 7, 2011 4:05:08 PM UTC-4, Richard wrote: 
>>
>>  Only adding the .png extention is not sufficient.
>>
>> outputfile = os.path.join(request.folder,'static','mp1.png')
>> plt.savefig(outputfile,format='png')
>>
>>
>>  Outfile from Matplotlib
>> 
>> 
>>
>>
>> Besides this issue; is using a temporarily file a mature solution or is 
>> streaming preferrable?
>>
>> Richard
>>
>>
>> Op 7-9-2011 21:46, Anthony schreef: 
>>
>> On Wednesday, September 7, 2011 3:35:23 PM UTC-4, Richard wrote: 
>>>
>>>
>>> 
>>>
>>
>>  Should be URL('static','mp1.png').
>>
>>  Anthony
>>
>>  
>> Geen virus gevonden in het binnenkomende-bericht.
>> Gecontroleerd door AVG - www.avg.com 
>> Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: 09/02/11 
>> 08:34:00
>>
>>
>>  
>>   
>  
> Geen virus gevonden in het binnenkomende-bericht.
> Gecontroleerd door AVG - www.avg.com 
> Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: 09/02/11 
> 08:34:00
>
>
>  
>  

[web2py] Re: form.custom - record is not created

2011-09-07 Thread Omi Chiba
Thank you, Anthony !

I still want to do "redirect(URL())" if the entry is accepted.
Can you explain what condition I should use instead of form.accepts in
default.py ?

It's necessary to refresh the list on the page.

On Sep 7, 3:40 pm, Anthony  wrote:
> If you are using crud, you should not do form.accepts -- crud.create will
> handle the form.accepts for you.
> Seehttp://web2py.com/book/default/chapter/07#CRUD.
>
> Anthony
>
>
>
>
>
>
>
> On Wednesday, September 7, 2011 4:29:24 PM UTC-4, Omi Chiba wrote:
>
> > I'm creating a simple twitter like app for fun. To submit worked with
> > {{=form}} and now I'm using form.custom.xxx for customization.
>
> > It works fine if I comment out the following from default.py but
> > form.vars will be empty and the record will not be created with the
> > two lines.
>
> > if form.accepts(request.vars, session):
> >         redirect(URL())
>
> > Any idea what's happening and do you know how to solve this problem?
>
> > db.py
> > --
> > db.define_table('comment',
> >     Field('body', 'text', length=140),
> >     Field('created_on', 'datetime', default=request.now),
> >     Field('created_by', db.auth_user, default=auth.user_id,
> > ondelete='NO ACTION'))
>
> > db.comment.body.requires = IS_NOT_EMPTY()
> > db.comment.created_on.writable = db.comment.created_on.readable =
> > False
> > db.comment.created_by.writable = db.comment.created_by.readable =
> > False
>
> > default.py
> > -
> > @auth.requires_login()
> > def index():
> >     comments = db().select(db.comment.ALL,
> > orderby=~db.comment.created_on)
> >     form = crud.create(db.comment)
> >     if form.accepts(request.vars, session):
> >         redirect(URL())
> >     return dict(comments=comments, form=form)
>
> > default/index.html
> > --
>
> > {{extend 'layout.html'}}
>
> > What's happening ?
> > {{=form.custom.begin}}
> > {{=form.custom.widget.body}}
> > {{=form.custom.submit}}
> > {{=form.custom.end}}
>
> > {{=BEAUTIFY(request.vars)}}
> > {{=form.vars}}
>
> > What's happened ?
> > {{for comment in comments:}}
> > {{=db.auth_user[comment.created_by].first_name}}
> > {{=db.auth_user[comment.created_by].last_name}} - {{=comment.body}}
> > 
> > 
> > {{pass}}


Re: [web2py] Re: form.custom - record is not created

2011-09-07 Thread Jim Steil

Just add the 'next' parameter to the crud.create statement.

You can see the details here:

http://www.web2py.com/book/default/chapter/07#CRUD

Scroll down and look under Methods.

-Jim

On 9/7/2011 3:51 PM, Omi Chiba wrote:

Thank you, Anthony !

I still want to do "redirect(URL())" if the entry is accepted.
Can you explain what condition I should use instead of form.accepts in
default.py ?

It's necessary to refresh the list on the page.

On Sep 7, 3:40 pm, Anthony  wrote:

If you are using crud, you should not do form.accepts -- crud.create will
handle the form.accepts for you.
Seehttp://web2py.com/book/default/chapter/07#CRUD.

Anthony







On Wednesday, September 7, 2011 4:29:24 PM UTC-4, Omi Chiba wrote:


I'm creating a simple twitter like app for fun. To submit worked with
{{=form}} and now I'm using form.custom.xxx for customization.
It works fine if I comment out the following from default.py but
form.vars will be empty and the record will not be created with the
two lines.
if form.accepts(request.vars, session):
 redirect(URL())
Any idea what's happening and do you know how to solve this problem?
db.py
--
db.define_table('comment',
 Field('body', 'text', length=140),
 Field('created_on', 'datetime', default=request.now),
 Field('created_by', db.auth_user, default=auth.user_id,
ondelete='NO ACTION'))
db.comment.body.requires = IS_NOT_EMPTY()
db.comment.created_on.writable = db.comment.created_on.readable =
False
db.comment.created_by.writable = db.comment.created_by.readable =
False
default.py
-
@auth.requires_login()
def index():
 comments = db().select(db.comment.ALL,
orderby=~db.comment.created_on)
 form = crud.create(db.comment)
 if form.accepts(request.vars, session):
 redirect(URL())
 return dict(comments=comments, form=form)
default/index.html
--
{{extend 'layout.html'}}
What's happening ?
{{=form.custom.begin}}
{{=form.custom.widget.body}}
{{=form.custom.submit}}
{{=form.custom.end}}
{{=BEAUTIFY(request.vars)}}
{{=form.vars}}
What's happened ?
{{for comment in comments:}}
{{=db.auth_user[comment.created_by].first_name}}
{{=db.auth_user[comment.created_by].last_name}}  - {{=comment.body}}


{{pass}}


[web2py] Re: blog post on web2py + db2

2011-09-07 Thread DenesL

Thanks Jim.

On Sep 7, 10:18 am, Jim Steil  wrote:
> No journaling is required if you change the commit mode to Commit
> Immediate (*NONE) as shown in the blog post.
>
>      -Jim
>


[web2py] Re: form.custom - record is not created

2011-09-07 Thread Omi Chiba
Awsome !! I replaced with this and it work!
form = crud.create(db.comment, next=URL(''))

On Sep 7, 3:54 pm, Jim Steil  wrote:
> Just add the 'next' parameter to the crud.create statement.
>
> You can see the details here:
>
> http://www.web2py.com/book/default/chapter/07#CRUD
>
> Scroll down and look under Methods.
>
>      -Jim
>
> On 9/7/2011 3:51 PM, Omi Chiba wrote:
>
>
>
>
>
>
>
> > Thank you, Anthony !
>
> > I still want to do "redirect(URL())" if the entry is accepted.
> > Can you explain what condition I should use instead of form.accepts in
> > default.py ?
>
> > It's necessary to refresh the list on the page.
>
> > On Sep 7, 3:40 pm, Anthony  wrote:
> >> If you are using crud, you should not do form.accepts -- crud.create will
> >> handle the form.accepts for you.
> >> Seehttp://web2py.com/book/default/chapter/07#CRUD.
>
> >> Anthony
>
> >> On Wednesday, September 7, 2011 4:29:24 PM UTC-4, Omi Chiba wrote:
>
> >>> I'm creating a simple twitter like app for fun. To submit worked with
> >>> {{=form}} and now I'm using form.custom.xxx for customization.
> >>> It works fine if I comment out the following from default.py but
> >>> form.vars will be empty and the record will not be created with the
> >>> two lines.
> >>> if form.accepts(request.vars, session):
> >>>          redirect(URL())
> >>> Any idea what's happening and do you know how to solve this problem?
> >>> db.py
> >>> --
> >>> db.define_table('comment',
> >>>      Field('body', 'text', length=140),
> >>>      Field('created_on', 'datetime', default=request.now),
> >>>      Field('created_by', db.auth_user, default=auth.user_id,
> >>> ondelete='NO ACTION'))
> >>> db.comment.body.requires = IS_NOT_EMPTY()
> >>> db.comment.created_on.writable = db.comment.created_on.readable =
> >>> False
> >>> db.comment.created_by.writable = db.comment.created_by.readable =
> >>> False
> >>> default.py
> >>> -
> >>> @auth.requires_login()
> >>> def index():
> >>>      comments = db().select(db.comment.ALL,
> >>> orderby=~db.comment.created_on)
> >>>      form = crud.create(db.comment)
> >>>      if form.accepts(request.vars, session):
> >>>          redirect(URL())
> >>>      return dict(comments=comments, form=form)
> >>> default/index.html
> >>> --
> >>> {{extend 'layout.html'}}
> >>> What's happening ?
> >>> {{=form.custom.begin}}
> >>> {{=form.custom.widget.body}}
> >>> {{=form.custom.submit}}
> >>> {{=form.custom.end}}
> >>> {{=BEAUTIFY(request.vars)}}
> >>> {{=form.vars}}
> >>> What's happened ?
> >>> {{for comment in comments:}}
> >>> {{=db.auth_user[comment.created_by].first_name}}
> >>> {{=db.auth_user[comment.created_by].last_name}}  - {{=comment.body}}
> >>> 
> >>> 
> >>> {{pass}}


[web2py] Error running sqlform.grid from trunk

2011-09-07 Thread Jim Steil

Hi

I'm getting the following:

Traceback(most recent call last):
  File"C:\dev\trunk\web2py\gluon\restricted.py",line194,inrestricted
execccodeinenvironment
  File"C:/dev/trunk/web2py/applications/FoodPantry/controllers/default.py"  
,line25,in
  File"C:\dev\trunk\web2py\gluon\globals.py",line145,in
self._caller=lambdaf:f()
  File"C:/dev/trunk/web2py/applications/FoodPantry/controllers/default.py"  
,line21,inpersons
form=SQLFORM.grid(db.person,ui='jquery-ui',paginate=20)
  File"C:\dev\trunk\web2py\gluon\sqlhtml.py",line1655,ingrid
id=row[field_id]
  File"C:\dev\trunk\web2py\gluon\dal.py",line3832,in__getitem__
returndict.__getitem__(self,m.group(1))[m.group(2)]
TypeError:'Set'objectisunsubscriptable


with the the following setup:

db.py
person = db.define_table('person',
Field('personId', 'id'),
Field('firstName', length=25, required=True, label='First Name'),
Field('lastName', length=25, required=True, label='Last Name'),
Field('address', 'text'),
Field('city', length=30),
Field('state', length=2),
Field('zipCode', length=10, label='ZIP Code'),
Field('phone', length=25),
Field('dob', 'date', label='Date of Birth'),
Field('sex', length=1),
Field('disability', length=50),
Field('singleParent', 'boolean', default=False, label='Single Parent'),
Field('healthInsurance', length=50, label='Health Insurance'),
Field('origin', length=50),
Field('headOfHousehold', 'reference person', label='Head of 
Household'),

Field('lastFirst', compute=lambda u: '%s, %s' % (u['lastName'],
 u['firstName'])))
person.firstName.requires = IS_NOT_EMPTY()
person.lastName.requires = IS_NOT_EMPTY()
person.dob.requires = IS_DATE()
person.sex.requires = IS_IN_SET(['M', 'F'])
person.headOfHousehold.requires = IS_EMPTY_OR(IS_IN_DB(db, db.person,
  '%(lastFirst)s',
  zero='...choose 
one...'))


default.py

def persons():
form = SQLFORM.grid(db.person, ui='jquery-ui', paginate=20)

return dict(form=form)

Any thoughts?

-Jim




[web2py] Re: widget for list:reference field in SQLFORM

2011-09-07 Thread monotasker
OK. That description confused me in the book (I'm not used to
describing multi-select boxes as a 'drop-box' so I assumed it meant
drop-down). Thanks. I think it would be more usable if the default
widget were something like the one used in the app-creation wizard for
table and field creation:

1) present a single text field with autocomplete based on the
referenced table, then

2) when the user fills that field (or on ?) another field
appears below it.

A multi-select field doesn't seem to me very user-friendly if we're
trying to select multiple options from a long pre-populated set of
choices. The user has to use CTRL-LMB just to select a second option,
and has to scroll manually through the list. Do you think this is
something worth changing?

Ian

On Sep 7, 4:02 pm, Anthony  wrote:
> No, you should not get a series of select boxes, just a single multi-select
> box, like
> this:http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select_multiple.
>
> The book states that a list:reference field "produces a SELECT/OPTIONmultiple 
> drop-box".
>
> Anthony
>
>
>
>
>
>
>
> On Wednesday, September 7, 2011 3:43:11 PM UTC-4, monotasker wrote:
>
> > In a form generated by SQLFORM I'm finding that a list:reference field
> > is represented with a single list-box. What I expected based on the
> > section on list: in the manual was a series of select boxes. Was
> > I reading the manual wrong? If not, does anyone know why I might be
> > getting the wrong widget presented?
>
> > Here is the relevant part of my model:
>
> > db.define_table('tags',
> >     Field('tag', 'string'), format='%(tag)s')
>
> > db.tags.tag.requires = IS_NOT_IN_DB(db, db.tags.tag)
>
> > db.define_table('questions',
> >     Field('question', 'text', required=True),
> >     Field('answer', 'string', required=True),
> >     Field('score', default=1, required=True),
> >     Field('answer2', 'string', default='null'),
> >     Field('score2', 'double', default=0.5),
> >     Field('answer3', 'string', default='null'),
> >     Field('score3', 'double', default=0.3),
> >     Field('readable_answer', 'string', default='null'),
> >     Field('tags', 'list:reference tags'),
> >     Field('nt_frequency', 'double'))
>
> > db.questions.tags.requires = IS_IN_DB(db, 'tags.id', db.tags._format,
> > multiple=True)
>
> > And here is the controller that creates the form:
>
> > def create_question():
> >     form = SQLFORM(db.questions)
> >     if form.accepts(request.vars, session):
> >         response.flash = 'form accepted'
> >     elif form.errors:
> >         response.flash = 'form has errors'
> >     else:
> >         response.flash = 'please fill out the form'
> >     return dict(form=form)


Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra
Yes it does :)


Op 7 sep 2011, om 22:43 heeft Anthony het volgende geschreven:

> But does 
> plt.savefig(os.path.join(request.folder,'static','mp1.png'),format='png') 
> result in a file being saved in c:\web2py\applications\your_app\static\?
> 
> 
> On Wednesday, September 7, 2011 4:38:13 PM UTC-4, Richard wrote:
> Anthony,
> 
> plt.savefig('c:\web2py\outputfile.png',format='png')
> 
> does me give an accessable png-file
> 
> Op 7-9-2011 22:20, Anthony schreef:
>> 
>> Have you confirmed that the file is actually getting saved in the expected 
>> location? Are you able to run the matplotlib code and save the file outside 
>> of web2py?
>> 
>> 
>> On Wednesday, September 7, 2011 4:05:08 PM UTC-4, Richard wrote:
>> Only adding the .png extention is not sufficient.
>> 
>> outputfile = os.path.join(request.folder,'static','mp1.png')
>> plt.savefig(outputfile,format='png')
>> 
>> 
>>  Outfile from Matplotlib
>> 
>> 
>> 
>> 
>> Besides this issue; is using a temporarily file a mature solution or is 
>> streaming preferrable?
>> 
>> Richard
>> 
>> 
>> Op 7-9-2011 21:46, Anthony schreef:
>>> 
>>> On Wednesday, September 7, 2011 3:35:23 PM UTC-4, Richard wrote:
>>> 
>>> 
>>> 
>>> Should be URL('static','mp1.png').
>>> 
>>> Anthony
>>> 
>>> 
>>> Geen virus gevonden in het binnenkomende-bericht.
>>> Gecontroleerd door AVG - www.avg.com 
>>> Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: 
>>> 09/02/11 08:34:00
>>> 
>> 
>> 
>> 
>> Geen virus gevonden in het binnenkomende-bericht.
>> Gecontroleerd door AVG - www.avg.com 
>> Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: 09/02/11 
>> 08:34:00
>> 
> 



Re: [web2py] Error running sqlform.grid from trunk

2011-09-07 Thread Martín Mulone
I think is a bug, please report it:
http://code.google.com/p/web2py/issues/list

2011/9/7 Jim Steil 

>  Hi
>
> I'm getting the following:
>
> Traceback (most recent call last):
>   File "C:\dev\trunk\web2py\gluon\restricted.py", line 194, in restricted
> exec ccode in environment
>   File "C:/dev/trunk/web2py/applications/FoodPantry/controllers/default.py" 
> ,
>  line 25, in 
>   File "C:\dev\trunk\web2py\gluon\globals.py", line 145, in 
> self._caller = lambda f: f()
>   File "C:/dev/trunk/web2py/applications/FoodPantry/controllers/default.py" 
> ,
>  line 21, in persons
> form = SQLFORM.grid(db.person, ui='jquery-ui', paginate=20)
>   File "C:\dev\trunk\web2py\gluon\sqlhtml.py", line 1655, in grid
> id = row[field_id]
>   File "C:\dev\trunk\web2py\gluon\dal.py", line 3832, in __getitem__
> return dict.__getitem__(self, m.group(1))[m.group(2)]TypeError: 'Set' 
> object is unsubscriptable
>
>
> with the the following setup:
>
> db.py
> person = db.define_table('person',
> Field('personId', 'id'),
> Field('firstName', length=25, required=True, label='First Name'),
> Field('lastName', length=25, required=True, label='Last Name'),
> Field('address', 'text'),
> Field('city', length=30),
> Field('state', length=2),
> Field('zipCode', length=10, label='ZIP Code'),
> Field('phone', length=25),
> Field('dob', 'date', label='Date of Birth'),
> Field('sex', length=1),
> Field('disability', length=50),
> Field('singleParent', 'boolean', default=False, label='Single Parent'),
> Field('healthInsurance', length=50, label='Health Insurance'),
> Field('origin', length=50),
> Field('headOfHousehold', 'reference person', label='Head of
> Household'),
> Field('lastFirst', compute=lambda u: '%s, %s' % (u['lastName'],
>  u['firstName'])))
> person.firstName.requires = IS_NOT_EMPTY()
> person.lastName.requires = IS_NOT_EMPTY()
> person.dob.requires = IS_DATE()
> person.sex.requires = IS_IN_SET(['M', 'F'])
> person.headOfHousehold.requires = IS_EMPTY_OR(IS_IN_DB(db, db.person,
>   '%(lastFirst)s',
>   zero='...choose
> one...'))
>
> default.py
>
> def persons():
> form = SQLFORM.grid(db.person, ui='jquery-ui', paginate=20)
>
> return dict(form=form)
>
> Any thoughts?
>
> -Jim
>
>
>


-- 
 http://martin.tecnodoc.com.ar


Re: [web2py] Error running sqlform.grid from trunk

2011-09-07 Thread Jim Steil

Submitted - http://code.google.com/p/web2py/issues/detail?id=412

-Jim

On 9/7/2011 4:25 PM, Martín Mulone wrote:
I think is a bug, please report it: 
http://code.google.com/p/web2py/issues/list


2011/9/7 Jim Steil mailto:j...@qlf.com>>

Hi

I'm getting the following:

Traceback(most recent call last):
   File"C:\dev\trunk\web2py\gluon\restricted.py",line194,inrestricted
 execccodeinenvironment
   File"C:/dev/trunk/web2py/applications/FoodPantry/controllers/default.py"  
,line25,in
   File"C:\dev\trunk\web2py\gluon\globals.py",line145,in
 self._caller=lambdaf:f()
   File"C:/dev/trunk/web2py/applications/FoodPantry/controllers/default.py"  
,line21,inpersons
 form=SQLFORM.grid(db.person,ui='jquery-ui',paginate=20)
   File"C:\dev\trunk\web2py\gluon\sqlhtml.py",line1655,ingrid
 id=row[field_id]
   File"C:\dev\trunk\web2py\gluon\dal.py",line3832,in__getitem__
 returndict.__getitem__(self,m.group(1))[m.group(2)]
TypeError:'Set'objectisunsubscriptable


with the the following setup:

db.py
person = db.define_table('person',
Field('personId', 'id'),
Field('firstName', length=25, required=True, label='First Name'),
Field('lastName', length=25, required=True, label='Last Name'),
Field('address', 'text'),
Field('city', length=30),
Field('state', length=2),
Field('zipCode', length=10, label='ZIP Code'),
Field('phone', length=25),
Field('dob', 'date', label='Date of Birth'),
Field('sex', length=1),
Field('disability', length=50),
Field('singleParent', 'boolean', default=False, label='Single
Parent'),
Field('healthInsurance', length=50, label='Health Insurance'),
Field('origin', length=50),
Field('headOfHousehold', 'reference person', label='Head of
Household'),
Field('lastFirst', compute=lambda u: '%s, %s' % (u['lastName'],
 u['firstName'])))
person.firstName.requires = IS_NOT_EMPTY()
person.lastName.requires = IS_NOT_EMPTY()
person.dob.requires = IS_DATE()
person.sex.requires = IS_IN_SET(['M', 'F'])
person.headOfHousehold.requires = IS_EMPTY_OR(IS_IN_DB(db, db.person,
  '%(lastFirst)s',
 
zero='...choose one...'))


default.py

def persons():
form = SQLFORM.grid(db.person, ui='jquery-ui', paginate=20)

return dict(form=form)

Any thoughts?

-Jim





--
http://martin.tecnodoc.com.ar



Re: [web2py] Re: matplotlib output

2011-09-07 Thread Richard Dijkstra
Looking closer an output window appears and the console gives errors on the 
sequence of calling matplotlib.backends:

I'll check first.



Op 7 sep 2011, om 22:43 heeft Anthony het volgende geschreven:

> But does 
> plt.savefig(os.path.join(request.folder,'static','mp1.png'),format='png') 
> result in a file being saved in c:\web2py\applications\your_app\static\?
> 
> 
> On Wednesday, September 7, 2011 4:38:13 PM UTC-4, Richard wrote:
> Anthony,
> 
> plt.savefig('c:\web2py\outputfile.png',format='png')
> 
> does me give an accessable png-file
> 
> Op 7-9-2011 22:20, Anthony schreef:
>> 
>> Have you confirmed that the file is actually getting saved in the expected 
>> location? Are you able to run the matplotlib code and save the file outside 
>> of web2py?
>> 
>> 
>> On Wednesday, September 7, 2011 4:05:08 PM UTC-4, Richard wrote:
>> Only adding the .png extention is not sufficient.
>> 
>> outputfile = os.path.join(request.folder,'static','mp1.png')
>> plt.savefig(outputfile,format='png')
>> 
>> 
>>  Outfile from Matplotlib
>> 
>> 
>> 
>> 
>> Besides this issue; is using a temporarily file a mature solution or is 
>> streaming preferrable?
>> 
>> Richard
>> 
>> 
>> Op 7-9-2011 21:46, Anthony schreef:
>>> 
>>> On Wednesday, September 7, 2011 3:35:23 PM UTC-4, Richard wrote:
>>> 
>>> 
>>> 
>>> Should be URL('static','mp1.png').
>>> 
>>> Anthony
>>> 
>>> 
>>> Geen virus gevonden in het binnenkomende-bericht.
>>> Gecontroleerd door AVG - www.avg.com 
>>> Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: 
>>> 09/02/11 08:34:00
>>> 
>> 
>> 
>> 
>> Geen virus gevonden in het binnenkomende-bericht.
>> Gecontroleerd door AVG - www.avg.com 
>> Versie: 9.0.872 / Virusdatabase: 271.1.1/3872 - datum van uitgifte: 09/02/11 
>> 08:34:00
>> 
> 



[web2py] Re: widget for list:reference field in SQLFORM

2011-09-07 Thread Anthony
Since developers will have different preferences for multiselect widgets and 
it is so easy to plug something in on the client side, I'm not sure the 
framework needs to commit to a particular widget. Here are a few good 
options:

http://www.erichynds.com/examples/jquery-ui-multiselect-widget/demos/#basic
http://www.quasipartikel.at/multiselect/
http://jqueryui.com/demos/autocomplete/#multiple


On Wednesday, September 7, 2011 5:12:55 PM UTC-4, monotasker wrote:
>
> OK. That description confused me in the book (I'm not used to 
> describing multi-select boxes as a 'drop-box' so I assumed it meant 
> drop-down). Thanks. I think it would be more usable if the default 
> widget were something like the one used in the app-creation wizard for 
> table and field creation: 
>
> 1) present a single text field with autocomplete based on the 
> referenced table, then 
>
> 2) when the user fills that field (or on ?) another field 
> appears below it. 
>
> A multi-select field doesn't seem to me very user-friendly if we're 
> trying to select multiple options from a long pre-populated set of 
> choices. The user has to use CTRL-LMB just to select a second option, 
> and has to scroll manually through the list. Do you think this is 
> something worth changing? 
>
> Ian 
>
> On Sep 7, 4:02 pm, Anthony  wrote: 
> > No, you should not get a series of select boxes, just a single 
> multi-select 
> > box, like 
> > this:
> http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select_multiple. 
> > 
> > The book states that a list:reference field "produces a 
> SELECT/OPTIONmultiple drop-box". 
> > 
> > Anthony 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Wednesday, September 7, 2011 3:43:11 PM UTC-4, monotasker wrote: 
> > 
> > > In a form generated by SQLFORM I'm finding that a list:reference field 
> > > is represented with a single list-box. What I expected based on the 
> > > section on list: in the manual was a series of select boxes. Was 
> > > I reading the manual wrong? If not, does anyone know why I might be 
> > > getting the wrong widget presented? 
> > 
> > > Here is the relevant part of my model: 
> > 
> > > db.define_table('tags', 
> > > Field('tag', 'string'), format='%(tag)s') 
> > 
> > > db.tags.tag.requires = IS_NOT_IN_DB(db, db.tags.tag) 
> > 
> > > db.define_table('questions', 
> > > Field('question', 'text', required=True), 
> > > Field('answer', 'string', required=True), 
> > > Field('score', default=1, required=True), 
> > > Field('answer2', 'string', default='null'), 
> > > Field('score2', 'double', default=0.5), 
> > > Field('answer3', 'string', default='null'), 
> > > Field('score3', 'double', default=0.3), 
> > > Field('readable_answer', 'string', default='null'), 
> > > Field('tags', 'list:reference tags'), 
> > > Field('nt_frequency', 'double')) 
> > 
> > > db.questions.tags.requires = IS_IN_DB(db, 'tags.id', db.tags._format, 
> > > multiple=True) 
> > 
> > > And here is the controller that creates the form: 
> > 
> > > def create_question(): 
> > > form = SQLFORM(db.questions) 
> > > if form.accepts(request.vars, session): 
> > > response.flash = 'form accepted' 
> > > elif form.errors: 
> > > response.flash = 'form has errors' 
> > > else: 
> > > response.flash = 'please fill out the form' 
> > > return dict(form=form)



[web2py] Re: Iterate through form.vars

2011-09-07 Thread Noel Villamor
Thanks for the info Anthony.

Denes, you just added a trick to my python arsenal. TY.

Noel


[web2py] Re: accessing webserver

2011-09-07 Thread Christopher Steel
Hi Patrick,

a few more detail would help nail down the issue. Are you running the 
default webserver or Apache..., what OS are you using to host...

C



[web2py] Re: List widget issue when invalid form

2011-09-07 Thread rdmurphy
Hi Massimo and web2py team,
Just following up on this issue. If you guys agree it's a bug I can
open a ticket for it.

Thanks
Ryan


On Aug 29, 4:03 pm, rdmurphy  wrote:
> Hi everyone,
> Since it's my first post, I'd like to first say great framework to the
> whole team. I'm really enjoying using it.
>
> I think I've found a small bug in the handling of list fields in an
> invalid form.
> I have a list:string field and another required field.
>
> When there is only 1 input field and value for the list field and the
> submitted form is invalid (the other field is invalid), the returned
> error form splits my 1 value up into individual characters since it
> assumes the request.var is an array.
>
> I've traced it down to sqlhtml in this section around row 1090:
>
> if hasattr(field, 'widget') and field.widget and fieldname in
> request_vars:
>     if fieldname in self.vars:
>         value = self.vars[fieldname]
> etc
> widget = field.widget(field, value)
>
> Then ListWidget exects to be getting an array as the value.
>
> So might need a check on the value type if using self.vars, like:
> if field.type.startswith('list:') and isinstance(value, str):
>     value = [value]
>
> Thanks
> Ryan


[web2py] Re: Date Picker Widget

2011-09-07 Thread Christopher Steel
+1 excellent look annet. Has anyone checked this in IE?

I really like it, a lot

Chris


[web2py] About the welcome app

2011-09-07 Thread António Ramos
Just my opinion guys.

I hate the welcome app

Every time i think of it i think it should be deleted.No ofense please. Its
useless in my opinion.
Not delete but changed!

The only time i read the screen was the first time i installed web2py. But i
was so happy that i never read all the text to the end.


*You are successfully running web2py
This is a copy of the scaffolding application
You can modify this application and adapt it to your needs
Painel administrativo
Exemplos online
web2py.com
Documentation
You visited the url /welcome/default/index
Which called the function index() located in the file
web2py/applications/welcome/controllers/default.py
The output of the file is a dictionary that was rendered by the view
web2py/applications/welcome/views/default/index.html*

Did you read it all ? come on, just READ IT.  i wait for you :)
Is it just me?

I know i can customize it to my needs but the standard version should be
more usefull.


Why not a contest for the best looking welcome app?
Or else why not share everyones welcome page so that we can all agree in a
better welcome page?

Best regards to you all.


Re: [web2py] About the welcome app

2011-09-07 Thread Bruno Rocha
I do not like it so much, I hate superfish menu and gray colors.

So, I have my own boilerplate which I use to bootstrat every web2py project
I work.

Welcome app is useful just for people to know that web2py is running well.

But the problem is when too much people use it without styling.

I think it should be cleaner, no layout needed. No complex menu. and more
examples in how to use models, views, modules etc...

http://zerp.ly/rochacbruno
Em 07/09/2011 19:09, "António Ramos"  escreveu:
> Just my opinion guys.
>
> I hate the welcome app
>
> Every time i think of it i think it should be deleted.No ofense please.
Its
> useless in my opinion.
> Not delete but changed!
>
> The only time i read the screen was the first time i installed web2py. But
i
> was so happy that i never read all the text to the end.
>
>
> *You are successfully running web2py
> This is a copy of the scaffolding application
> You can modify this application and adapt it to your needs
> Painel administrativo
> Exemplos online
> web2py.com
> Documentation
> You visited the url /welcome/default/index
> Which called the function index() located in the file
> web2py/applications/welcome/controllers/default.py
> The output of the file is a dictionary that was rendered by the view
> web2py/applications/welcome/views/default/index.html*
>
> Did you read it all ? come on, just READ IT. i wait for you :)
> Is it just me?
>
> I know i can customize it to my needs but the standard version should be
> more usefull.
>
>
> Why not a contest for the best looking welcome app?
> Or else why not share everyones welcome page so that we can all agree in a
> better welcome page?
>
> Best regards to you all.


[web2py] message when login required

2011-09-07 Thread Chris Steel
A long time ago someone talked about adding a message parameter to
@auth.requires_login() so that a message could be passed but it does not
seem to be working:

Example:

@auth.requires_login(message=T('You need to be log in to perform this
action'))
def blog_create_entry:
bla bla bla
return...

Did this ever get added or can we do this another way. Right now users are
automatically redirected to the login screen which I am guessing is a bit
confusing because we have no message explaining what happened.

Thanks
-- 

Christopher Steel

Voice of Access


[web2py] Re: appadmin and db.Table definition

2011-09-07 Thread pbreit
Yeah, I was just wondering why your table definitions don't look more like 
this:

db.define_table('page',
Field ('title'),
Field ('body', 'text'),
Field ('created_on', 
'datetime', default=request 
.now),
Field ('created_by', 
db.auth_user, default=auth.user_id),
format='%(title)s')



[web2py] Re: About the welcome app

2011-09-07 Thread pbreit
I certainly would not call it useless. It provides a bit of information 
about how pages get rendered as well as some useful links.

Do you have any suggestions for how to improve?


[web2py] Re: form.accepts returning false

2011-09-07 Thread Cliff
Okay.

You can verify what you are getting back from the browser by putting

print request.post_vars

in your controller right after the call to form.accepts().

Assuming you are using Rocket, the output will show up in the terminal
window where you started web2py.py.

On Sep 7, 4:15 pm, Christopher Baron  wrote:
> I don't believe I've taken the hidden fields out.  The only thing I've
> changed in controllers/appadmin.py deals with redirection based on a
> remote user.
>
> I've written my own workaround, so I guess no one has to spend any
> more time dealing with this.  Thanks for the assistance.
>
> On Sep 7, 3:11 pm, Cliff  wrote:
>
>
>
>
>
>
>
> > If your form doesn't have the default hidden fields, the controller
> > assumes it's a resubmit and fails silently.
>
> > Check out the book, Chapter 7, SQLFORMS.
>
> > But why would you want to do this?
>
> > On Sep 7, 2:05 pm, Christopher Baron  wrote:
>
> > > Hi web2py users,
>
> > > When trying to update a row in a database table using the appadmin
> > > interface, it does not work.  The same page returns with the original
> > > values.
>
> > > In the appadmin controller, form.accepts is returning false - this may
> > > have to do with a hack I've made to the controllers.appadmin.py file
> > > ( I've made changes such that one can access the appadmin remotely
> > > without an ssh tunnel or https )
>
> > > How do I debug the form.accepts function in gluon ?
>
> > > How can I make changes to the gluon.sqlhtml code and reload these
> > > changes?
>
> > > Thanks in advance,
>
> > > Chris


[web2py] Re: Cron Jobs with Linode or Web2py?

2011-09-07 Thread pbreit
I think you're going to want to eventually end up using the system's cron. 
Struggled to figure out the best commands to put in my crontab and ended up 
with a smal hack: */1 * * * * wget http://localhost/cron/mail_queue 
>/dev/null 2>&1

That calls the function "mail_queue" in my "cron.py" controller file. I 
doubt this is the best way to do it but was the only way I could get it 
working reliably.


[web2py] using twitter bootstratp in base.css

2011-09-07 Thread Anaconda
would it be wise to use twitterbootstrap in place of base.css for a
tiny app I am building? I am just looking for general opinions as I am
a relatively new developer.

Regards


[web2py] CAS Auth with HTTPS

2011-09-07 Thread Bruno de Oliva Bemfica
Hello everyone. I was taking a look at the JASIG CAS specifications, and I
saw two interesting things:

1 - The CAS protocol *requires* HTTPS. I'm trying to use jasig phpCAS as a
cas client of my web2py app and it's not workings. When I try to open the
php page, the page tries to redirect to a HTTPS URL, even why I set the port
to 8000.

2 - The Web2py cas tickets don't seem to conform the CAS specifications(e.g
starting with "PT-" or "ST-").

--
Bruno de Oliva Bemfica
*Engenheiro de Software*
MSN: brunocode...@live.com 
Mobile: +55 11 8457-0978
http://www.devfranca.com.br
http://www.brunobemfica.net
http://www.codigofree.net


Re: [web2py] using twitter bootstratp in base.css

2011-09-07 Thread Bruno Rocha
As far as I know twitter bootstrap is not just a css, it include a set of
patterns for classes and some javascript. css are built with saas or less
(or something like this)

I guess that including its css in welcome app will create a great confusion,
or will not work at all. Someone needs to create a web2py-twitter-bootstrap
app.

I have my jquery-ui + html5boilerplate + 960.gs + jquerymobile bootstrap app
made on top of welcome. Something similar needs to be done with twitter app.


On Wed, Sep 7, 2011 at 9:25 PM, Anaconda  wrote:

> would it be wise to use twitterbootstrap in place of base.css for a
> tiny app I am building? I am just looking for general opinions as I am
> a relatively new developer.
>
> Regards
>



-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


Re: [web2py] Re: appadmin and db.Table definition

2011-09-07 Thread Bruno Rocha
Also, from book.http://web2py.com/book/default/chapter/06#Dependencies

*Table* represents a database table. You do not directly instantiate Table;
instead,DAL.define_table instantiates it.


1.


db.define_table('mytable', Field
('myfield')


[web2py] Re: using twitter bootstratp in base.css

2011-09-07 Thread Anaconda
thanks bruno , I am playing around with it right now, it does cause
some confusion but I have been removing some stuff out of base.CSS so
it its working a bit better now.  Sep 7, 6:46 pm, Bruno Rocha
 wrote:
> As far as I know twitter bootstrap is not just a css, it include a set of
> patterns for classes and some javascript. css are built with saas or less
> (or something like this)
>
> I guess that including its css in welcome app will create a great confusion,
> or will not work at all. Someone needs to create a web2py-twitter-bootstrap
> app.
>
> I have my jquery-ui + html5boilerplate + 960.gs + jquerymobile bootstrap app
> made on top of welcome. Something similar needs to be done with twitter app.
>
> On Wed, Sep 7, 2011 at 9:25 PM, Anaconda  wrote:
> > would it be wise to use twitterbootstrap in place of base.css for a
> > tiny app I am building? I am just looking for general opinions as I am
> > a relatively new developer.
>
> > Regards
>
> --
>
> --
> Bruno Rocha
> [ About me:http://zerp.ly/rochacbruno]
> [ Aprenda a programar:http://CursoDePython.com.br]
> [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
> [ Consultoria em desenvolvimento web:http://www.blouweb.com]


[web2py] Re: Building a non-trivial SOAP service using web2py

2011-09-07 Thread David Mitchell
Bump

On 6 September 2011 19:13, David Mitchell  wrote:

> Hello all,
>
> I'm looking at using web2py to build a SOAP service to work as a test
> harness for an infrastructure upgrade we're planning.  Unfortunately, all
> the web2py SOAP info I've found has been trivial services such as adding 2
> numbers together - in my case, I need my SOAP server to be able to do
> something more complicated.
>
> The sort of complexity I need to build is something like
> http://www.webservicex.com/stockquote.asmx?WSDL
> When I query this service from suds, the code looks something like:
> >>> import suds
> >>> url = 'http://www.webservicex.com/stockquote.asmx?WSDL'
> >>> client = suds.client.Client(url)
> >>> print client
>
> Suds ( https://fedorahosted.org/suds/ )  version: 0.4 GA  build:
> R699-20100913
>
> Service ( StockQuote ) tns="http://www.webserviceX.NET/";
>Prefixes (0)
>Ports (2):
>   (StockQuoteSoap)
>  Methods (1):
> GetQuote(xs:string symbol, )
>  Types (0):
>   (StockQuoteSoap12)
>  Methods (1):
> GetQuote(xs:string symbol, )
>  Types (0):
>
>
> >>> client.service.GetQuote('IBM')
> IBM166.989/2/20114:00pm0.00N/AN/AN/A200199.4B166.980.00%125.39
> - 185.6312.31513.56International
> Bus
> >>>
>
>
> I figure my web2py controller code to do this would look something like:
>
> from gluon.tools import Service
> service = Service(globals())
>
> @service.soap('GetQuote', returns={SOMETHING_HERE}, args={'symbol':str})
> def stock_quote(stock):
> "Return stock quote info - everything is hardcoded..."
> symbol = "IBM"
> last = 166.98
> date = '9/2/2011'
> quote_time = '4:00pm'
> change = 0.00
> #...
> return SOMETHING_HERE
>
> def call():
> return service()
>
>
> I'm trying to work out what the 2 SOMETHING_HERE pieces should look like in
> the above code.
>
> Could someone please point me in the right direction?
>
> Thanks in advance
>
> Dave M.
>


[web2py] Re: contrib module for cache stored in redis

2011-09-07 Thread Massimo Di Pierro
You can create a global object in the module and use a flag in the
global object (connected=True or False).

On Sep 7, 3:35 pm, Niphlod  wrote:
> Hum, best way to test it ?
> start 2 web2py instances with a cached query, let's say, and hit them
> with ab ?
> In theory the connection object to redis is itself a connection pool,
> so there won't be problems.
>
> I always defined cache (and see it defined) in models, where it gets
> executed on every request is there a way to avoid class __init__
> method (where the connection is built) on every request ?


[web2py] Re: List widget issue when invalid form

2011-09-07 Thread Massimo Di Pierro
I think it is a bug. Please check this is not already fixed in trunk,
if not please open a ticket. thanks for the work of tracking down the
problem.

On Sep 7, 4:58 pm, rdmurphy  wrote:
> Hi Massimo and web2py team,
> Just following up on this issue. If you guys agree it's a bug I can
> open a ticket for it.
>
> Thanks
> Ryan
>
> On Aug 29, 4:03 pm, rdmurphy  wrote:
>
>
>
>
>
>
>
> > Hi everyone,
> > Since it's my first post, I'd like to first say great framework to the
> > whole team. I'm really enjoying using it.
>
> > I think I've found a small bug in the handling of list fields in an
> > invalid form.
> > I have a list:string field and another required field.
>
> > When there is only 1 input field and value for the list field and the
> > submitted form is invalid (the other field is invalid), the returned
> > error form splits my 1 value up into individual characters since it
> > assumes the request.var is an array.
>
> > I've traced it down to sqlhtml in this section around row 1090:
>
> > if hasattr(field, 'widget') and field.widget and fieldname in
> > request_vars:
> >     if fieldname in self.vars:
> >         value = self.vars[fieldname]
> > etc
> > widget = field.widget(field, value)
>
> > Then ListWidget exects to be getting an array as the value.
>
> > So might need a check on the value type if using self.vars, like:
> > if field.type.startswith('list:') and isinstance(value, str):
> >     value = [value]
>
> > Thanks
> > Ryan


[web2py] web2py received 2011 BOSSIE Award by InfoWorld.com

2011-09-07 Thread wwwgong
Congratulations!

more details from here:
http://www.infoworld.com/d/open-source-software/bossie-awards-2011-the-best-open-source-application-development-software-171759-0¤t=10&last=1#slideshowTop


[web2py] Re: web2py received 2011 BOSSIE Award by InfoWorld.com

2011-09-07 Thread Anthony
Congratulations!

On Wednesday, September 7, 2011 10:59:46 PM UTC-4, wwwgong wrote:
>
> Congratulations! 
>
> more details from here: 
>
> http://www.infoworld.com/d/open-source-software/bossie-awards-2011-the-best-open-source-application-development-software-171759-0¤t=10&last=1#slideshowTop
>  
>


Re: [web2py] web2py received 2011 BOSSIE Award by InfoWorld.com

2011-09-07 Thread appydev
[?]


2011/9/7 wwwgong 

> Congratulations!
>
> more details from here:
>
> http://www.infoworld.com/d/open-source-software/bossie-awards-2011-the-best-open-source-application-development-software-171759-0¤t=10&last=1#slideshowTop
>
<<330.gif>>

Re: [web2py] using twitter bootstratp in base.css

2011-09-07 Thread Anthony
On Wednesday, September 7, 2011 9:46:31 PM UTC-4, rochacbruno wrote:
>
> I have my jquery-ui + html5boilerplate + 960.gs + jquerymobile bootstrap 
> app made on top of welcome.
>

Have you made that available somewhere? 


Re: [web2py] Re: appadmin and db.Table definition

2011-09-07 Thread Anthony
Though the book also describes directly instantiating Table when creating a 
dummy table for inheritence purposes 
(http://web2py.com/book/default/chapter/06#Table-Inheritance), which is how 
it is being used in this case.

On Wednesday, September 7, 2011 9:55:06 PM UTC-4, rochacbruno wrote:
>
> Also, from book.http://web2py.com/book/default/chapter/06#Dependencies 
>
> *Table* represents a database table. You do not directly instantiate 
> Table; instead,DAL.define_table instantiates it. 
>
> 1.
>
> db.define_table('mytable', Field 
> ('myfield')
>
>
>
>

[web2py] Re: Date Picker Widget

2011-09-07 Thread Rahul
This set of widgets is something I needed a lot for my apps. Thanks
these look very good.

On Sep 7, 6:06 pm, Christopher Steel  wrote:
> +1 excellent look annet. Has anyone checked this in IE?
>
> I really like it, a lot
>
> Chris