[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Annet
Congratulations to all!

Should be 100% backward compatible. If you run into any issue let us know 
> ASAP.
>

It's not a backward compatibility issue but after updating from 2.0.1 to 
2.0.2 the admin's flash messages no longer show up.

Kind regards,

Annet

-- 





Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-30 Thread Anthony
Replace the single quotes with double quotes inside the jQuery():

onClick='window.location="{{=URL('default', 'record_config') + '/'}}" +
 jQuery("input[name=name_text_field]").val();'

The value will be available as request.args(0) in the record_config() 
function.

Anthony

On Thursday, August 30, 2012 2:41:40 AM UTC-4, Amit wrote:
>
> Hi Anthony, 
> I used the code which you have suggested but it's not working at all, it 
> is not calling record_config() function of controller.
>
> onClick='window.location="{{=URL('default', 'record_config') + '/'}}" 
> + jQuery('input[name=name_text_field]').val();'>
>
>
> second point is if the above approach is successful then how would I 
> retrieve the value in controller side:
>
> def record_config():
>  print 'inside record_config' 
>  print request.input['name']
>
> Do I need to use Input list to retrieve the value? OR is there any other 
> way to retrieve?
>
>
> On Wednesday, 29 August 2012 19:50:15 UTC+5:30, Anthony wrote:
>>
>> >> onclick = 'window.location="{{=URL('default', 'record_config', 
>>> args=[name_text_field.value])}}";'>
>>>
>>
>> You cannot refer to name_text_field the way you have. Everything inside 
>> {{..}} is Python and must be available on the server before the HTML is 
>> rendered and sent to the browser. The input field value is available on the 
>> client side and must be retrieved via Javascript. You could do:
>>
>> onclick='window.location="{{=URL('default', 'record_config') + '/'}}" + 
>> jQuery('input[name=name_text_field]').val();'
>>
>> Anthony 
>>
>

-- 





[web2py] Re: field attributes outside field definition.

2012-08-30 Thread Annet
Massimo and Anthony,

Thanks for your replies.


Kind regards,

Annet

-- 





[web2py] Re: user login tables

2012-08-30 Thread Anthony
On Thursday, August 30, 2012 2:46:40 AM UTC-4, Yebach wrote:
>
> I don't understand what you mean with how is the user loging out? I used 
> the {{='auth' in globals() and auth.navbar(separators=(' ',' | ',''))}}
>

Does that mean the user is logging out by clicking the "Logout" link in the 
navbar generated by auth.navbar()? 

-- 





Re: [web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Johann Spies
Thank you again to all the developers for your hard work enabling us to
work with a product that is a pleasure to work with.
Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 





Re: [web2py] web2py 2.0.2 is out

2012-08-30 Thread Alec Taylor
Thank you kindly!

On Thu, Aug 30, 2012 at 1:41 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> After 5 months. It is done. This is the most waited and the most
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is
> considerably better than 1.99.7. It adds lot of new features and improves
> many existing ones:
>
> - 57,000 new lines of code and closed 279 issues since 1.99.7.
> - Retrieving data from DB should be faster, in particular
> select(cacheable=True)
> - Has a new scheduler, a built-in wiki, new language and pluralization
> system, better markmin with oembed support and better scaffolding app,
> increased security.
> - Lots of experimental features including GIS support, mongodb support,
> built-in auth.wiki(), and more.
>
> Should be 100% backward compatible. If you run into any issue let us know
> ASAP.
>
> I personally want to thank the major contributors to this release (in
> alphabetic order)
> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg, Jonathan,
> Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod, Patrick,
> Vladyslav,
> They spend many nights testing, coding, debugging at a very fast pace.
>
> Many many people have contributed.
>
> If your contribution has not been properly acknowledged please let us know
> ASAP. It is probably an oversight.
>
>
> Massimo
>
>
> Detailed changelog
> ===
>
> ## 2.00.2
>
> ### DAL Improvements
>
> - Support for DAL(lazy_tables=True) and db.define_table(on_define=lambda
> table:), thanks Jonathan
> - db(...).select(cacheable=True) make select 30% faster
> - db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
> - db(...).count(cache=(cache.ram,3600)) now supported
> - MongoDB support in DAL (experimental), thanks Mark Breedveld
> - geodal and spatialite, thanks Denes and Fran (experimental)
> - db.mytable._before_insert, _after_insert, _before_update, _after_update,
> _before_delete. _after_delete (list of callbacks)
> - db(...).update_naive(...) same as update but ignores
> table._before_update and table._after_update
> - DAL BIGINT support and DAL(...,bigint_id=True)
> - IS_IN_DB(..., distinct=True)
> - new syntax: db.mytable.insert(myuploadfield=open()), thank you
> Iceberg
> - db(...).select(db.mytable.myfield.count(distinct=True))
> - db(db.a)._update(name=db(db.b.a==db.a.id).nested_select(db.b.id))
> - db.mytable.myfield.filter_in, filter_out
> - db.mytable._enable_record_versioning(db) adds versioning to this table
> - teradata adapter, thanks Andrew Willimott
> - experimental Sybase Adapter
> - added db.table.field.avg()
> - Support for Google App Engine projections, thanks Christian
> - Field(... 'upload', default=path) now accepts a path to a local file as
> default value, if user does not upload a file. Relative path looks inside
> current application folder, thanks Marin
> - executesql(...,fields=,columns=) allows parsing of results in Rows,
> thanks Anthony
>
> ### Auth improvements
>
> - auth.enable_record_versioning(db)  adds full versioning to all tables
> - @auth.requires_login(otherwise=URL(...))
> - auth supports salt and compatible with third party data, thanks Dave
> Stoll
> - CRYPT now defaults to pbkdf2(1000,20,sha1)
> - Built-in wiki with menu, tags, search, media, permissions. def index:
> return auth.wiki()
> - auth.settings.everybody_group_id
> - allow storage of uploads on any PyFileSystem (including amazon)
>
> ### Form improvements
>
> - FORM.confirm('Are you sure?',{'Back':URL(...)})
> - SQLFORM.smartdictform(dict)
> - form.add_button(value,link)
> - SQLFORM.grid(groupby='...')
> - fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
> - more export options in SQLFORM.grid and SQLFORM.smartgrid (html, xml,
> csv, ...)
>
> ### Admin improvements
>
> - new admin pages: manage_students, bulk_regsiter, and progress reports
> - increased security in admin against CSRF
> - experimental Git integration
> - experimental OpenShift deployment
> - multi-language pluralization engine
> - ace text web editor in admin
> - Ukrainian translations, thanks Vladyslav Kozlovskyy
> - Romanian translation for welcome, thanks ionel
> - support for mercurial 2.6, thanks Vlad
>
> ### Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
>
> - web2py.py -K myapp -X starts the myapp scheduler alongside the webserver
> - tasks are marked EXPIRED (if stop_time passed)
> - functions with no result don't end up in scheduler_run
> - more options: web2py.py -E -b -L
> - scheduler can now handle 10k tasks with 20 concurrent workers and with
> no issues
> - new params:
> tasks can be found in the environment (no need to define the tasks
> parameter)
> max_empty_runs kills the workers automatically if no new tasks are
> found in queue (nice for "spikes" of processing power)
> discard_results to completely discard the results (if you don't need
> the output of the task)
> utc_time enables datetime calcula

Re: [web2py] Removing labels from forms

2012-08-30 Thread Alec Taylor
No placeholders are added to the HTML.

Here is the output:  http://pastie.org/4615036

On Thu, Aug 30, 2012 at 3:02 PM, Anthony  wrote:

> Can you explain more about what doesn't work? Does the HTML source code
> end up not as expected, or is the browser just not rendering it as expected?
>
>
> On Thursday, August 30, 2012 12:01:18 AM UTC-4, Alec Taylor wrote:
>
>> Thanks, but unfortunately that didn't work.
>>
>> {{
>> form=auth.register()
>> my_extra_element = CAT('Agree to ', A('terms & conditions', 
>> _href="/legal/agreement/")), 
>> INPUT(_name='agree',value=True**,_type='checkbox')
>> form[0].insert(-1,my_extra_**element)for label in form.elements('label'):
>> label["_style"] = "display:none;"pass
>>
>> placeholders = {
>>"email": "enter a valid email address",
>>"password": "be secure",
>>"post code": "3434343-3434383",
>>"validator": "captcha"}for input in form.elements("input[type='**text']"):
>> input["_placeholder"] = placeholders.get(input["_name"**], "")pass
>> =form}}
>>
>>
>> (this is in my view; and yes, I should move it to a controller, but want
>> to get it working first)
>>
>> On Thu, Aug 30, 2012 at 4:11 AM, Bruno Rocha  wrote:
>> > placeholders = {
>> > "name": "fill in your name",
>> >"email": "enter a valid email address"
>> > }
>> >
>> > for input in form.elements("input[type='**text']"):
>> > input["_placeholder"] = placeholders.get(input["_name"**], "")
>> >
>> >
>> > On Wed, Aug 29, 2012 at 3:07 PM, Alec Taylor 
>> wrote:
>> >>
>> >> Thanks, also would there be a loop I can add before that to set the
>> >> placeholder of each input?
>> >>
>> >> On Thu, Aug 30, 2012 at 3:58 AM, Bruno Rocha 
>>
>> >> wrote:
>> >> > for label in form.elements('label'):
>> >> > label["_style"] = "display:none;"
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > On Wed, Aug 29, 2012 at 2:47 PM, Alec Taylor 
>>
>> >> > wrote:
>> >> >>
>> >> >> How do I remove labels from forms?
>> >> >>
>> >> >> I want to use placeholders instead...
>> >> >>
>> >> >> (this is for the auth.register form)
>> >> >>
>> >> >> Thanks for all suggestions,
>> >> >>
>> >> >> Alec Taylor
>> >> >>
>> >> >> --
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> >
>> >> >
>> >> >
>> >>
>> >> --
>> >>
>> >>
>> >>
>> >
>> >
>> > --
>> >
>> >
>> >
>>
>>  --
>
>
>
>

-- 





[web2py] upgrade ubuntu to 12.04.1

2012-08-30 Thread andrej burja
hi

i installed web2py with script found here. currently i have ubuntu 10.04. 
has anybody upgraded ubuntu from 10.04 to 12.04.1? are there any problems 
(regarding web2py or postgres 8.4)? should i upgrade or wait some time?

andrej

-- 





[web2py] DAL object has no attribute issue

2012-08-30 Thread Annet
This issue has been reported in this thread:

https://groups.google.com/forum/#!searchin/web2py/IS_NOT_IN_DB/web2py/YNfreBJ2LYo/rEMOTVibHDEJ

... has it been solved, yet?

I defined the following table:

db.define_table('nodeKeyword',
Field('nodeID','reference 
node',default='',requires=[IS_IN_DB(db,'node.id','%(id)s',zero=T('select a 
value')),IS_NOT_IN_DB(db(db.nodeKeyword.word==request.vars.word),db.nodeKeyword.nodeID,error_message=T('combination
 
node and keyword already in 
database'))],ondelete='CASCADE',notnull=True,writable=False,readable=False),

Field('word',length=128,default='',requires=[IS_IN_DB(db,'keyword.word','%(word)s',zero=T('select
 
a 
value'))],ondelete='RESTRICT',notnull=True,widget=SQLFORM.widgets.options.widget,label='Trefwoord
 
* '),
migrate='nodeKeyword.table')

... which results in the following error:

Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/web2py/gluon/restricted.py", line 
209, in restricted
exec ccode in environment
  File 
"/Library/Python/2.6/site-packages/web2py/applications/init/models/10_tables_db.py"
 , line 
134, in 
Field('nodeID','reference 
node',default='',requires=[IS_IN_DB(db,'node.id','%(id)s',zero=T('select a 
value')),IS_NOT_IN_DB(db(db.nodeKeyword.word==request.vars.word),db.nodeKeyword.nodeID,error_message=T('combination
 node and keyword already in 
database'))],ondelete='CASCADE',notnull=True,writable=False,readable=False),
  File "/Library/Python/2.6/site-packages/web2py/gluon/dal.py", line 7099, in 
__getattr__
return ogetattr(self, key)
AttributeError: 'DAL' object has no attribute 'nodeKeyword'

When I move the requires attribute outside the table definition:

 db.nodeKeyword.nodeID.requires=[IS_IN_DB(db,'node.id','%(id)s',zero='select a 
value'),IS_NOT_IN_DB(db(db.nodeKeyword.word==request.vars.word),db.nodeKeyword.nodeID,error_message='combination
 node and keyword already in database')]

... the problem is solved, however, this is not compatible with lazy_tables, is 
it?

Kind regards,

Annet.


-- 





[web2py] How to use the new cache-options with SQLFORM.grid?

2012-08-30 Thread Johann Spies
db(...).select(cacheable=True) make select 30% faster
db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
db(...).count(cache=(cache.ram,3600)) now supported

Is there a way to use these options with SQLFORM.grid/smartgrid?  I see no
reference to those options in gluon/sqlhtml.py.

Regards
Johann

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

-- 





[web2py] Re: web editor problems with 2.0.2

2012-08-30 Thread Manuele Pesenti

Il 30/08/2012 10:00, Manuele Pesenti ha scritto:

Hi!
I've just downloaded the new 2.0.2 stable release but it seams there 
are some problems when I try to edit files from the web text editor 
integrated. Anybody noticed similar problems?


uhm... ok the problems seams limited to chromium web browser...



in attachment a screenshot of what I see when I try to modify the mean 
model file db.py


thank you in advance
cheers

M.


--





[web2py] 'Auth' object has no attribute 'use_username'

2012-08-30 Thread Annet
In web2py 2.0.2 in an application in which I commented out:

# auth.define_tables(username=False, signature=False)

I defined a new table, after saving db.py, when I click the database 
administration button I get the following error:


Version  web2py™ (2, 0, 2, datetime.datetime(2012, 8, 30, 4, 8, 18), 
'stable')  Python Python 2.6.1: /usr/bin/python2.6  Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.

Traceback (most recent call last):
  File "/Library/Python/2.6/site-packages/web2py/gluon/restricted.py", line 
209, in restricted
exec ccode in environment
  File 
"/Library/Python/2.6/site-packages/web2py/applications/init/views/appadmin.html"
 , line 53, 
in 
{{=form}}
  File "/Library/Python/2.6/site-packages/web2py/gluon/tools.py", line 1260, in 
navbar
if self.use_username and \
AttributeError: 'Auth' object has no attribute 'use_username'

 Error snapshot [image: help]  

('Auth' object has no attribute 
'use_username') 

inspect attributes 
 Frames 
   
   -  
   
   *File /Library/Python/2.6/site-packages/web2py/gluon/restricted.py in 
   restricted at line 209* code arguments variables 
-  
   
   *File 
   
/Library/Python/2.6/site-packages/web2py/applications/init/views/appadmin.html 
   in  at line 53* code arguments variables 
-  
   
   *File /Library/Python/2.6/site-packages/web2py/gluon/tools.py in navbar 
   at line 1260* code arguments variables 
Function argument list 
   
   (self=, prefix='Welcome ', 
   action='/init/default/user', separators=(' [ ', ' | ', ' ] '), 
   user_identifier= at 0x159e2170>, 
   referrer_actions= at 0x159e2170>)
Code listing 
   
   1255.
   1256.
   1257.
   1258.
   1259.
   1260.
   
   1261.
   1262.
   1263.
   1264.
   
   bar = SPAN(s1, login, s3, _class='auth_navbar')
   
   if not 'register' in self.settings.actions_disabled:
   bar.insert(-1, s2)
   bar.insert(-1, register)
   if self.use_username and \
   
   not 'retrieve_username' in 
self.settings.actions_disabled:
   bar.insert(-1, s2)
   bar.insert(-1, retrieve_username)
   if not 'request_reset_password' in 
self.settings.actions_disabled:
   
Variables  self.use_username undefined  self   self.settings.actions_disabled []  self.settings 
   

Kind regards,

Annet

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Liam
Thanks

On Thursday, August 30, 2012 5:41:34 AM UTC+2, Massimo Di Pierro wrote:
>
> After 5 months. It is done. This is the most waited and the most 
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is 
> considerably better than 1.99.7. It adds lot of new features and improves 
> many existing ones:
>
> - 57,000 new lines of code and closed 279 issues since 1.99.7.
> - Retrieving data from DB should be faster, in particular 
> select(cacheable=True)
> - Has a new scheduler, a built-in wiki, new language and pluralization 
> system, better markmin with oembed support and better scaffolding app, 
> increased security.
> - Lots of experimental features including GIS support, mongodb support, 
> built-in auth.wiki(), and more.
>
> Should be 100% backward compatible. If you run into any issue let us know 
> ASAP.
>
> I personally want to thank the major contributors to this release (in 
> alphabetic order)
> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg, Jonathan, 
> Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod, Patrick, 
> Vladyslav, 
> They spend many nights testing, coding, debugging at a very fast pace.
>
> Many many people have contributed.
>
> If your contribution has not been properly acknowledged please let us know 
> ASAP. It is probably an oversight.
>
>
> Massimo
>
>
> Detailed changelog
> ===
>
> ## 2.00.2
>
> ### DAL Improvements
>
> - Support for DAL(lazy_tables=True) and db.define_table(on_define=lambda 
> table:), thanks Jonathan
> - db(...).select(cacheable=True) make select 30% faster
> - db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
> - db(...).count(cache=(cache.ram,3600)) now supported
> - MongoDB support in DAL (experimental), thanks Mark Breedveld
> - geodal and spatialite, thanks Denes and Fran (experimental)
> - db.mytable._before_insert, _after_insert, _before_update, _after_update, 
> _before_delete. _after_delete (list of callbacks)
> - db(...).update_naive(...) same as update but ignores 
> table._before_update and table._after_update
> - DAL BIGINT support and DAL(...,bigint_id=True)
> - IS_IN_DB(..., distinct=True)
> - new syntax: db.mytable.insert(myuploadfield=open()), thank you 
> Iceberg
> - db(...).select(db.mytable.myfield.count(distinct=True))
> - db(db.a)._update(name=db(db.b.a==db.a.id).nested_select(db.b.id))
> - db.mytable.myfield.filter_in, filter_out
> - db.mytable._enable_record_versioning(db) adds versioning to this table
> - teradata adapter, thanks Andrew Willimott
> - experimental Sybase Adapter
> - added db.table.field.avg()
> - Support for Google App Engine projections, thanks Christian
> - Field(... 'upload', default=path) now accepts a path to a local file as 
> default value, if user does not upload a file. Relative path looks inside 
> current application folder, thanks Marin
> - executesql(...,fields=,columns=) allows parsing of results in Rows, 
> thanks Anthony
>
> ### Auth improvements
>
> - auth.enable_record_versioning(db)  adds full versioning to all tables
> - @auth.requires_login(otherwise=URL(...))
> - auth supports salt and compatible with third party data, thanks Dave 
> Stoll
> - CRYPT now defaults to pbkdf2(1000,20,sha1)
> - Built-in wiki with menu, tags, search, media, permissions. def index: 
> return auth.wiki()
> - auth.settings.everybody_group_id
> - allow storage of uploads on any PyFileSystem (including amazon)
>
> ### Form improvements
>
> - FORM.confirm('Are you sure?',{'Back':URL(...)})
> - SQLFORM.smartdictform(dict)
> - form.add_button(value,link)
> - SQLFORM.grid(groupby='...')
> - fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
> - more export options in SQLFORM.grid and SQLFORM.smartgrid (html, xml, 
> csv, ...)
>
> ### Admin improvements
>
> - new admin pages: manage_students, bulk_regsiter, and progress reports
> - increased security in admin against CSRF
> - experimental Git integration
> - experimental OpenShift deployment
> - multi-language pluralization engine 
> - ace text web editor in admin
> - Ukrainian translations, thanks Vladyslav Kozlovskyy
> - Romanian translation for welcome, thanks ionel
> - support for mercurial 2.6, thanks Vlad
>
> ### Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
>
> - web2py.py -K myapp -X starts the myapp scheduler alongside the webserver
> - tasks are marked EXPIRED (if stop_time passed)
> - functions with no result don't end up in scheduler_run
> - more options: web2py.py -E -b -L
> - scheduler can now handle 10k tasks with 20 concurrent workers and with 
> no issues
> - new params:
> tasks can be found in the environment (no need to define the tasks 
> parameter)
> max_empty_runs kills the workers automatically if no new tasks are 
> found in queue (nice for "spikes" of processing power)
> discard_results to completely discard the results (if you don't need 
> the output of the task)
> utc_time enables datetime calcu

Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-30 Thread Amit
Still the same issue :(  , its not calling record_config() function...
how to check whether JQuery is supported or not? I have created my own
custom html page without mentioning {{extend 'layout.html'}} statement,
means simple html page withe labels and text fields, so do I need to add
some statement in my html file to support JQuery?

On Thu, Aug 30, 2012 at 12:40 PM, Anthony  wrote:

> Replace the single quotes with double quotes inside the jQuery():
>
> onClick='window.location="{{=URL('default', 'record_config') + '/'}}" +
>  jQuery("input[name=name_text_field]").val();'
>
> The value will be available as request.args(0) in the record_config()
> function.
>
> Anthony
>
>
> On Thursday, August 30, 2012 2:41:40 AM UTC-4, Amit wrote:
>>
>> Hi Anthony,
>> I used the code which you have suggested but it's not working at all, it
>> is not calling record_config() function of controller.
>>
>> >onClick='window.location="{{=**URL('default', 'record_config') + '/'}}"
>> + jQuery('input[name=name_text_**field]').val();'>
>>
>>
>> second point is if the above approach is successful then how would I
>> retrieve the value in controller side:
>>
>> def record_config():
>>  print 'inside record_config'
>>  print request.input['name']
>>
>> Do I need to use Input list to retrieve the value? OR is there any other
>> way to retrieve?
>>
>>
>> On Wednesday, 29 August 2012 19:50:15 UTC+5:30, Anthony wrote:
>>>
>>> >>> onclick = 'window.location="{{=URL('defa**ult', 'record_config',
 args=[name_text_field.value])}**}";'>

>>>
>>> You cannot refer to name_text_field the way you have. Everything inside
>>> {{..}} is Python and must be available on the server before the HTML is
>>> rendered and sent to the browser. The input field value is available on the
>>> client side and must be retrieved via Javascript. You could do:
>>>
>>> onclick='window.location="{{=**URL('default', 'record_config') + '/'}}"
>>> + jQuery('input[name=name_text_**field]').val();'
>>>
>>> Anthony
>>>
>>  --
>
>
>
>

-- 





[web2py] Re: How to use the new cache-options with SQLFORM.grid?

2012-08-30 Thread Niphlod
they are improvements to how data is retrieved from cache or having the 
records returned faster (cacheable=True should strip all the update_record, 
_table, etc.). SMARTGRID has nothing to do with those  

Il giorno giovedì 30 agosto 2012 10:20:30 UTC+2, Johann Spies ha scritto:
>
> db(...).select(cacheable=True) make select 30% faster
> db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
> db(...).count(cache=(cache.ram,3600)) now supported
>
> Is there a way to use these options with SQLFORM.grid/smartgrid?  I see no 
> reference to those options in gluon/sqlhtml.py.
>
> Regards
> Johann
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>

-- 





[web2py] Re: DAL object has no attribute issue

2012-08-30 Thread Niphlod
the problem is that your requirements need the table to be fully defined 
before applying the requirement itself.

The new on_define syntax should help with lazy tables, however, right now I 
can't test it.

Il giorno giovedì 30 agosto 2012 10:06:03 UTC+2, Annet ha scritto:
>
> This issue has been reported in this thread:
>
>
> https://groups.google.com/forum/#!searchin/web2py/IS_NOT_IN_DB/web2py/YNfreBJ2LYo/rEMOTVibHDEJ
>
> ... has it been solved, yet?
>
> I defined the following table:
>
> db.define_table('nodeKeyword',
> Field('nodeID','reference node',default='',requires=[IS_IN_DB(db,'
> node.id','%(id)s',zero=T('select a 
> value')),IS_NOT_IN_DB(db(db.nodeKeyword.word==request.vars.word),db.nodeKeyword.nodeID,error_message=T('combination
>  
> node and keyword already in 
> database'))],ondelete='CASCADE',notnull=True,writable=False,readable=False),
> 
> Field('word',length=128,default='',requires=[IS_IN_DB(db,'keyword.word','%(word)s',zero=T('select
>  
> a 
> value'))],ondelete='RESTRICT',notnull=True,widget=SQLFORM.widgets.options.widget,label='Trefwoord
>  
> * '),
> migrate='nodeKeyword.table')
>
> ... which results in the following error:
>
> Traceback (most recent call last):
>   File "/Library/Python/2.6/site-packages/web2py/gluon/restricted.py", line 
> 209, in restricted
> exec ccode in environment
>   File 
> "/Library/Python/2.6/site-packages/web2py/applications/init/models/10_tables_db.py"
>  , line 
> 134, in 
> Field('nodeID','reference 
> node',default='',requires=[IS_IN_DB(db,'node.id','%(id)s',zero=T('select a 
> value')),IS_NOT_IN_DB(db(db.nodeKeyword.word==request.vars.word),db.nodeKeyword.nodeID,error_message=T('combination
>  node and keyword already in 
> database'))],ondelete='CASCADE',notnull=True,writable=False,readable=False),
>   File "/Library/Python/2.6/site-packages/web2py/gluon/dal.py", line 7099, in 
> __getattr__
> return ogetattr(self, key)
> AttributeError: 'DAL' object has no attribute 'nodeKeyword'
>
> When I move the requires attribute outside the table definition:
>
>  db.nodeKeyword.nodeID.requires=[IS_IN_DB(db,'node.id','%(id)s',zero='select 
> a 
> value'),IS_NOT_IN_DB(db(db.nodeKeyword.word==request.vars.word),db.nodeKeyword.nodeID,error_message='combination
>  node and keyword already in database')]
>
> ... the problem is solved, however, this is not compatible with lazy_tables, 
> is it?
>
> Kind regards,
>
> Annet.
>
>
>

-- 





[web2py] Error creating a grid when no user is logged in

2012-08-30 Thread Liam
Hi all,

When creating a grid and no user is logged in, I get an AttributeError: 
'NoneType' object has no attribute 'user'.

This can be recreated using vanilla web2py 2.0.2:
$ python web2py.py -S welcome -M
...

In [1]: SQLFORM.grid(db.auth_user)
...
   1660 if (args != request.args and user_signature and \
   1661 not URL.verify(request,user_signature=
user_signature)) or \
-> 1662 (not session.auth.user and \
   1663  ('edit' in request.args or \
   1664   'create' in request.args or \

AttributeError: 'NoneType' object has no attribute 'user'

In [2]: from gluon import current

In [3]: current.session
Out[3]: 

I think that the grid function is using the wrong check to see if a user is 
logged in. The relevant line is
not session.auth.user

Perhaps it should be?
not session.auth

On another much less important note, I thought the correct Pythonic way to 
check for None is:
session.auth is None
;)

Cheers,
Liam

-- 





Re: [web2py] Re: routes.py and patterns with routes_app

2012-08-30 Thread peter
I got inside gluon. The conversion is done within regex_uri

I have found that 

http://127.0.0.1:8002/gallery
becomes
127.0.0.1:http://127.0.0.1:get /gallery

just before the conversion

http://localhost:8002/gallery
becomes
127.0.0.1:http://localhost:get /gallery

So Massimo was almost right the problem was putiing the get and post in 
upper case

routes_in = [('127\.0\.0\.1:http://.*?:(get|post) /$anything','/welcome')]

works

The answer to my challenge to get URLs with localhost to route to the admin 
app and URLs with 127.0.0.1 to route to the  welcome app

routes_in = [('.*://localhost:(get|post) /$anything','/admin'),
   ('.*://127\.0\.0\.1:(get|post) 
/$anything','/welcome')]

So presumably to map mydomain to myapp would be

routes_in = [('.*://mydomain:(get|post) 
/myapp/$anything','/myapp/$anything'),
  ('.*://mydomain:(get|post) 
/$anything','/myapp/$anything')]

or if using routes_app

routes_app=[('.*://mydomain:(get|post) /$anything','myapp'),


Peter

On Wednesday, 29 August 2012 19:15:03 UTC+1, peter wrote:
>
> Thanks for the suggestion Massimo
> It did not match with
>
> localhost or 127.0.0.1
>
> eg localhost:8002/gallery
>
> Peter
>
> On Wednesday, 29 August 2012 18:19:26 UTC+1, Massimo Di Pierro wrote:
>>
>> Are you trying to match the remote address as localhost? The problem is that 
>> it depends on what you browser puts in there. You can try:
>>
>> routes_in = [('127\.0\.0\.1:http://.*?:(GET|POST) /$anything','/welcome')]
>>
>>
>>
>>
>> On Wednesday, 29 August 2012 12:08:56 UTC-5, peter wrote:
>>>
>>> I tried
>>>
>>> routes_in = ((r' .*://localhost:.*',r'/welcome'),)
>>>
>>> and 
>>> routes_in = ((r' .*localhost.*',r'/welcome'),)
>>>
>>>
>>> neither match localhost urls so I am at a loss. I would like to know how 
>>> to match localhost.
>>>
>>> In the short run I want to do
>>>
>>>  domains={
>>>  'ukjazz.net':'british_jazz',
>>>  'www.ukjazz.net':'british_jazz',
>>>  'lindseymalin.com':'gallery',
>>>  'www.lindseymalin.com':'gallery'
>>> }
>>>
>>> with pattern matching rewrites. This is because I want to have a pattern 
>>> matching routes.py for british_jazz
>>>
>>> I am sure other people would like to do the equivalent of domains with 
>>> patterns
>>>
>>> Thanks
>>> Peter
>>>
>>> On Wednesday, 29 August 2012 16:21:12 UTC+1, Jonathan Lundell wrote:

 A little below that is the general structure of the incoming pattern.

 '[remote address]:[protocol]://[host]:[method] [path]'


 In the long run, what are you really trying to accomplish with your 
 routes? 



>>> On Wednesday, 29 August 2012 16:21:12 UTC+1, Jonathan Lundell wrote:

 On 29 Aug 2012, at 8:13 AM, peter  wrote:

 I am not sure what docs you are referring to Jonathan. The book gives 
 an example:

 "The general syntax for routes is more complex than the simple examples 
 we have seen so far. Here is a more general and representative example:

 1.
 2.
 3.
 4.

 routes_in = (
  ('140\.191\.\d+\.\d+:https://www.web2py.com:POST /(?P.*)\.php',
   '/test/default/index?vars=\g'),
 )

 "
 that seems to imply the URL is a string. It would be useful if one 
 could see the URL presented to routes_in.


 A little below that is the general structure of the incoming pattern.

 '[remote address]:[protocol]://[host]:[method] [path]'


 So I think you'd want something like: '.*://localhost:.* [path]


 Let me ask the second part of my initial post slightly revised.

 I would like, within routes_In to be able to route according to domain 
 name.

  

 So what would routes_in look like to route

  127.0.0.1:8002 to welcome, and

  localhost:8002 to admin

 In the long run, what are you really trying to accomplish with your 
 routes? 




-- 





Re: [web2py] How to use DAL with effective dated queries

2012-08-30 Thread Niphlod
I think the point here is retrieve only the record with the same employeeid 
that has the max date. if so, why can't we rewrite that ugly query as (a 
much more performant)

SELECT  
EmployeeID, 
MAX(effdt) 
FROM person 
WHERE (effdt < now) 
GROUP BY EmployeeID

? it's because you need the name ?

Il giorno giovedì 30 agosto 2012 08:32:21 UTC+2, Johann Spies ha scritto:
>
> Hallo Remco,
>
>
> Try this:
> import datetime
> now = datetime.datetime.now()
> query = db.person.effdt > now
> data = SQLFORM.grid(query)
>
> Regards
> Johann
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>

-- 





Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-30 Thread Amit
Anthony,
I observe one more thing, as I have launched record Info page from other
page using below statement:




So upon clicking on button , it is launching record_config page , first it
will call record_config() function and I am passing record_id to fetch the
data about the record and display on the record_config page , so
record_config page will display all data about the record( for e.g
record_id, record_name etc...)

Now what is my observation is : the URL of record_config page, it is
showing like:

http://127.0.0.1:8000/record_App/default/record_config/45326699

where the number (45326699) indicates the record_id.

One test i have done :
I have written one javascript function with alert message and calling from
onclick of the save button on the record_config page, but it is not
invoking the javascript function so I am suspecting the above URL is
different from record_config page, may be some temporary page is getting
created with these values.

what I understood is this page is not record_config page that's why it is
not calling onclick of the button , hence not calling javascript, JQuery
stuffs also.

Please provide your inputs on this.

Regards,
Amit

On Thu, Aug 30, 2012 at 2:11 PM, Amit  wrote:

> Still the same issue :(  , its not calling record_config() function...
> how to check whether JQuery is supported or not? I have created my own
> custom html page without mentioning {{extend 'layout.html'}} statement,
> means simple html page withe labels and text fields, so do I need to add
> some statement in my html file to support JQuery?
>
>
> On Thu, Aug 30, 2012 at 12:40 PM, Anthony  wrote:
>
>> Replace the single quotes with double quotes inside the jQuery():
>>
>> onClick='window.location="{{=URL('default', 'record_config') + '/'}}" +
>>  jQuery("input[name=name_text_field]").val();'
>>
>> The value will be available as request.args(0) in the record_config()
>> function.
>>
>> Anthony
>>
>>
>> On Thursday, August 30, 2012 2:41:40 AM UTC-4, Amit wrote:
>>>
>>> Hi Anthony,
>>> I used the code which you have suggested but it's not working at all, it
>>> is not calling record_config() function of controller.
>>>
>>> >>onClick='window.location="{{=**URL('default', 'record_config') + '/'}}"
>>> + jQuery('input[name=name_text_**field]').val();'>
>>>
>>>
>>> second point is if the above approach is successful then how would I
>>> retrieve the value in controller side:
>>>
>>> def record_config():
>>>  print 'inside record_config'
>>>  print request.input['name']
>>>
>>> Do I need to use Input list to retrieve the value? OR is there any other
>>> way to retrieve?
>>>
>>>
>>> On Wednesday, 29 August 2012 19:50:15 UTC+5:30, Anthony wrote:

   onclick = 'window.location="{{=URL('defa**ult', 'record_config',
> args=[name_text_field.value])}**}";'>
>

 You cannot refer to name_text_field the way you have. Everything inside
 {{..}} is Python and must be available on the server before the HTML is
 rendered and sent to the browser. The input field value is available on the
 client side and must be retrieved via Javascript. You could do:

 onclick='window.location="{{=**URL('default', 'record_config') + '/'}}"
 + jQuery('input[name=name_text_**field]').val();'

 Anthony

>>>  --
>>
>>
>>
>>
>
>

-- 





[web2py] Internal Error clicking on the "mailing list" link on the official support page

2012-08-30 Thread Nico Zanferrari
Hello,

I've found that on the official support web page (
http://web2py.com/examples/default/support) if you click on the first link 
(= *mailing list* , that points to 
http://web2py.com/examples/default/usergroups ) you always get a Internal 
Error.

Nico

-- 





[web2py] Re: Playing around with list/tuples of images on a basic form .... ( educational purpose)

2012-08-30 Thread villas
That's great Don,  I'm glad it helped.
And we are all celebrating today with the new Web2py release.  
Programming is definitely getting more exciting these days!


On Thursday, August 30, 2012 2:29:37 AM UTC+1, Don_X wrote:
>
> Villas My friend !
>
> this is an eureka moment for me !  what you showed me there helped me 
> a lot ! it actually solved my problem !
>
> I just had to tweak the user_sex set defined in the model  the following 
> way :
>
> user_sex = {'male':IMG(_src=URL('static','images/male_thumb.png')),
> 'female':IMG(_src=URL('static','images/female_thumb.png')),
>}
>
> And .. bingo .. it worked !  it is a list of 2 pics ( 2 symbols in 
> this case )  and the user needs to choose one of them !
>
> the images finally showed up in the view !
>
> It worked !!! hehehehe   :) :) :)
>
> thanks a million 
>
> Web2py is great !! .. I love it ...
>
>

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Marek Mollin
Hmmm...
nohup should do similar thing...
nohup python web2py.py -K appname

will make it a background task on linux

W dniu czwartek, 30 sierpnia 2012 07:23:29 UTC+2 użytkownik Michael Toomim 
napisał:
>
> I'm really excited about the new scheduler -X option.
>
> What do -E -b -L do? I don't see them in --help or in the widget.py code.
>
> On Wednesday, August 29, 2012 10:17:48 PM UTC-7, Michael Toomim wrote:
>>
>> Wow, this is cool!
>>
>> But I'm hitting a bug in rewrite_on_error: 
>> http://code.google.com/p/web2py/issues/detail?id=964
>>
>

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Marek Mollin
Big work.
We are all really thankful.

Especially lazy_tables and triggers + audit !

W dniu czwartek, 30 sierpnia 2012 05:41:34 UTC+2 użytkownik Massimo Di 
Pierro napisał:
>
> After 5 months. It is done. This is the most waited and the most 
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is 
> considerably better than 1.99.7. It adds lot of new features and improves 
> many existing ones:
>
> - 57,000 new lines of code and closed 279 issues since 1.99.7.
> - Retrieving data from DB should be faster, in particular 
> select(cacheable=True)
> - Has a new scheduler, a built-in wiki, new language and pluralization 
> system, better markmin with oembed support and better scaffolding app, 
> increased security.
> - Lots of experimental features including GIS support, mongodb support, 
> built-in auth.wiki(), and more.
>
> Should be 100% backward compatible. If you run into any issue let us know 
> ASAP.
>
> I personally want to thank the major contributors to this release (in 
> alphabetic order)
> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg, Jonathan, 
> Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod, Patrick, 
> Vladyslav, 
> They spend many nights testing, coding, debugging at a very fast pace.
>
> Many many people have contributed.
>
> If your contribution has not been properly acknowledged please let us know 
> ASAP. It is probably an oversight.
>
>
> Massimo
>
>
> Detailed changelog
> ===
>
> ## 2.00.2
>
> ### DAL Improvements
>
> - Support for DAL(lazy_tables=True) and db.define_table(on_define=lambda 
> table:), thanks Jonathan
> - db(...).select(cacheable=True) make select 30% faster
> - db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
> - db(...).count(cache=(cache.ram,3600)) now supported
> - MongoDB support in DAL (experimental), thanks Mark Breedveld
> - geodal and spatialite, thanks Denes and Fran (experimental)
> - db.mytable._before_insert, _after_insert, _before_update, _after_update, 
> _before_delete. _after_delete (list of callbacks)
> - db(...).update_naive(...) same as update but ignores 
> table._before_update and table._after_update
> - DAL BIGINT support and DAL(...,bigint_id=True)
> - IS_IN_DB(..., distinct=True)
> - new syntax: db.mytable.insert(myuploadfield=open()), thank you 
> Iceberg
> - db(...).select(db.mytable.myfield.count(distinct=True))
> - db(db.a)._update(name=db(db.b.a==db.a.id).nested_select(db.b.id))
> - db.mytable.myfield.filter_in, filter_out
> - db.mytable._enable_record_versioning(db) adds versioning to this table
> - teradata adapter, thanks Andrew Willimott
> - experimental Sybase Adapter
> - added db.table.field.avg()
> - Support for Google App Engine projections, thanks Christian
> - Field(... 'upload', default=path) now accepts a path to a local file as 
> default value, if user does not upload a file. Relative path looks inside 
> current application folder, thanks Marin
> - executesql(...,fields=,columns=) allows parsing of results in Rows, 
> thanks Anthony
>
> ### Auth improvements
>
> - auth.enable_record_versioning(db)  adds full versioning to all tables
> - @auth.requires_login(otherwise=URL(...))
> - auth supports salt and compatible with third party data, thanks Dave 
> Stoll
> - CRYPT now defaults to pbkdf2(1000,20,sha1)
> - Built-in wiki with menu, tags, search, media, permissions. def index: 
> return auth.wiki()
> - auth.settings.everybody_group_id
> - allow storage of uploads on any PyFileSystem (including amazon)
>
> ### Form improvements
>
> - FORM.confirm('Are you sure?',{'Back':URL(...)})
> - SQLFORM.smartdictform(dict)
> - form.add_button(value,link)
> - SQLFORM.grid(groupby='...')
> - fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
> - more export options in SQLFORM.grid and SQLFORM.smartgrid (html, xml, 
> csv, ...)
>
> ### Admin improvements
>
> - new admin pages: manage_students, bulk_regsiter, and progress reports
> - increased security in admin against CSRF
> - experimental Git integration
> - experimental OpenShift deployment
> - multi-language pluralization engine 
> - ace text web editor in admin
> - Ukrainian translations, thanks Vladyslav Kozlovskyy
> - Romanian translation for welcome, thanks ionel
> - support for mercurial 2.6, thanks Vlad
>
> ### Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
>
> - web2py.py -K myapp -X starts the myapp scheduler alongside the webserver
> - tasks are marked EXPIRED (if stop_time passed)
> - functions with no result don't end up in scheduler_run
> - more options: web2py.py -E -b -L
> - scheduler can now handle 10k tasks with 20 concurrent workers and with 
> no issues
> - new params:
> tasks can be found in the environment (no need to define the tasks 
> parameter)
> max_empty_runs kills the workers automatically if no new tasks are 
> found in queue (nice for "spikes" of processing power)
> discard_results to completely discard t

[web2py] Re: How to use the new cache-options with SQLFORM.grid?

2012-08-30 Thread Johann Spies
I am afraid I do not understand you reasoning:

I can do 

rows = db(db.sometable).select(
cacheable=True, cache = (ram.cache,3600))
data = SQLTABLE(rows)

or I can do 

query = db.sometable.id>0
data = SQLFORM.grid(query)

or

data = SQLFORM.smartgrid(db.sometable)

and how do I use those improvements in the latter 2 cases.  That is what I 
have asked in my first email.  

So what do you mean that it has nothing to do with grid/smartgrid where 
both of them run queries?

Regards
Johann



>

-- 





[web2py] Re: Ckeditor(plugin) using the LOAD (....., ajax = True)

2012-08-30 Thread simon
I have not used the plugin but had some issues with ckeditor in a web2py 
component. This worked for me:

in html file:



in .load file

// enable html editing in text boxes. Destroy/replace needed to work as 
component loaded multiple times.
$(document).ready(function() {
$('textarea.ckeditor').each(function(){
name=$(this).attr('id')
if (CKEDITOR.instances[name])
CKEDITOR.instances[name].destroy(true);
CKEDITOR.replace(name)
})
})


On Wednesday, 29 August 2012 06:00:17 UTC+1, Picheth wrote:
>
> I have a problem with the ckeditor function LOAD (., ajax = True)
>
> error : It pass the wrong part.
>
> please .. any help, cues or snippets of codes to accomplish this ... will 
> be greatly appreciated
>
> Picheth.
>

-- 





[web2py] DAL backward compatibility problem?

2012-08-30 Thread Manuele Pesenti

hi!
trying to migrate my application from web2py 1.99.7 to new stable 
release 2.0.2 I obtain this error:


Traceback (most recent call last):
  File 
"/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/restricted.py", line 
209, in restricted

exec ccode in environment
  File 
"/home/manuele/Dropbox/sviluppo/web2py-2.0.2/applications/theseus/models/plugin_lookout.py", 
line 52, in 

id_max = db().select(f_max).first()[f_max] or 0
  File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py", line 
8679, in select

return self(fields[0]._table).select(*fields,**attributes)
AttributeError: 'Expression' object has no attribute '_table'

and these are the two incriminated code lines:

51 f_max = db.plugin_lookout_connections.id.max()
52 id_max = db().select(f_max).first()[f_max] or 0

considering that the code under the 1.99.7 version works fine could it 
be a non backward compatibility bug?


thanks for any help

cheers

Manuele

--





[web2py] error on custom_auth_table = db[auth.settings.table_user_name]

2012-08-30 Thread Annet
In web2py 2.0.2 I defined the following custom auth_user table:

db.define_table(
auth.settings.table_user_name,
Field('title',length=8,requires=IS_IN_SET(['de 
heer','mevrouw'],zero=T('select a value')),label='Aanheft * '),

Field('firstName',length=32,requires=IS_LENGTH(32,error_message=T('length 
exceeds 32 characters')),label='Voornaam'),

Field('lastName',length=64,default='',requires=[IS_LENGTH(64,error_message=T('length
 
exceeds 64 charactrer')),IS_NOT_EMPTY()],notnull=True,label='Achternaam * 
'),

Field('shortname',default='',requires=[IS_LENGTH(128,error_message=T('length 
exceeds 128 
characters')),IS_EMPTY_OR(IS_NOT_IN_DB(db,'custom_auth_table.shortname',error_message=T('shortname
 
already in database')))],notnull=True,unique=True),
Field('phone',length=16,requires=IS_LENGTH(16,error_message='length 
exceeds 16 characters'),label='Telefoon'),

Field('email',length=128,default='',requires=[IS_LENGTH(128,error_message=T('length
 
exceeds 128 characters')),IS_EMAIL(error_message=T('invalid 
email')),IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'custom_auth_table.email',error_message=T('email
 
already in database'))],notnull=True,unique=True,label='E-mail * '),

Field('username',length=32,default='',requires=[IS_LENGTH(32,error_message=T('length
 
exceeds 32 
charactrer')),IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'custom_auth_table.username',error_message=T('username
 
already in 
database'))],notnull=True,unique=True,writable=False,readable=False,label='Gebruikersnaam
 
* '),
Field('password', 
type='password',length=512,requires=[IS_STRONG(),CRYPT()],readable=False,label='Wachtwoord
 
* '),
Field('nodeID','reference 
node',default='',requires=[IS_IN_DB(db,'node.id','%(id)s',zero=T('select a 
value'))],ondelete='CASCADE',notnull=True,writable=False,readable=False),

Field('comment',type='text',requires=IS_LENGTH(512,error_message=T('length 
exceeds 512 characters')),

Field('registration_key',length=512,default='',writable=False,readable=False),

Field('reset_password_key',length=512,default='',writable=False,readable=False),

Field('registration_id',length=512,default='',writable=False,readable=False),
Field('createdOn',type='datetime',default=request.now),

Field('modifiedOn',type='datetime',default=request.now,update=request.now))


## get the custom_auth_table
custom_auth_table = db[auth.settings.table_user_name]
## tell auth to use custom_auth_table
auth.settings.table_user = custom_auth_table

When I save the file, it makes this line of code gray:

custom_auth_table = db[auth.settings.table_user_name]

I don't know why, flash messages don't display in 2.0.2


Also when I inspect the page with fire bug I get this just before the 
body's closing tag:

XyXyXyXyXyXyXyXyXyXyXyXyXy


Kind regards,

Annet

-- 





Re: [web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Martín Mulone
+1

2012/8/30 Anthony 

> Congratulations to all! And special thanks to Massimo for all his hard
> work, diligence, and patience.
>
> Anthony
>
>
> On Wednesday, August 29, 2012 11:41:34 PM UTC-4, Massimo Di Pierro wrote:
>>
>> After 5 months. It is done. This is the most waited and the most
>> feature-packed release.
>>
>> I am sure we'll find some corners that need to be ironed but it is
>> considerably better than 1.99.7. It adds lot of new features and improves
>> many existing ones:
>>
>> - 57,000 new lines of code and closed 279 issues since 1.99.7.
>> - Retrieving data from DB should be faster, in particular
>> select(cacheable=True)
>> - Has a new scheduler, a built-in wiki, new language and pluralization
>> system, better markmin with oembed support and better scaffolding app,
>> increased security.
>> - Lots of experimental features including GIS support, mongodb support,
>> built-in auth.wiki(), and more.
>>
>> Should be 100% backward compatible. If you run into any issue let us know
>> ASAP.
>>
>> I personally want to thank the major contributors to this release (in
>> alphabetic order)
>> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg,
>> Jonathan, Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod,
>> Patrick, Vladyslav,
>> They spend many nights testing, coding, debugging at a very fast pace.
>>
>> Many many people have contributed.
>>
>> If your contribution has not been properly acknowledged please let us
>> know ASAP. It is probably an oversight.
>>
>>
>> Massimo
>>
>>
>> Detailed changelog
>> ===
>>
>> ## 2.00.2
>>
>> ### DAL Improvements
>>
>> - Support for DAL(lazy_tables=True) and db.define_table(on_define=**lambda
>> table:), thanks Jonathan
>> - db(...).select(cacheable=True) make select 30% faster
>> - db(...).select(cache=(cache.**ram,3600)) now caches parsed data 100x
>> faster
>> - db(...).count(cache=(cache.**ram,3600)) now supported
>> - MongoDB support in DAL (experimental), thanks Mark Breedveld
>> - geodal and spatialite, thanks Denes and Fran (experimental)
>> - db.mytable._before_insert, _after_insert, _before_update,
>> _after_update, _before_delete. _after_delete (list of callbacks)
>> - db(...).update_naive(...) same as update but ignores
>> table._before_update and table._after_update
>> - DAL BIGINT support and DAL(...,bigint_id=True)
>> - IS_IN_DB(..., distinct=True)
>> - new syntax: db.mytable.insert(**myuploadfield=open()), thank you
>> Iceberg
>> - db(...).select(db.mytable.**myfield.count(distinct=True))
>> - 
>> db(db.a)._update(name=db(db.b.**a==db.a.id).nested_select(db.**b.id
>> ))
>> - db.mytable.myfield.filter_in, filter_out
>> - db.mytable._enable_record_**versioning(db) adds versioning to this
>> table
>> - teradata adapter, thanks Andrew Willimott
>> - experimental Sybase Adapter
>> - added db.table.field.avg()
>> - Support for Google App Engine projections, thanks Christian
>> - Field(... 'upload', default=path) now accepts a path to a local file as
>> default value, if user does not upload a file. Relative path looks inside
>> current application folder, thanks Marin
>> - executesql(...,fields=,**columns=) allows parsing of results in Rows,
>> thanks Anthony
>>
>> ### Auth improvements
>>
>> - auth.enable_record_versioning(**db)  adds full versioning to all tables
>> - @auth.requires_login(**otherwise=URL(...))
>> - auth supports salt and compatible with third party data, thanks Dave
>> Stoll
>> - CRYPT now defaults to pbkdf2(1000,20,sha1)
>> - Built-in wiki with menu, tags, search, media, permissions. def index:
>> return auth.wiki()
>> - auth.settings.everybody_group_**id
>> - allow storage of uploads on any PyFileSystem (including amazon)
>>
>> ### Form improvements
>>
>> - FORM.confirm('Are you sure?',{'Back':URL(...)})
>> - SQLFORM.smartdictform(dict)
>> - form.add_button(value,link)
>> - SQLFORM.grid(groupby='...')
>> - fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
>> - more export options in SQLFORM.grid and SQLFORM.smartgrid (html, xml,
>> csv, ...)
>>
>> ### Admin improvements
>>
>> - new admin pages: manage_students, bulk_regsiter, and progress reports
>> - increased security in admin against CSRF
>> - experimental Git integration
>> - experimental OpenShift deployment
>> - multi-language pluralization engine
>> - ace text web editor in admin
>> - Ukrainian translations, thanks Vladyslav Kozlovskyy
>> - Romanian translation for welcome, thanks ionel
>> - support for mercurial 2.6, thanks Vlad
>>
>> ### Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
>>
>> - web2py.py -K myapp -X starts the myapp scheduler alongside the webserver
>> - tasks are marked EXPIRED (if stop_time passed)
>> - functions with no result don't end up in scheduler_run
>> - more options: web2py.py -E -b -L
>> - scheduler can now handle 10k tasks with 20 concurrent workers and with
>> no issues
>> - new params:
>> tasks can be found in the environment (no need to define the tas

[web2py] removed form.vars.{fieldname}_newfilename -- I used it :(

2012-08-30 Thread szimszon
Hi!

https://github.com/mdipierro/web2py/commit/74418b1a6962bf2db36b46f9620e16297abfd059

I used it :(

-- 





[web2py] crud file upload do not work :(

2012-08-30 Thread szimszon
http://code.google.com/p/web2py/issues/detail?id=966

-- 





[web2py] Re: How to use the new cache-options with SQLFORM.grid?

2012-08-30 Thread Niphlod
If only I had a penny every time in a changelog there is a "big number" 
speedup and all users starts making questions.I knew those "x% faster" 
will have raised more questions than answers.

SQLTABLE take the rows after they have been fetched. SQLTABLE is for 
displaying results only. 

SQLFORM.grid or smartgrid take tables or queries, and the grid is in charge 
to fetch those records (based on the parameters you use) for every request.
The grids paginate, order, edit, create, export, find related tables, etc 
etc etc. If you are going to use SQLFORM grids you can't "use" any 
improvement regarding "the cache side".



Il giorno giovedì 30 agosto 2012 12:05:55 UTC+2, Johann Spies ha scritto:
>
> I am afraid I do not understand you reasoning:
>
> I can do 
>
> rows = db(db.sometable).select(
> cacheable=True, cache = (ram.cache,3600))
> data = SQLTABLE(rows)
>
> or I can do 
>
> query = db.sometable.id>0
> data = SQLFORM.grid(query)
>
> or
>
> data = SQLFORM.smartgrid(db.sometable)
>
> and how do I use those improvements in the latter 2 cases.  That is what I 
> have asked in my first email.  
>
> So what do you mean that it has nothing to do with grid/smartgrid where 
> both of them run queries?
>
> Regards
> Johann
>
>
>
>>

-- 





Re: [web2py] Multiple tables or a single big one?

2012-08-30 Thread villas
I think Bruno meant that he includes that code inside his def user(): 
 function in controllers/default.py


On Thursday, August 30, 2012 3:47:19 AM UTC+1, Alec Taylor wrote:
>
> Thanks Niphlod also
>
> On Thursday, August 30, 2012 4:50:55 AM UTC+10, rochacbruno wrote:
>>
>>
>> I generally do this on user function: 
>>
>> profile_fields = ['first_name', 'last_name', 'email', 'description', 
>> 'picture']
>>
>> if 'profile' in request.args:
>> for field in db.auth_user.fields:
>> if field not in profile_fields:
>> db.auth_user[field].readable = db.auth_user[field].writable = 
>> False 
>>
>
> You mention you do this on the user function, can you be more specific?
>  
>
>> On Wed, Aug 29, 2012 at 3:24 PM, Alec Taylor  wrote:
>>
>>> I have been extending my auth_user table with a bunch of new options.
>>>
>>> When there's a 1:1 relation with the user, I'll store it in their 
>>> profile.
>>>  
>>> On 1:n, I'll keep them in separate tables.
>>>
>>> Now I am realising the problems with doing it this way. To make my 
>>> register form "nice" I have set almost all fields with readable=Falseand 
>>> writable=False.
>>>
>>> This means that I can no longer use the crud.create or crud.update form 
>>> creator helpers on those subset of a users' profile I want the form to 
>>> change for them.
>>>
>>> But it also has its advantage: no extra queries are required to grab all 
>>> the 1:1 fields of a users' profile after login.
>>>
>>> Is this enough of an advantage?
>>>
>>> Thanks for all suggestions,
>>>
>>> Alec Taylor
>>>
>>

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Adrian Marius Popa


On Thursday, August 30, 2012 6:41:34 AM UTC+3, Massimo Di Pierro wrote:
>
> After 5 months. It is done. This is the most waited and the most 
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is 
> considerably better than 1.99.7. It adds lot of new features and improves 
> many existing ones:
>

Thanks for supporting firebird out of the box i added a notice on 
firebirdnews http://www.firebirdnews.org/?p=7585

I looked in the DAL and saw that your are using kinterbasdb or firebirdsql 
in the next release we should switch to fdb driver as default that is 
backward compatible with kinterbasdb and is now the official supported 
driver for 
python 2.7.x or 3.3.x 
http://pypi.python.org/pypi/fdb/

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Ashish Yadav
Was waiting desperately for this release. Big thanks to all of you!!

Regards,
Ashish

On Thursday, August 30, 2012 9:11:34 AM UTC+5:30, Massimo Di Pierro wrote:
>
> After 5 months. It is done. This is the most waited and the most 
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is 
> considerably better than 1.99.7. It adds lot of new features and improves 
> many existing ones:
>
> - 57,000 new lines of code and closed 279 issues since 1.99.7.
> - Retrieving data from DB should be faster, in particular 
> select(cacheable=True)
> - Has a new scheduler, a built-in wiki, new language and pluralization 
> system, better markmin with oembed support and better scaffolding app, 
> increased security.
> - Lots of experimental features including GIS support, mongodb support, 
> built-in auth.wiki(), and more.
>
> Should be 100% backward compatible. If you run into any issue let us know 
> ASAP.
>
> I personally want to thank the major contributors to this release (in 
> alphabetic order)
> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg, Jonathan, 
> Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod, Patrick, 
> Vladyslav, 
> They spend many nights testing, coding, debugging at a very fast pace.
>
> Many many people have contributed.
>
> If your contribution has not been properly acknowledged please let us know 
> ASAP. It is probably an oversight.
>
>
> Massimo
>
>
> Detailed changelog
> ===
>
> ## 2.00.2
>
> ### DAL Improvements
>
> - Support for DAL(lazy_tables=True) and db.define_table(on_define=lambda 
> table:), thanks Jonathan
> - db(...).select(cacheable=True) make select 30% faster
> - db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
> - db(...).count(cache=(cache.ram,3600)) now supported
> - MongoDB support in DAL (experimental), thanks Mark Breedveld
> - geodal and spatialite, thanks Denes and Fran (experimental)
> - db.mytable._before_insert, _after_insert, _before_update, _after_update, 
> _before_delete. _after_delete (list of callbacks)
> - db(...).update_naive(...) same as update but ignores 
> table._before_update and table._after_update
> - DAL BIGINT support and DAL(...,bigint_id=True)
> - IS_IN_DB(..., distinct=True)
> - new syntax: db.mytable.insert(myuploadfield=open()), thank you 
> Iceberg
> - db(...).select(db.mytable.myfield.count(distinct=True))
> - db(db.a)._update(name=db(db.b.a==db.a.id).nested_select(db.b.id))
> - db.mytable.myfield.filter_in, filter_out
> - db.mytable._enable_record_versioning(db) adds versioning to this table
> - teradata adapter, thanks Andrew Willimott
> - experimental Sybase Adapter
> - added db.table.field.avg()
> - Support for Google App Engine projections, thanks Christian
> - Field(... 'upload', default=path) now accepts a path to a local file as 
> default value, if user does not upload a file. Relative path looks inside 
> current application folder, thanks Marin
> - executesql(...,fields=,columns=) allows parsing of results in Rows, 
> thanks Anthony
>
> ### Auth improvements
>
> - auth.enable_record_versioning(db)  adds full versioning to all tables
> - @auth.requires_login(otherwise=URL(...))
> - auth supports salt and compatible with third party data, thanks Dave 
> Stoll
> - CRYPT now defaults to pbkdf2(1000,20,sha1)
> - Built-in wiki with menu, tags, search, media, permissions. def index: 
> return auth.wiki()
> - auth.settings.everybody_group_id
> - allow storage of uploads on any PyFileSystem (including amazon)
>
> ### Form improvements
>
> - FORM.confirm('Are you sure?',{'Back':URL(...)})
> - SQLFORM.smartdictform(dict)
> - form.add_button(value,link)
> - SQLFORM.grid(groupby='...')
> - fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
> - more export options in SQLFORM.grid and SQLFORM.smartgrid (html, xml, 
> csv, ...)
>
> ### Admin improvements
>
> - new admin pages: manage_students, bulk_regsiter, and progress reports
> - increased security in admin against CSRF
> - experimental Git integration
> - experimental OpenShift deployment
> - multi-language pluralization engine 
> - ace text web editor in admin
> - Ukrainian translations, thanks Vladyslav Kozlovskyy
> - Romanian translation for welcome, thanks ionel
> - support for mercurial 2.6, thanks Vlad
>
> ### Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
>
> - web2py.py -K myapp -X starts the myapp scheduler alongside the webserver
> - tasks are marked EXPIRED (if stop_time passed)
> - functions with no result don't end up in scheduler_run
> - more options: web2py.py -E -b -L
> - scheduler can now handle 10k tasks with 20 concurrent workers and with 
> no issues
> - new params:
> tasks can be found in the environment (no need to define the tasks 
> parameter)
> max_empty_runs kills the workers automatically if no new tasks are 
> found in queue (nice for "spikes" of processing power)
> discard_results to completely discard the results (

[web2py] GAE with Janrain problem 2.0.2

2012-08-30 Thread rif
After a succesful login from janrain running on GAE I get the following 
error:

Traceback (most recent call last):
  File "/home/rif/Documents/webframeworks/homepage/gluon/restricted.py", 
line 209, in restricted
exec ccode in environment
  File 
"/home/rif/Documents/webframeworks/homepage/applications/init/controllers/default.py",
 
line 105, in 
  File "/home/rif/Documents/webframeworks/homepage/gluon/globals.py", line 
185, in 
self._caller = lambda f: f()
  File 
"/home/rif/Documents/webframeworks/homepage/applications/init/controllers/default.py",
 
line 103, in user
return dict(form=auth())
  File "/home/rif/Documents/webframeworks/homepage/gluon/tools.py", line 
1191, in __call__
return getattr(self,args[0])()
  File "/home/rif/Documents/webframeworks/homepage/gluon/tools.py", line 
1961, in login
user = self.get_or_create_user(table_user._filter_fields(cas_user))
  File "/home/rif/Documents/webframeworks/homepage/gluon/tools.py", line 
1620, in get_or_create_user
(table_user[fieldname]==value)).select().first()
  File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
8682, in select
return adapter.select(self.query,fields,attributes)
  File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
4461, in select
(items, tablename, fields) = self.select_raw(query,fields,attributes)
  File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
4356, in select_raw
filters = self.expand(query)
  File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
4232, in expand
return expression.op(expression.first, expression.second)
  File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
4087, in OR
def OR(self,first,second): raise SyntaxError, "Not supported"
SyntaxError: Not supported


Does anybody experience the same problem?

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Don_X
Let it be said & Let it be heard :
Web2py is not only awesome .. It is simply the best python framework out 
there ! ... 
at least for me, and many others !

Congratulations to the web2py developer team 

Move over ! make way !  PHP & Python Frameworks .. here we come !

-- 





Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-30 Thread Amit
Hi Anthony,

I am able to achieve it through Javascript function like below:

function submitVlaue(thisForm)
{
var recordName = thisForm.name_text_field.value;

window.location="{{=URL('default', 'recordr_config') + '/'}}" +
recordName ;
}

but if I use JQuery instead of directly putting record name, its not
working.Please suggest is it a proper way to send the parameters to the
controller function.

Regards,
Amit

On Thu, Aug 30, 2012 at 2:44 PM, Amit  wrote:

> Anthony,
> I observe one more thing, as I have launched record Info page from other
> page using below statement:
>
>  disabled="disabled"
> onClick = 'window.location="{{=URL('default', 'record_config',
> args=[row.record_id])}}";'>
>
>
> So upon clicking on button , it is launching record_config page , first it
> will call record_config() function and I am passing record_id to fetch the
> data about the record and display on the record_config page , so
> record_config page will display all data about the record( for e.g
> record_id, record_name etc...)
>
> Now what is my observation is : the URL of record_config page, it is
> showing like:
>
> http://127.0.0.1:8000/record_App/default/record_config/45326699
>
> where the number (45326699) indicates the record_id.
>
> One test i have done :
> I have written one javascript function with alert message and calling from
> onclick of the save button on the record_config page, but it is not
> invoking the javascript function so I am suspecting the above URL is
> different from record_config page, may be some temporary page is getting
> created with these values.
>
> what I understood is this page is not record_config page that's why it is
> not calling onclick of the button , hence not calling javascript, JQuery
> stuffs also.
>
> Please provide your inputs on this.
>
> Regards,
> Amit
>
>
> On Thu, Aug 30, 2012 at 2:11 PM, Amit  wrote:
>
>> Still the same issue :(  , its not calling record_config() function...
>> how to check whether JQuery is supported or not? I have created my own
>> custom html page without mentioning {{extend 'layout.html'}} statement,
>> means simple html page withe labels and text fields, so do I need to add
>> some statement in my html file to support JQuery?
>>
>>
>> On Thu, Aug 30, 2012 at 12:40 PM, Anthony  wrote:
>>
>>> Replace the single quotes with double quotes inside the jQuery():
>>>
>>> onClick='window.location="{{=URL('default', 'record_config') + '/'}}" +
>>>  jQuery("input[name=name_text_field]").val();'
>>>
>>> The value will be available as request.args(0) in the record_config()
>>> function.
>>>
>>> Anthony
>>>
>>>
>>> On Thursday, August 30, 2012 2:41:40 AM UTC-4, Amit wrote:

 Hi Anthony,
 I used the code which you have suggested but it's not working at all,
 it is not calling record_config() function of controller.

 >>>onClick='window.location="{{=**URL('default', 'record_config') + '/'}}"
 + jQuery('input[name=name_text_**field]').val();'>


 second point is if the above approach is successful then how would I
 retrieve the value in controller side:

 def record_config():
  print 'inside record_config'
  print request.input['name']

 Do I need to use Input list to retrieve the value? OR is there any
 other way to retrieve?


 On Wednesday, 29 August 2012 19:50:15 UTC+5:30, Anthony wrote:
>
>  > onclick = 'window.location="{{=URL('defa**ult', 'record_config',
>> args=[name_text_field.value])}**}";'>
>>
>
> You cannot refer to name_text_field the way you have. Everything
> inside {{..}} is Python and must be available on the server before the 
> HTML
> is rendered and sent to the browser. The input field value is available on
> the client side and must be retrieved via Javascript. You could do:
>
> onclick='window.location="{{=**URL('default', 'record_config') + '/'}}"
> + jQuery('input[name=name_text_**field]').val();'
>
> Anthony
>
  --
>>>
>>>
>>>
>>>
>>
>>
>

-- 





Re: [web2py] Re: How to call controller function upon onClick from html?

2012-08-30 Thread Anthony
The query method works fine for me. Are you sure you have jquery loaded?

On Thursday, August 30, 2012 7:13:26 AM UTC-4, Amit wrote:
>
> Hi Anthony,
>
> I am able to achieve it through Javascript function like below:
>
> function submitVlaue(thisForm)
> {
> var recordName = thisForm.name_text_field.value;
> 
> window.location="{{=URL('default', 'recordr_config') + '/'}}" + 
> recordName ;
> }
>
> but if I use JQuery instead of directly putting record name, its not 
> working.Please suggest is it a proper way to send the parameters to the 
> controller function.
>
> Regards,
> Amit
>
> On Thu, Aug 30, 2012 at 2:44 PM, Amit  >wrote:
>
>> Anthony,
>> I observe one more thing, as I have launched record Info page from other 
>> page using below statement:
>>
>> > disabled="disabled"
>> onClick = 'window.location="{{=URL('default', 'record_config', 
>> args=[row.record_id])}}";'>
>>
>>
>> So upon clicking on button , it is launching record_config page , first 
>> it will call record_config() function and I am passing record_id to fetch 
>> the data about the record and display on the record_config page , so 
>> record_config page will display all data about the record( for e.g 
>> record_id, record_name etc...)
>>
>> Now what is my observation is : the URL of record_config page, it is 
>> showing like:
>>
>> http://127.0.0.1:8000/record_App/default/record_config/45326699
>>
>> where the number (45326699) indicates the record_id.
>>
>> One test i have done :
>> I have written one javascript function with alert message and calling 
>> from onclick of the save button on the record_config page, but it is not 
>> invoking the javascript function so I am suspecting the above URL is 
>> different from record_config page, may be some temporary page is getting 
>> created with these values.
>>
>> what I understood is this page is not record_config page that's why it is 
>> not calling onclick of the button , hence not calling javascript, JQuery 
>> stuffs also.
>>
>> Please provide your inputs on this.
>>
>> Regards,
>> Amit
>>
>>
>> On Thu, Aug 30, 2012 at 2:11 PM, Amit > >wrote:
>>
>>> Still the same issue :(  , its not calling record_config() function...
>>> how to check whether JQuery is supported or not? I have created my own 
>>> custom html page without mentioning {{extend 'layout.html'}} statement, 
>>> means simple html page withe labels and text fields, so do I need to add 
>>> some statement in my html file to support JQuery?
>>>
>>>
>>> On Thu, Aug 30, 2012 at 12:40 PM, Anthony 
>>> > wrote:
>>>
 Replace the single quotes with double quotes inside the jQuery():

 onClick='window.location="{{=URL('default', 'record_config') + '/'}}" +
  jQuery("input[name=name_text_field]").val();'

 The value will be available as request.args(0) in the record_config() 
 function.

 Anthony


 On Thursday, August 30, 2012 2:41:40 AM UTC-4, Amit wrote:
>
> Hi Anthony, 
> I used the code which you have suggested but it's not working at all, 
> it is not calling record_config() function of controller.
>
> onClick='window.location="{{=**URL('default', 'record_config') + 
> '/'}}" 
> + jQuery('input[name=name_text_**field]').val();'>
>
>
> second point is if the above approach is successful then how would I 
> retrieve the value in controller side:
>
> def record_config():
>  print 'inside record_config' 
>  print request.input['name']
>
> Do I need to use Input list to retrieve the value? OR is there any 
> other way to retrieve?
>
>
> On Wednesday, 29 August 2012 19:50:15 UTC+5:30, Anthony wrote:
>>
>>  >> onclick = 'window.location="{{=URL('defa**ult', 'record_config', 
>>> args=[name_text_field.value])}**}";'>
>>>
>>
>> You cannot refer to name_text_field the way you have. Everything 
>> inside {{..}} is Python and must be available on the server before the 
>> HTML 
>> is rendered and sent to the browser. The input field value is available 
>> on 
>> the client side and must be retrieved via Javascript. You could do:
>>
>> onclick='window.location="{{=**URL('default', 'record_config') + '/'}}" 
>> + jQuery('input[name=name_text_**field]').val();'
>>
>> Anthony 
>>
>  -- 
  
  
  

>>>
>>>
>>
>

-- 





Re: [web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Ovidio Marinho
I´m test now.



   Ovidio Marinho Falcao Neto
Web Developer
 ovidio...@gmail.com
  ovidiomari...@itjp.net.br
 ITJP - itjp.net.br
   83   8826 9088 - Oi
   83   9334 0266 - Claro
Brasil




2012/8/30 Don_X 

> Let it be said & Let it be heard :
> Web2py is not only awesome .. It is simply the best python framework out
> there ! ...
> at least for me, and many others !
>
> Congratulations to the web2py developer team
>
> Move over ! make way !  PHP & Python Frameworks .. here we come !
>
> --
>
>
>
>

-- 





[web2py] Re: {{code}} compile in view

2012-08-30 Thread lucas
ok, i am stuck.  i have studied run_controller_in and restricted and i 
tried some test code attempts and i am stuck.  so here is some sample code:

xx2 = """
def lucas53():
  harry = (4+16)/2
  rtn = dict(harry=harry)
  return rtn
"""
and under a web2py controller function:

env = {}
exec xx2 in env
lst = env
body.append(P(lst))

where body is just a DIV() to add to a HTML page.  and replacing "exec xx2 
in env" with "restricted(xx2,env)" would do nearly the same thing.

and it returns a huge dictionary of many types, some excerpts are:
{...
...'globals': , ...
...'vars': , ...
...'locals': , ...
...'lucas53': }

and i can see my executed function in there as a type function, and local 
and global vars, but i can not access or find "harry" or "rtn" the 
variables within the function lucas53.  i do not know how to access the 
local variables within lucas53 or the locals to find harry or rtn.

so i am still learning python.  thanx for the help in advance.  lucas

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread chinakr
Thanks a lot, Massimo!

在 2012年8月30日星期四UTC+8上午11时41分34秒,Massimo Di Pierro写道:
>
> After 5 months. It is done. This is the most waited and the most 
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is 
> considerably better than 1.99.7. It adds lot of new features and improves 
> many existing ones:
>
> - 57,000 new lines of code and closed 279 issues since 1.99.7.
> - Retrieving data from DB should be faster, in particular 
> select(cacheable=True)
> - Has a new scheduler, a built-in wiki, new language and pluralization 
> system, better markmin with oembed support and better scaffolding app, 
> increased security.
> - Lots of experimental features including GIS support, mongodb support, 
> built-in auth.wiki(), and more.
>
> Should be 100% backward compatible. If you run into any issue let us know 
> ASAP.
>
> I personally want to thank the major contributors to this release (in 
> alphabetic order)
> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg, Jonathan, 
> Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod, Patrick, 
> Vladyslav, 
> They spend many nights testing, coding, debugging at a very fast pace.
>
> Many many people have contributed.
>
> If your contribution has not been properly acknowledged please let us know 
> ASAP. It is probably an oversight.
>
>
> Massimo
>
>
> Detailed changelog
> ===
>
> ## 2.00.2
>
> ### DAL Improvements
>
> - Support for DAL(lazy_tables=True) and db.define_table(on_define=lambda 
> table:), thanks Jonathan
> - db(...).select(cacheable=True) make select 30% faster
> - db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
> - db(...).count(cache=(cache.ram,3600)) now supported
> - MongoDB support in DAL (experimental), thanks Mark Breedveld
> - geodal and spatialite, thanks Denes and Fran (experimental)
> - db.mytable._before_insert, _after_insert, _before_update, _after_update, 
> _before_delete. _after_delete (list of callbacks)
> - db(...).update_naive(...) same as update but ignores 
> table._before_update and table._after_update
> - DAL BIGINT support and DAL(...,bigint_id=True)
> - IS_IN_DB(..., distinct=True)
> - new syntax: db.mytable.insert(myuploadfield=open()), thank you 
> Iceberg
> - db(...).select(db.mytable.myfield.count(distinct=True))
> - db(db.a)._update(name=db(db.b.a==db.a.id).nested_select(db.b.id))
> - db.mytable.myfield.filter_in, filter_out
> - db.mytable._enable_record_versioning(db) adds versioning to this table
> - teradata adapter, thanks Andrew Willimott
> - experimental Sybase Adapter
> - added db.table.field.avg()
> - Support for Google App Engine projections, thanks Christian
> - Field(... 'upload', default=path) now accepts a path to a local file as 
> default value, if user does not upload a file. Relative path looks inside 
> current application folder, thanks Marin
> - executesql(...,fields=,columns=) allows parsing of results in Rows, 
> thanks Anthony
>
> ### Auth improvements
>
> - auth.enable_record_versioning(db)  adds full versioning to all tables
> - @auth.requires_login(otherwise=URL(...))
> - auth supports salt and compatible with third party data, thanks Dave 
> Stoll
> - CRYPT now defaults to pbkdf2(1000,20,sha1)
> - Built-in wiki with menu, tags, search, media, permissions. def index: 
> return auth.wiki()
> - auth.settings.everybody_group_id
> - allow storage of uploads on any PyFileSystem (including amazon)
>
> ### Form improvements
>
> - FORM.confirm('Are you sure?',{'Back':URL(...)})
> - SQLFORM.smartdictform(dict)
> - form.add_button(value,link)
> - SQLFORM.grid(groupby='...')
> - fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
> - more export options in SQLFORM.grid and SQLFORM.smartgrid (html, xml, 
> csv, ...)
>
> ### Admin improvements
>
> - new admin pages: manage_students, bulk_regsiter, and progress reports
> - increased security in admin against CSRF
> - experimental Git integration
> - experimental OpenShift deployment
> - multi-language pluralization engine 
> - ace text web editor in admin
> - Ukrainian translations, thanks Vladyslav Kozlovskyy
> - Romanian translation for welcome, thanks ionel
> - support for mercurial 2.6, thanks Vlad
>
> ### Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
>
> - web2py.py -K myapp -X starts the myapp scheduler alongside the webserver
> - tasks are marked EXPIRED (if stop_time passed)
> - functions with no result don't end up in scheduler_run
> - more options: web2py.py -E -b -L
> - scheduler can now handle 10k tasks with 20 concurrent workers and with 
> no issues
> - new params:
> tasks can be found in the environment (no need to define the tasks 
> parameter)
> max_empty_runs kills the workers automatically if no new tasks are 
> found in queue (nice for "spikes" of processing power)
> discard_results to completely discard the results (if you don't need 
> the output of the task)
> utc_time enables datetime calculat

Re: [web2py] Removing labels from forms

2012-08-30 Thread Anthony
Try:

for input in form.elements("input[type=text]"):



On Thursday, August 30, 2012 3:51:13 AM UTC-4, Alec Taylor wrote:
>
> No placeholders are added to the HTML.
>
> Here is the output:  http://pastie.org/4615036
>
> On Thu, Aug 30, 2012 at 3:02 PM, Anthony  >wrote:
>
>> Can you explain more about what doesn't work? Does the HTML source code 
>> end up not as expected, or is the browser just not rendering it as expected?
>>
>>
>> On Thursday, August 30, 2012 12:01:18 AM UTC-4, Alec Taylor wrote:
>>
>>> Thanks, but unfortunately that didn't work.
>>>
>>> {{
>>> form=auth.register()
>>> my_extra_element = CAT('Agree to ', A('terms & conditions', 
>>> _href="/legal/agreement/")), 
>>> INPUT(_name='agree',value=True**,_type='checkbox')
>>> form[0].insert(-1,my_extra_**element)for label in form.elements('label'):
>>> label["_style"] = "display:none;"pass
>>>
>>> placeholders = {
>>>"email": "enter a valid email address",
>>>"password": "be secure",
>>>"post code": "3434343-3434383",
>>>"validator": "captcha"}for input in 
>>> form.elements("input[type='**text']"):
>>> input["_placeholder"] = placeholders.get(input["_name"**], "")pass
>>> =form}}
>>>
>>>
>>> (this is in my view; and yes, I should move it to a controller, but want 
>>> to get it working first)
>>>
>>> On Thu, Aug 30, 2012 at 4:11 AM, Bruno Rocha  wrote:
>>> > placeholders = {
>>> > "name": "fill in your name",
>>> >"email": "enter a valid email address"
>>> > }
>>> >
>>> > for input in form.elements("input[type='**text']"):
>>> > input["_placeholder"] = placeholders.get(input["_name"**], "")
>>> >
>>> >
>>> > On Wed, Aug 29, 2012 at 3:07 PM, Alec Taylor  
>>> wrote:
>>> >>
>>> >> Thanks, also would there be a loop I can add before that to set the
>>> >> placeholder of each input?
>>> >>
>>> >> On Thu, Aug 30, 2012 at 3:58 AM, Bruno Rocha 
>>>
>>> >> wrote:
>>> >> > for label in form.elements('label'):
>>> >> > label["_style"] = "display:none;"
>>> >> >
>>> >> >
>>> >> >
>>> >> >
>>>  >> > On Wed, Aug 29, 2012 at 2:47 PM, Alec Taylor 
>>>
>>> >> > wrote:
>>> >> >>
>>> >> >> How do I remove labels from forms?
>>> >> >>
>>> >> >> I want to use placeholders instead...
>>> >> >>
>>> >> >> (this is for the auth.register form)
>>> >> >>
>>> >> >> Thanks for all suggestions,
>>> >> >>
>>> >> >> Alec Taylor
>>> >> >>
>>> >> >> --
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >
>>> >> >
>>> >> > --
>>> >> >
>>> >> >
>>> >> >
>>> >>
>>> >> --
>>> >>
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> >  
>>> >  
>>> >  
>>>
>>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





[web2py] Issue rendering URL inside an A

2012-08-30 Thread Daniel Gonzalez
Hi,

I have the  following markup in an html viewfile:

{{=DIV(A('click me',callback=URL('mycallback'),target="me"),_id="me")}}
{{=URL('mycallback')}}

Which is producing the following html:

http://localhost:8000/web2py_jquery/default/index#null"; onclick="ajax('
/web2py_jquery/default/mycallback',[],'me');return false">click 
me
/web2py_jquery/default/mycallback

(web2py_jquery is just my test application)

I do not understand why =URL('callback') is rendering differently depending 
on the context. Specially the "#null" makes me worry
Is this expected?

Thanks,
Daniel

-- 





[web2py] Re: Mercurial not found

2012-08-30 Thread Nico Zanferrari
Looking inside the official selenic repository, I think that for a recent 
web2py you need at least  *mercurial version 1.9* (released on  August 2011 
- this is the first one with the scmutil module). 

BTW, the latest available mercurial version is 2.3 and maybe you need 
web2py  version 2.00 for supporting it (according to the web2py 2.00 
release notes, but they talk about a non-existent mercurial version 2.6 ;-)

Nico

-- 





[web2py] Admin access on hostmonster account

2012-08-30 Thread Larry Wapnitsky
I'm receiving the following message when logging in to the admin interface 
of web2py on my hostmonster account:

Login requires a secure (HTTPS) connection or running on localhost.

I've followed the instructions here:  
http://www.web2pyslices.com/slice/show/1401/web2py-on-shared-hosting-hostmonster-with-fastcgi

It appears that this:

if request.env.http_x_forwarded_for \
or request.env.wsgi_url_scheme in ['https', 'HTTPS'] \
or request.env.https == 'on':
session.secure()
elif not remote_addr in hosts:
raise HTTP(200, T('Admin is disabled because insecure channel'))



has been changed to this:

if request.env.http_x_forwarded_for or request.is_https:
session.secure()
elif not request.is_local and not DEMO_MODE:
raise HTTP(200, T('Admin is disabled because insecure channel'))


but commenting it out still does not help.

-- 





[web2py] IF no redirect

2012-08-30 Thread qwer qwer
I made default/index.html to execute a function in default.py. If I write 
redirect(..) in function, I am losing the current variable values in 
default/index.html as the index.html executes again from beginning..what to 
do? 

-- 





[web2py] Re: html form in web2py(reply needed urgently)

2012-08-30 Thread Massimo Di Pierro
Because the code is embedded in the view. Therefore it is executed after 
the flash is rendered.

On Wednesday, 29 August 2012 17:08:09 UTC-5, qwer qwer wrote:
>
> {{form=FORM('Your comment:',INPUT(_comment='_comment', 
> requires=IS_NOT_EMPTY()),
>   INPUT(_type='submit'))
> if form.accepts(request,session): response.flash = 'Your information has 
> been sent successfully'}}
> {{=form}}
>
>
> i wrote this in default/index . it displays a form ,but when submitted 
> does n't flash why??(I'm a new user.--may be the dbt is very silly) :)
>  
> I want a html form attribute name accessible to python.how...thanks.
>

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Tyrone

I'm having a problem with the scheduler when I upgraded my application. It 
appears that if I attempt to run the line:
Scheduler(db, dict(demo=demo))

I'm getting the error:

 Cannot add a UNIQUE column

Regards

-- 





[web2py] Re: A new and easier way to test your apps

2012-08-30 Thread Massimo Di Pierro
In 2.0.2 it is even simpler:

from gluon.contrib.webclient import WebClient

client = WebClient('http://127.0.0.1:8000/welcome/default/')

client.get('user/register')

data = dict(first_name = 'Homer',
last_name = 'Simpson',
email = 'ho...@web2py.com',
password = 'test',
password_two = 'test',
_formname = 'register')  # (*)
client.post('user/register',data = data)

data = dict(email='ho...@web2py.com',
password='test',
_formname = 'login')
client.post('user/login',data = data)

client.get('index')

# check registration and login were successful
assert 'Welcome Homer' in client.text

Checks automatically for persistant sessions and raises exception if sessions 
break or if a web ticket is issued.
You can also do

client.get('index')
print client.headers
print client.cookies # parsed as a dict
print client.forms # dict of formname:formvalue
print client.sessions # dict of appname:session_cookie_key
print client.status
print client.text




On Wednesday, 29 August 2012 23:37:07 UTC-5, Dave wrote:
>
> Very cool!
>
> On Wednesday, August 29, 2012 6:49:14 PM UTC-4, Massimo Di Pierro wrote:
>>
>> I think you are going to like this:
>> https://github.com/web2py/web2py/blob/master/gluon/contrib/webclient.py
>>
>> start web2py on port 8000. Then in a normal python shell:
>>
>> from gluon.contrib.webclient import WebClient
>> session = WebClient('http://127.0.0.1:8000/welcome/default/')
>> session.get('user/register')
>> session_id_welcome = session.cookies['session_id_welcome']
>> print session.forms # tells you which forms are in page (*)
>> data = dict(first_name = 'Homer',
>> last_name = 'Simpson',
>> email = 'ho...@web2py.com',
>> password = 'test',
>> password_two = 'test',
>> _formname = 'register')  # (*)
>> session.post('user/register',data = data)
>>
>> session.get('user/login')
>> data = dict(email='ho...@web2py.com',
>> password='test',
>> _formname = 'login')
>> session.post('user/login',data = data)
>> 
>> session.get('index')
>>
>> # check registration and login were successful
>> assert 'Welcome Homer' in session.text
>>
>> # check we are always in the same session
>> assert session_id_welcome == session.cookies['session_id_welcome']
>>
>>
>> It understand sessions (not just web2py session)
>> It understands basic auth (not used in the example)
>> It understands web2py forms (*) and fills in the _formkeys.
>>
>> Suggestions for improvement?
>>
>> Massimo
>>
>>

-- 





[web2py] Re: web editor problems with 2.0.2

2012-08-30 Thread Massimo Di Pierro
What os and what version?

On Thursday, 30 August 2012 03:20:43 UTC-5, Manuele wrote:
>
> Il 30/08/2012 10:00, Manuele Pesenti ha scritto: 
> > Hi! 
> > I've just downloaded the new 2.0.2 stable release but it seams there 
> > are some problems when I try to edit files from the web text editor 
> > integrated. Anybody noticed similar problems? 
>
> uhm... ok the problems seams limited to chromium web browser... 
>
> > 
> > in attachment a screenshot of what I see when I try to modify the mean 
> > model file db.py 
> > 
> > thank you in advance 
> > cheers 
> > 
> > M. 
>
>

-- 





[web2py] Re: signed_request from facebook

2012-08-30 Thread howesc
do you have a link to the appropriate facebook docs that describe the 
signed request for canvas pages?  i don't know what it is.

have you used HTTP traffic inspectors to watch the traffic sent back and 
forth that might give a clue as well - i use httpfox on firefox, and the 
built in developer tools on chrome for this.

cfh

On Tuesday, August 28, 2012 5:59:23 AM UTC-7, andre wrote:
>
> I can't find the signed_request sent by facebook whenever my application 
> is loaded within a Canvas page!!
> I looked over all places and nothing anyone can help me?? 

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Tyrone
It appears that it's an incompatibility with the original tables, when I 
delete everything the problem goes away. I got around the problem by 
deleting everything, and then overwriting the new database with the old 
one, excluding the scheduler tables.

-- 





[web2py] Checking for upgrades isn't working as I expected (1.99.7 installed)

2012-08-30 Thread Tim Richardson
I'm a new user so I don't know what should happen when a new stable release 
occurs.
I have 1.99.7 source running on a Windows 2003 server. Python 2.7 
(ActiveState). Browser is Firefox. Server is Rocket 1.2.4 on port 8010
In the Admin home page under the version string (1.99.7) it reports 
"checking for upgrades..." and that never completes ( I mean, that message 
doesn't change)

regards

Tim


-- 





[web2py] Re: Multiple tables or a single big one?

2012-08-30 Thread howesc
this question also depends on the platform you are using - a noSQL DB such 
as google app engine that does not support joins would be slow to run 2 
queries where you can use one

i also use something like bruno's approach, setting readable and writable 
in the controllers as needed.

On Wednesday, August 29, 2012 11:24:33 AM UTC-7, Alec Taylor wrote:
>
> I have been extending my auth_user table with a bunch of new options.
>
> When there's a 1:1 relation with the user, I'll store it in their profile.
>
> On 1:n, I'll keep them in separate tables.
>
> Now I am realising the problems with doing it this way. To make my 
> register form "nice" I have set almost all fields with readable=False and 
> writable=False.
>
> This means that I can no longer use the crud.create or crud.update form 
> creator helpers on those subset of a users' profile I want the form to 
> change for them.
>
> But it also has its advantage: no extra queries are required to grab all 
> the 1:1 fields of a users' profile after login.
>
> Is this enough of an advantage?
>
> Thanks for all suggestions,
>
> Alec Taylor
>

-- 





Re: [web2py] Re: Mercurial not found

2012-08-30 Thread Sergi Pons Freixes
2012/8/30 Johann Spies :
> I recently installed a recent version of mercurial on Debian stable from
> backports and did not have any problem.

I just installed the backports version, 2.2.2, and it works fine.

Problem solved :)

-- 





Re: [web2py] Re: web editor problems with 2.0.2

2012-08-30 Thread Manuele Pesenti

Il 30/08/2012 14:18, Massimo Di Pierro ha scritto:

What os and what version?


Debian GNU/Linux 3.2.0-2-486

Cromium version 13.0.782.107 (Developer Build 94237 Linux) Built on 
Debian unstable, running on Debian wheezy/sid


on the same pc works fine with firefox (14.0.1)

hope to be of any help

M.

--





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Igor Hercowitz
Mama mia

There's only one word to describe Web2Py: Amazing!!! :D

Thank you all folks!!!

Igor

Em quinta-feira, 30 de agosto de 2012 00h41min34s UTC-3, Massimo Di Pierro 
escreveu:
>
> After 5 months. It is done. This is the most waited and the most 
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is 
> considerably better than 1.99.7. It adds lot of new features and improves 
> many existing ones:
>
> - 57,000 new lines of code and closed 279 issues since 1.99.7.
> - Retrieving data from DB should be faster, in particular 
> select(cacheable=True)
> - Has a new scheduler, a built-in wiki, new language and pluralization 
> system, better markmin with oembed support and better scaffolding app, 
> increased security.
> - Lots of experimental features including GIS support, mongodb support, 
> built-in auth.wiki(), and more.
>
> Should be 100% backward compatible. If you run into any issue let us know 
> ASAP.
>
> I personally want to thank the major contributors to this release (in 
> alphabetic order)
> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg, Jonathan, 
> Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod, Patrick, 
> Vladyslav, 
> They spend many nights testing, coding, debugging at a very fast pace.
>
> Many many people have contributed.
>
> If your contribution has not been properly acknowledged please let us know 
> ASAP. It is probably an oversight.
>
>
> Massimo
>
>
> Detailed changelog
> ===
>
> ## 2.00.2
>
> ### DAL Improvements
>
> - Support for DAL(lazy_tables=True) and db.define_table(on_define=lambda 
> table:), thanks Jonathan
> - db(...).select(cacheable=True) make select 30% faster
> - db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
> - db(...).count(cache=(cache.ram,3600)) now supported
> - MongoDB support in DAL (experimental), thanks Mark Breedveld
> - geodal and spatialite, thanks Denes and Fran (experimental)
> - db.mytable._before_insert, _after_insert, _before_update, _after_update, 
> _before_delete. _after_delete (list of callbacks)
> - db(...).update_naive(...) same as update but ignores 
> table._before_update and table._after_update
> - DAL BIGINT support and DAL(...,bigint_id=True)
> - IS_IN_DB(..., distinct=True)
> - new syntax: db.mytable.insert(myuploadfield=open()), thank you 
> Iceberg
> - db(...).select(db.mytable.myfield.count(distinct=True))
> - db(db.a)._update(name=db(db.b.a==db.a.id).nested_select(db.b.id))
> - db.mytable.myfield.filter_in, filter_out
> - db.mytable._enable_record_versioning(db) adds versioning to this table
> - teradata adapter, thanks Andrew Willimott
> - experimental Sybase Adapter
> - added db.table.field.avg()
> - Support for Google App Engine projections, thanks Christian
> - Field(... 'upload', default=path) now accepts a path to a local file as 
> default value, if user does not upload a file. Relative path looks inside 
> current application folder, thanks Marin
> - executesql(...,fields=,columns=) allows parsing of results in Rows, 
> thanks Anthony
>
> ### Auth improvements
>
> - auth.enable_record_versioning(db)  adds full versioning to all tables
> - @auth.requires_login(otherwise=URL(...))
> - auth supports salt and compatible with third party data, thanks Dave 
> Stoll
> - CRYPT now defaults to pbkdf2(1000,20,sha1)
> - Built-in wiki with menu, tags, search, media, permissions. def index: 
> return auth.wiki()
> - auth.settings.everybody_group_id
> - allow storage of uploads on any PyFileSystem (including amazon)
>
> ### Form improvements
>
> - FORM.confirm('Are you sure?',{'Back':URL(...)})
> - SQLFORM.smartdictform(dict)
> - form.add_button(value,link)
> - SQLFORM.grid(groupby='...')
> - fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
> - more export options in SQLFORM.grid and SQLFORM.smartgrid (html, xml, 
> csv, ...)
>
> ### Admin improvements
>
> - new admin pages: manage_students, bulk_regsiter, and progress reports
> - increased security in admin against CSRF
> - experimental Git integration
> - experimental OpenShift deployment
> - multi-language pluralization engine 
> - ace text web editor in admin
> - Ukrainian translations, thanks Vladyslav Kozlovskyy
> - Romanian translation for welcome, thanks ionel
> - support for mercurial 2.6, thanks Vlad
>
> ### Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
>
> - web2py.py -K myapp -X starts the myapp scheduler alongside the webserver
> - tasks are marked EXPIRED (if stop_time passed)
> - functions with no result don't end up in scheduler_run
> - more options: web2py.py -E -b -L
> - scheduler can now handle 10k tasks with 20 concurrent workers and with 
> no issues
> - new params:
> tasks can be found in the environment (no need to define the tasks 
> parameter)
> max_empty_runs kills the workers automatically if no new tasks are 
> found in queue (nice for "spikes" of processing power)
> discard_results to complet

[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Sridhar
Hi Team, 

Thanks a ton for the new features and improvements!

I'm just getting started and was trying to run web2py.exe on Windows 7 
after downloading it from 
http://www.web2py.com/examples/static/web2py_win.zip (2.0.2 stable).

However, ran into this error:

** 
D:\web2py>web2py -S welcome
Traceback (most recent call last):
  File "web2py.py", line 16, in 
  File "gluon/__init__.py", line 15, in 
  File "gluon/globals.py", line 24, in 
  File "gluon/serializers.py", line 11, in 
  File "gluon/languages.py", line 264, in 
  File "gluon/languages.py", line 250, in read_possible_plurals
WindowsError: [Error 3] The system cannot find the path specified: 
'D:\\web2py\\gluon\\contrib\\rules/*.*'
**

Then, realized there was no folder called "gluon" in the extracted folder. 
I downloaded the source 
from http://www.web2py.com/examples/static/web2py_src.zip and copied the 
"gluon" folder from this source code to the previous web2py folder.

This solved the error and was able to web2py GUI. Hope this helps.

Regards,
Sridhar

On Thursday, August 30, 2012 9:11:34 AM UTC+5:30, Massimo Di Pierro wrote:
>
> After 5 months. It is done. This is the most waited and the most 
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is 
> considerably better than 1.99.7. It adds lot of new features and improves 
> many existing ones:
>
> - 57,000 new lines of code and closed 279 issues since 1.99.7.
> - Retrieving data from DB should be faster, in particular 
> select(cacheable=True)
> - Has a new scheduler, a built-in wiki, new language and pluralization 
> system, better markmin with oembed support and better scaffolding app, 
> increased security.
> - Lots of experimental features including GIS support, mongodb support, 
> built-in auth.wiki(), and more.
>
> Should be 100% backward compatible. If you run into any issue let us know 
> ASAP.
>
> I personally want to thank the major contributors to this release (in 
> alphabetic order)
> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg, Jonathan, 
> Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod, Patrick, 
> Vladyslav, 
> They spend many nights testing, coding, debugging at a very fast pace.
>
> Many many people have contributed.
>
> If your contribution has not been properly acknowledged please let us know 
> ASAP. It is probably an oversight.
>
>
> Massimo
>
>
> Detailed changelog
> ===
>
> ## 2.00.2
>
> ### DAL Improvements
>
> - Support for DAL(lazy_tables=True) and db.define_table(on_define=lambda 
> table:), thanks Jonathan
> - db(...).select(cacheable=True) make select 30% faster
> - db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
> - db(...).count(cache=(cache.ram,3600)) now supported
> - MongoDB support in DAL (experimental), thanks Mark Breedveld
> - geodal and spatialite, thanks Denes and Fran (experimental)
> - db.mytable._before_insert, _after_insert, _before_update, _after_update, 
> _before_delete. _after_delete (list of callbacks)
> - db(...).update_naive(...) same as update but ignores 
> table._before_update and table._after_update
> - DAL BIGINT support and DAL(...,bigint_id=True)
> - IS_IN_DB(..., distinct=True)
> - new syntax: db.mytable.insert(myuploadfield=open()), thank you 
> Iceberg
> - db(...).select(db.mytable.myfield.count(distinct=True))
> - db(db.a)._update(name=db(db.b.a==db.a.id).nested_select(db.b.id))
> - db.mytable.myfield.filter_in, filter_out
> - db.mytable._enable_record_versioning(db) adds versioning to this table
> - teradata adapter, thanks Andrew Willimott
> - experimental Sybase Adapter
> - added db.table.field.avg()
> - Support for Google App Engine projections, thanks Christian
> - Field(... 'upload', default=path) now accepts a path to a local file as 
> default value, if user does not upload a file. Relative path looks inside 
> current application folder, thanks Marin
> - executesql(...,fields=,columns=) allows parsing of results in Rows, 
> thanks Anthony
>
> ### Auth improvements
>
> - auth.enable_record_versioning(db)  adds full versioning to all tables
> - @auth.requires_login(otherwise=URL(...))
> - auth supports salt and compatible with third party data, thanks Dave 
> Stoll
> - CRYPT now defaults to pbkdf2(1000,20,sha1)
> - Built-in wiki with menu, tags, search, media, permissions. def index: 
> return auth.wiki()
> - auth.settings.everybody_group_id
> - allow storage of uploads on any PyFileSystem (including amazon)
>
> ### Form improvements
>
> - FORM.confirm('Are you sure?',{'Back':URL(...)})
> - SQLFORM.smartdictform(dict)
> - form.add_button(value,link)
> - SQLFORM.grid(groupby='...')
> - fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
> - more export options in SQLFORM.grid and SQLFORM.smartgrid (html, xml, 
> csv, ...)
>
> ### Admin improvements
>
> - new admin pages: manage_students, bulk_regsiter, and progress reports
> - increase

[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Niphlod
yep, a new column was added and it's defined to be unique. When it gets 
created if you have n rows already in the table the values in the column 
are not unique, hence the error. If no rows are in the scheduler_task 
table, no error should show up.

On Thursday, August 30, 2012 2:23:18 PM UTC+2, Tyrone wrote:
>
> It appears that it's an incompatibility with the original tables, when I 
> delete everything the problem goes away. I got around the problem by 
> deleting everything, and then overwriting the new database with the old 
> one, excluding the scheduler tables.

-- 





[web2py] Re: DAL backward compatibility problem?

2012-08-30 Thread Manuele Pesenti

Il 30/08/2012 12:09, Manuele Pesenti ha scritto:

and these are the two incriminated code lines:

51 f_max = db.plugin_lookout_connections.id.max()
52 id_max = db().select(f_max).first()[f_max] or 0

the problem is by-passed using the following one instead of the line 52

id_max = db(db.plugin_lookout_connections).select(f_max).first()[f_max] or 0

M.

--





Re: [web2py] web2py 2.0.2 is out

2012-08-30 Thread Emanuel Woiski
Thank you to Maximo and all the developers for making the best web
framework even better:)
regards
woiski

2012/8/30 Massimo Di Pierro 

> After 5 months. It is done. This is the most waited and the most
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is
> considerably better than 1.99.7. It adds lot of new features and improves
> many existing ones:
>
> - 57,000 new lines of code and closed 279 issues since 1.99.7.
> - Retrieving data from DB should be faster, in particular
> select(cacheable=True)
> - Has a new scheduler, a built-in wiki, new language and pluralization
> system, better markmin with oembed support and better scaffolding app,
> increased security.
> - Lots of experimental features including GIS support, mongodb support,
> built-in auth.wiki(), and more.
>
> Should be 100% backward compatible. If you run into any issue let us know
> ASAP.
>
> I personally want to thank the major contributors to this release (in
> alphabetic order)
> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg, Jonathan,
> Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod, Patrick,
> Vladyslav,
> They spend many nights testing, coding, debugging at a very fast pace.
>
> Many many people have contributed.
>
> If your contribution has not been properly acknowledged please let us know
> ASAP. It is probably an oversight.
>
>
> Massimo
>
>
>
>

-- 





[web2py] Re: GAE with Janrain problem 2.0.2

2012-08-30 Thread howesc
i have not run the code yet.

but upon inspection i like that line 1619 of gluon/tools.py is redundant, 
and because it uses an OR query it breaks on GAE.

can someone confirm that:

user = user or table_user._db(
(table_user.registration_id==value)|
(table_user[fieldname]==value)).select().first()

can be replaced with :

user = user or table_user._db(
(table_user[fieldname]==value)).select().first()

in auth.get_or_create_user() without breaking anything?
On Thursday, August 30, 2012 3:59:39 AM UTC-7, rif wrote:
>
> After a succesful login from janrain running on GAE I get the following 
> error:
>
> Traceback (most recent call last):
>   File "/home/rif/Documents/webframeworks/homepage/gluon/restricted.py", 
> line 209, in restricted
> exec ccode in environment
>   File 
> "/home/rif/Documents/webframeworks/homepage/applications/init/controllers/default.py",
>  
> line 105, in 
>   File "/home/rif/Documents/webframeworks/homepage/gluon/globals.py", line 
> 185, in 
> self._caller = lambda f: f()
>   File 
> "/home/rif/Documents/webframeworks/homepage/applications/init/controllers/default.py",
>  
> line 103, in user
> return dict(form=auth())
>   File "/home/rif/Documents/webframeworks/homepage/gluon/tools.py", line 
> 1191, in __call__
> return getattr(self,args[0])()
>   File "/home/rif/Documents/webframeworks/homepage/gluon/tools.py", line 
> 1961, in login
> user = self.get_or_create_user(table_user._filter_fields(cas_user))
>   File "/home/rif/Documents/webframeworks/homepage/gluon/tools.py", line 
> 1620, in get_or_create_user
> (table_user[fieldname]==value)).select().first()
>   File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
> 8682, in select
> return adapter.select(self.query,fields,attributes)
>   File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
> 4461, in select
> (items, tablename, fields) = self.select_raw(query,fields,attributes)
>   File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
> 4356, in select_raw
> filters = self.expand(query)
>   File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
> 4232, in expand
> return expression.op(expression.first, expression.second)
>   File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
> 4087, in OR
> def OR(self,first,second): raise SyntaxError, "Not supported"
> SyntaxError: Not supported
>
>
> Does anybody experience the same problem?
>

-- 





[web2py] Re: Error creating a grid when no user is logged in

2012-08-30 Thread Massimo Di Pierro
fixing in 2.0.3


On Thursday, 30 August 2012 03:59:17 UTC-5, Liam wrote:
>
> Hi all,
>
> When creating a grid and no user is logged in, I get an AttributeError: 
> 'NoneType' object has no attribute 'user'.
>
> This can be recreated using vanilla web2py 2.0.2:
> $ python web2py.py -S welcome -M
> ...
>
> In [1]: SQLFORM.grid(db.auth_user)
> ...
>1660 if (args != request.args and user_signature and \
>1661 not URL.verify(request,user_signature=
> user_signature)) or \
> -> 1662 (not session.auth.user and \
>1663  ('edit' in request.args or \
>1664   'create' in request.args or \
>
> AttributeError: 'NoneType' object has no attribute 'user'
>
> In [2]: from gluon import current
>
> In [3]: current.session
> Out[3]: 
>
> I think that the grid function is using the wrong check to see if a user 
> is logged in. The relevant line is
> not session.auth.user
>
> Perhaps it should be?
> not session.auth
>
> On another much less important note, I thought the correct Pythonic way to 
> check for None is:
> session.auth is None
> ;)
>
> Cheers,
> Liam
>

-- 





[web2py] Re: Internal Error clicking on the "mailing list" link on the official support page

2012-08-30 Thread Massimo Di Pierro
Thanks. Fixing in 2.0.3

On Thursday, 30 August 2012 04:57:25 UTC-5, Nico Zanferrari wrote:
>
> Hello,
>
> I've found that on the official support web page (
> http://web2py.com/examples/default/support) if you click on the first 
> link (= *mailing list* , that points to 
> http://web2py.com/examples/default/usergroups ) you always get a Internal 
> Error.
>
> Nico
>

-- 





[web2py] Re: removed form.vars.{fieldname}_newfilename -- I used it :(

2012-08-30 Thread Massimo Di Pierro
This is an undocumented feature. You should be able to just use 

form.vars.fieldname 

instead of

form.vars.fieldname_newfieldname

it was redundant

On Thursday, 30 August 2012 05:18:52 UTC-5, szimszon wrote:
>
> Hi!
>
>
> https://github.com/mdipierro/web2py/commit/74418b1a6962bf2db36b46f9620e16297abfd059
>
> I used it :(
>

-- 





[web2py] w2p 2.0.2 problems with existing field with upper case name

2012-08-30 Thread Manuele Pesenti
another problem jumped out using new 2.0.2 release having tables with 
camel case field names. This is the traceback


Traceback (most recent call last):
  File 
"/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/restricted.py", line 
209, in restricted

exec ccode in environment
  File 
"/home/manuele/Dropbox/sviluppo/web2py-2.0.2/applications/theseus/models/plugin_openlayers.py", 
line 205, in 

fake_migrate = plugin_openlayers_fake_migrate
  File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py", line 
7041, in define_table

table = self.lazy_define_table(tablename,*fields,**args)
  File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py", line 
7072, in lazy_define_table

polymodel=polymodel)
  File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py", line 
876, in create_table

fake_migrate=fake_migrate)
  File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py", line 
944, in migrate_table

and not isinstance(table[key].type, SQLCustomType) \
  File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py", line 
7553, in __getitem__

return ogetattr(self, str(key))
AttributeError: 'Table' object has no attribute 'thematiclayer_id'

the problem seams to be the function fix hre under reported and defined 
inside the migrate_table method in DAL that returns k.lower() and not 
only k even if upper case field name are supported by the db used:


def fix(item):
k,v=item
if not isinstance(v,dict):
v=dict(type='unkown',sql=v)
return k.lower(),v
### make sure all field names are lower case to avoid conflicts


As said before I'm trying to migrate an existing aplication to new 
framework release so I don't want to change the model because there are 
data in tables I don't want to loose so I don't think that to change my 
field names it's a good solution. Can you help me?


Cheers

Manuele

--





Re: [web2py] Re: web editor problems with 2.0.2

2012-08-30 Thread Massimo Di Pierro
Can you try replacing applications/admin/static/ace with the latest version 
from ace github? If it works, would you send me a patch?

On Thursday, 30 August 2012 07:46:09 UTC-5, Manuele wrote:
>
> Il 30/08/2012 14:18, Massimo Di Pierro ha scritto: 
> > What os and what version? 
>
> Debian GNU/Linux 3.2.0-2-486 
>
> Cromium version 13.0.782.107 (Developer Build 94237 Linux) Built on 
> Debian unstable, running on Debian wheezy/sid 
>
> on the same pc works fine with firefox (14.0.1) 
>
> hope to be of any help 
>
>  M. 
>

-- 





[web2py] Re: w2p 2.0.2 problems with existing field with upper case name

2012-08-30 Thread Manuele Pesenti

Il 30/08/2012 15:22, Manuele Pesenti ha scritto:
another problem jumped out using new 2.0.2 release having tables with 
camel case field names. This is the traceback


Traceback (most recent call last):
  File 
"/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/restricted.py", 
line 209, in restricted

exec ccode in environment
  File 
"/home/manuele/Dropbox/sviluppo/web2py-2.0.2/applications/theseus/models/plugin_openlayers.py", 
line 205, in 

fake_migrate = plugin_openlayers_fake_migrate
  File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py", 
line 7041, in define_table

table = self.lazy_define_table(tablename,*fields,**args)
  File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py", 
line 7072, in lazy_define_table

polymodel=polymodel)
  File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py", 
line 876, in create_table

fake_migrate=fake_migrate)
  File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py", 
line 944, in migrate_table

and not isinstance(table[key].type, SQLCustomType) \
  File "/home/manuele/Dropbox/sviluppo/web2py-2.0.2/gluon/dal.py", 
line 7553, in __getitem__

return ogetattr(self, str(key))
AttributeError: 'Table' object has no attribute 'thematiclayer_id'


maybe it's useful to highlight that the attribute error is raised 
because the table has a field called "thematicLayer_id" with the "L" 
(UPPERCASE).


M



the problem seams to be the function fix hre under reported and 
defined inside the migrate_table method in DAL that returns k.lower() 
and not only k even if upper case field name are supported by the db 
used:


def fix(item):
k,v=item
if not isinstance(v,dict):
v=dict(type='unkown',sql=v)
return k.lower(),v
### make sure all field names are lower case to avoid conflicts


As said before I'm trying to migrate an existing aplication to new 
framework release so I don't want to change the model because there 
are data in tables I don't want to loose so I don't think that to 
change my field names it's a good solution. Can you help me?


Cheers

Manuele


--





[web2py] Re: GAE with Janrain problem 2.0.2

2012-08-30 Thread Massimo Di Pierro
That was it. Fixing in 2.0.3


On Thursday, 30 August 2012 08:06:42 UTC-5, howesc wrote:
>
> i have not run the code yet.
>
> but upon inspection it looks like line 1619 of gluon/tools.py is 
> redundant, and because it uses an OR query it breaks on GAE.
>
> can someone confirm that:
>
> user = user or table_user._db(
> (table_user.registration_id==value)|
> (table_user[fieldname]==value)).select().first()
>
> can be replaced with :
>
> user = user or table_user._db(
> (table_user[fieldname]==value)).select().first()
>
> in auth.get_or_create_user() without breaking anything?
> On Thursday, August 30, 2012 3:59:39 AM UTC-7, rif wrote:
>>
>> After a succesful login from janrain running on GAE I get the following 
>> error:
>>
>> Traceback (most recent call last):
>>   File "/home/rif/Documents/webframeworks/homepage/gluon/restricted.py", 
>> line 209, in restricted
>> exec ccode in environment
>>   File 
>> "/home/rif/Documents/webframeworks/homepage/applications/init/controllers/default.py",
>>  
>> line 105, in 
>>   File "/home/rif/Documents/webframeworks/homepage/gluon/globals.py", 
>> line 185, in 
>> self._caller = lambda f: f()
>>   File 
>> "/home/rif/Documents/webframeworks/homepage/applications/init/controllers/default.py",
>>  
>> line 103, in user
>> return dict(form=auth())
>>   File "/home/rif/Documents/webframeworks/homepage/gluon/tools.py", line 
>> 1191, in __call__
>> return getattr(self,args[0])()
>>   File "/home/rif/Documents/webframeworks/homepage/gluon/tools.py", line 
>> 1961, in login
>> user = self.get_or_create_user(table_user._filter_fields(cas_user))
>>   File "/home/rif/Documents/webframeworks/homepage/gluon/tools.py", line 
>> 1620, in get_or_create_user
>> (table_user[fieldname]==value)).select().first()
>>   File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
>> 8682, in select
>> return adapter.select(self.query,fields,attributes)
>>   File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
>> 4461, in select
>> (items, tablename, fields) = self.select_raw(query,fields,attributes)
>>   File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
>> 4356, in select_raw
>> filters = self.expand(query)
>>   File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
>> 4232, in expand
>> return expression.op(expression.first, expression.second)
>>   File "/home/rif/Documents/webframeworks/homepage/gluon/dal.py", line 
>> 4087, in OR
>> def OR(self,first,second): raise SyntaxError, "Not supported"
>> SyntaxError: Not supported
>>
>>
>> Does anybody experience the same problem?
>>
>

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Massimo Di Pierro
Please can you post a concrete example?

On Thursday, 30 August 2012 02:02:42 UTC-5, Annet wrote:
>
> Congratulations to all!
>
> Should be 100% backward compatible. If you run into any issue let us know 
>> ASAP.
>>
>
> It's not a backward compatibility issue but after updating from 2.0.1 to 
> 2.0.2 the admin's flash messages no longer show up.
>
> Kind regards,
>
> Annet
>

-- 





[web2py] Re: removed form.vars.{fieldname}_newfilename -- I used it :(

2012-08-30 Thread szimszon
Thanks.

2012. augusztus 30., csütörtök 15:20:05 UTC+2 időpontban Massimo Di Pierro 
a következőt írta:
>
> This is an undocumented feature. You should be able to just use 
>
> form.vars.fieldname 
>
> instead of
>
> form.vars.fieldname_newfieldname
>
> it was redundant
>
> On Thursday, 30 August 2012 05:18:52 UTC-5, szimszon wrote:
>>
>> Hi!
>>
>>
>> https://github.com/mdipierro/web2py/commit/74418b1a6962bf2db36b46f9620e16297abfd059
>>
>> I used it :(
>>
>

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Mike Girard
Great news. Can't wait to try it out. Thanks, everyone!

On Wednesday, August 29, 2012 11:41:34 PM UTC-4, Massimo Di Pierro wrote:
>
> After 5 months. It is done. This is the most waited and the most 
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is 
> considerably better than 1.99.7. It adds lot of new features and improves 
> many existing ones:
>
> - 57,000 new lines of code and closed 279 issues since 1.99.7.
> - Retrieving data from DB should be faster, in particular 
> select(cacheable=True)
> - Has a new scheduler, a built-in wiki, new language and pluralization 
> system, better markmin with oembed support and better scaffolding app, 
> increased security.
> - Lots of experimental features including GIS support, mongodb support, 
> built-in auth.wiki(), and more.
>
> Should be 100% backward compatible. If you run into any issue let us know 
> ASAP.
>
> I personally want to thank the major contributors to this release (in 
> alphabetic order)
> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg, Jonathan, 
> Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod, Patrick, 
> Vladyslav, 
> They spend many nights testing, coding, debugging at a very fast pace.
>
> Many many people have contributed.
>
> If your contribution has not been properly acknowledged please let us know 
> ASAP. It is probably an oversight.
>
>
> Massimo
>
>
> Detailed changelog
> ===
>
> ## 2.00.2
>
> ### DAL Improvements
>
> - Support for DAL(lazy_tables=True) and db.define_table(on_define=lambda 
> table:), thanks Jonathan
> - db(...).select(cacheable=True) make select 30% faster
> - db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
> - db(...).count(cache=(cache.ram,3600)) now supported
> - MongoDB support in DAL (experimental), thanks Mark Breedveld
> - geodal and spatialite, thanks Denes and Fran (experimental)
> - db.mytable._before_insert, _after_insert, _before_update, _after_update, 
> _before_delete. _after_delete (list of callbacks)
> - db(...).update_naive(...) same as update but ignores 
> table._before_update and table._after_update
> - DAL BIGINT support and DAL(...,bigint_id=True)
> - IS_IN_DB(..., distinct=True)
> - new syntax: db.mytable.insert(myuploadfield=open()), thank you 
> Iceberg
> - db(...).select(db.mytable.myfield.count(distinct=True))
> - db(db.a)._update(name=db(db.b.a==db.a.id).nested_select(db.b.id))
> - db.mytable.myfield.filter_in, filter_out
> - db.mytable._enable_record_versioning(db) adds versioning to this table
> - teradata adapter, thanks Andrew Willimott
> - experimental Sybase Adapter
> - added db.table.field.avg()
> - Support for Google App Engine projections, thanks Christian
> - Field(... 'upload', default=path) now accepts a path to a local file as 
> default value, if user does not upload a file. Relative path looks inside 
> current application folder, thanks Marin
> - executesql(...,fields=,columns=) allows parsing of results in Rows, 
> thanks Anthony
>
> ### Auth improvements
>
> - auth.enable_record_versioning(db)  adds full versioning to all tables
> - @auth.requires_login(otherwise=URL(...))
> - auth supports salt and compatible with third party data, thanks Dave 
> Stoll
> - CRYPT now defaults to pbkdf2(1000,20,sha1)
> - Built-in wiki with menu, tags, search, media, permissions. def index: 
> return auth.wiki()
> - auth.settings.everybody_group_id
> - allow storage of uploads on any PyFileSystem (including amazon)
>
> ### Form improvements
>
> - FORM.confirm('Are you sure?',{'Back':URL(...)})
> - SQLFORM.smartdictform(dict)
> - form.add_button(value,link)
> - SQLFORM.grid(groupby='...')
> - fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
> - more export options in SQLFORM.grid and SQLFORM.smartgrid (html, xml, 
> csv, ...)
>
> ### Admin improvements
>
> - new admin pages: manage_students, bulk_regsiter, and progress reports
> - increased security in admin against CSRF
> - experimental Git integration
> - experimental OpenShift deployment
> - multi-language pluralization engine 
> - ace text web editor in admin
> - Ukrainian translations, thanks Vladyslav Kozlovskyy
> - Romanian translation for welcome, thanks ionel
> - support for mercurial 2.6, thanks Vlad
>
> ### Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
>
> - web2py.py -K myapp -X starts the myapp scheduler alongside the webserver
> - tasks are marked EXPIRED (if stop_time passed)
> - functions with no result don't end up in scheduler_run
> - more options: web2py.py -E -b -L
> - scheduler can now handle 10k tasks with 20 concurrent workers and with 
> no issues
> - new params:
> tasks can be found in the environment (no need to define the tasks 
> parameter)
> max_empty_runs kills the workers automatically if no new tasks are 
> found in queue (nice for "spikes" of processing power)
> discard_results to completely discard the results (if you don't need 
> the output

Re: [web2py] Re: web editor problems with 2.0.2

2012-08-30 Thread Manuele Pesenti

Il 30/08/2012 15:24, Massimo Di Pierro ha scritto:
Can you try replacing applications/admin/static/ace with the latest 
version from ace github? If it works, would you send me a patch?
well in this way it's even worse... I have the same problem with firefox 
(and again with chromium)


M.

--





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

2012-08-30 Thread Richard Vézina
Will try to do a dummy app ASAP.

Richard

On Wed, Aug 29, 2012 at 10:07 PM, lyn2py  wrote:

> Ok noted on your points below. I would like to clarify.
>
> First, the plugin files are only a controller file and a module file. they
> are both the same as on the web page.
> Second, I have modified the module file so that it recognizes the first
> SELECT field, so the widget initialization looks different from the example
> on the website.
> Third, regarding your comment that the plugin (module file) should be the
> one that returns the HTML, this I am not too sure.  When I run the original
> code, the ajax call goes to the controller, not the module file. And the
> controller looks like
>
> def index():
> form = SQLFORM(db.product)
> if form.accepts(request.vars, session):
> session.flash = 'submitted %s' % form.vars
> redirect(URL('index'))
> return dict(form=form,
> categories=SQLTABLE(db().select(db.category.ALL)),
> colors=SQLTABLE(db(db.color.id > 0)(db.color.category == 
> db.category.id
> ).select(db.color.id, db.category.name, 
> db.color.name)))
>
>
> Questions:
> Per your reply below, How does the widget "call" itself from the
> controller and return the select field?
>
> I think I don't understand the widget as well as you do. As you already
> have my model and controller code, can you give me an example of how my
> controller code should look like so that the widget works?
>
> Thanks.
>
> On Thursday, August 30, 2012 3:44:58 AM UTC+8, Richard wrote:
>
>> Here the example about how to initialize the widget :
>>
>> db.product.color.widget = lazy_options_widget(
>>
>>   'product_category__selected', 
>> 'product_category__unselected'**,
>>
>>   lambda category_id: (db.color.category == category_id),
>>
>>   request.vars.category,
>>
>>   orderby=db.color.id,
>>
>>   user_signature=True,
>>
>>   # If you want to process ajax requests at the time of the 
>> object construction (not at the form rendered),
>>
>>   # specify your target field in the following:
>>   field=db.product.color,
>>
>>   )
>>
>>
>> I am not sure what are : 'jsChangeOn','jsChangeOff',
>>
>> In your widget init...
>>
>> And I don't understand why you need to create a lazy_option function??
>>
>> Did you install the plugin into your app and make the proper import or
>> did you try to just copy/paste the code provided on the web page of
>> s-cubism??
>>
>> You don't need the your function it suppose to be the lazy_option_widget
>> that do this task of making the ajax call and return the answer from the
>> database to your view and update you dropbox (html SELECT OPTIONS)...
>>
>> I am puzzled a bit.
>>
>> R
>>
>> On Wed, Aug 29, 2012 at 12:02 PM, lyn2py  wrote:
>>
>>> OK sure :)
>>>
>>> MODELS
>>> db.define_table('quotations',
>>> Field('company_id','reference companies'),
>>> Field('contact_id','reference contacts',
>>> widget=lazy_options_widget('**jsChangeOn','jsChangeOff',
>>> lambda customer_id: (db.contacts.customer_id == customer_id),
>>> trigger=request.vars.customer_**id, keyword="id",
>>> user_signature=True)
>>> ),
>>> Field('name','string',length=**255,requires=IS_NOT_EMPTY()),
>>> )
>>>
>>> db.companies and db.contacts are just separate tables, where each
>>> company can have many different contacts.
>>>
>>> CONTROLLER
>>> def test():
>>> form=SQLFORM(db.quotations)
>>> # rows = 
>>> db(db.contacts.customer_id==re**quest.post_vars.id
>>> ).select()
>>> return locals()
>>>
>>> def lazy_options():
>>> if request.env.request_method=='**POST':
>>> rows = 
>>> db(db.contacts.customer_id==re**quest.post_vars.id
>>> ).select()
>>> return SQLTABLE(rows)
>>> else:
>>> return None
>>>
>>> As I have no intentions to save the form, dbio codes has been left out.
>>>
>>> I am using a generic view.
>>> I made changes to the plugin to recognize the javascript onchange, so
>>> there is no problems with detecting and making the ajax call. The ajax call
>>> goes to a separate page "lazy_options" in the same controller.
>>>
>>> Whenever the first field onchange is triggered, the second field will
>>> update (expected behavior).
>>> But the html that appears is not a SELECT field.
>>>
>>> I use SQLTABLE(rows) because that was in the example provided. In place
>>> of that I have tried "return rows", tried to assemble SELECT/OPTIONS on my
>>> own to no avail.
>>>
>>> I appreciate your help! What am I missing? Thank you :)
>>>
>>>
>>> On Wednesday, August 29, 2012 11:06:37 PM UTC+8, Richard wrote:
>>>
 Can you provide :

 Models (for the concerned tables)
 Controller (page form concerned)
 View (of the function page)

 It will be easi

Re: [web2py] upgrade ubuntu to 12.04.1

2012-08-30 Thread Richard Vézina
Under ubuntu 12.04 default postgres version is 9.0

I saw a few email in the pass 3 mounts on the list about little issue,
don't know they solve it or they downgrade.

I guest there is not so much user under 12.04 yet.

But, it will change soon I think with some speed improvement discus by
Massimo that you only can have under python 2.7.x

I plan to migrate before the end of the year.

Interested in your experience if you go with 12.04

Richard

On Thu, Aug 30, 2012 at 3:55 AM, andrej burja wrote:

> hi
>
> i installed web2py with script found here. currently i have ubuntu 10.04.
> has anybody upgraded ubuntu from 10.04 to 12.04.1? are there any problems
> (regarding web2py or postgres 8.4)? should i upgrade or wait some time?
>
> andrej
>
> --
>
>
>
>

-- 





[web2py] web2py 2.02 ( stable) install right next to web2py 1.99.7 (stable) under home/www-data/ ....

2012-08-30 Thread Don_X
Hello all ...

does anyone have any suggestion on how to proceed with a parallel install 
of the latest web2py 2.02 ( stable )  under the home/www-data directory ...

without messing up my previous 1.99.7  ( which has many apps and custom 
test apps and exercises that I have made ... ) ...

PS. the check for upgrades button within the 1.99.7 is not responding ( ! 
.. and I think I would prefer to leave the 1.99.7 intact ... and  put the 
2.02 right next to it  under my apache localhost )

I am using Apache 2.2.22 ( Ubuntu ) for my main production environment ...  
instead of the default rocket server

does anyone have a modified version of the web2py & default files under the 
/etc/apache2/sites-available  that can take into account both web2py 
installs under  /home/www-data  directory 

let's say ... 1 called web2py ( the 1.99.7 one )
and the other called w2p202 ( the latest one )

please advise ...

I am thinking that this might be a bit more complicated than anticipated 
under apache2 !!

thank you

Don

thanks

Don

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Yarin
Congratulations and many thanks to Massimo and all contributors - the best 
framework keeps getting better

-- 





Re: [web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Richard Vézina
Only one word : Thanks

Richard

On Thu, Aug 30, 2012 at 10:09 AM, Yarin  wrote:

> Congratulations and many thanks to Massimo and all contributors - the best
> framework keeps getting better
>
> --
>
>
>
>

-- 





Re: [web2py] 'Auth' object has no attribute 'use_username'

2012-08-30 Thread Jonathan Lundell
On 30 Aug 2012, at 1:24 AM, Annet  wrote:
> In web2py 2.0.2 in an application in which I commented out:
> 
> # auth.define_tables(username=False, signature=False)
> 
> I defined a new table, after saving db.py, when I click the database 
> administration button I get the following error:
> 
> 
> Version
> 
> web2py™   (2, 0, 2, datetime.datetime(2012, 8, 30, 4, 8, 18), 'stable')
> PythonPython 2.6.1: /usr/bin/python2.6
> Traceback
> 
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> Traceback (most recent call last):
>   File "/Library/Python/2.6/site-packages/web2py/gluon/restricted.py", line 
> 209, in restricted
> exec ccode in environment
>   File 
> "/Library/Python/2.6/site-packages/web2py/applications/init/views/appadmin.html",
>  line 53, in 
> {{=form}}
>   File "/Library/Python/2.6/site-packages/web2py/gluon/tools.py", line 1260, 
> in navbar
> if self.use_username and \
> AttributeError: 'Auth' object has no attribute 'use_username'
> 

A workaround: set auth.use_username to True or False depending on whether 
you're using a 'username' field in your auth user table. I suppose that 
Auth.__init__ ought to provide a default False value.

-- 





Re: [web2py] Simultaneously insert in two tables within one form

2012-08-30 Thread jw
Yes, of course. But in my mention, I have a different task to do. There is 
a dircet dependency between groupCards and answer. Answer can only exist, 
when groupCard exist before. There should be a way to test this and to 
generate a groupCard if it doesn't exist before. My problem is, that I want 
to do this just in one step.
BTW: Am I right, that I can only display a dropdown-menu for a table for 
update/insert/delete-reasons and not just for selecting one row to work 
with the selected item in the next step?

On Wednesday, August 29, 2012 4:13:32 PM UTC+2, Richard wrote:
>
> Did you read this ?
> http://web2py.com/books/default/chapter/29/7#One-form-for-multiple-tables
>
> Richard
>
>
> On Wed, Aug 29, 2012 at 6:03 AM, jw  >wrote:
>
>> I have a quite similar question to this unrepleyd post: 
>> https://groups.google.com/forum/?fromgroups=#!searchin/web2py/form$20simultaneously$20insert/web2py/w44ZEk0ODsk/aCy4XmPmQmQJ
>>
>> I try to realize one form within two tables get an insert by accepting 
>> the form.
>>
>> db.card.subject_id.default = subject_id 
>> db.groupCards.studyGroup_id.default = auth.user.studyGroup_id
>> db.answers.user_id.default = auth.user.id
>> db.answers.datetime.writable = False
>> factory=SQLFORM.factory(db.card,db.groupCards,db.answers)
>>
>> As you can see in both pictures and the code above, I've some 
>> default-values when setting up the form.
>> I would like to select the question (Frage), depending from the default 
>> subject. Now, I get all the questions in the table.
>> After that, the user writes his answer and the answer should be inserted 
>> in the answer table and in the same time with the link to the new inserted 
>> groupCard.
>> Is this possible with web2py or do I have first insert a new groupCard 
>> and insert a answer after this in a second form?
>>
>> Sorry for my English.
>>
>> Thanks in advance,
>> Jens
>>
>>  -- 
>>  
>>  
>>  
>>
>
>

-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Adi
Thank you Massimo and ALL contributors!!!

Starting migration tests now...


On Wednesday, August 29, 2012 11:41:34 PM UTC-4, Massimo Di Pierro wrote:
>
> After 5 months. It is done. This is the most waited and the most 
> feature-packed release.
>
> I am sure we'll find some corners that need to be ironed but it is 
> considerably better than 1.99.7. It adds lot of new features and improves 
> many existing ones:
>
> - 57,000 new lines of code and closed 279 issues since 1.99.7.
> - Retrieving data from DB should be faster, in particular 
> select(cacheable=True)
> - Has a new scheduler, a built-in wiki, new language and pluralization 
> system, better markmin with oembed support and better scaffolding app, 
> increased security.
> - Lots of experimental features including GIS support, mongodb support, 
> built-in auth.wiki(), and more.
>
> Should be 100% backward compatible. If you run into any issue let us know 
> ASAP.
>
> I personally want to thank the major contributors to this release (in 
> alphabetic order)
> Alan, Andrew, Anthony, Bruno, Christian, Dave, Dominic, Iceberg, Jonathan, 
> Marc, Mariano, Marin, Martin, Mark, Michael, Michele, Niphlod, Patrick, 
> Vladyslav, 
> They spend many nights testing, coding, debugging at a very fast pace.
>
> Many many people have contributed.
>
> If your contribution has not been properly acknowledged please let us know 
> ASAP. It is probably an oversight.
>
>
> Massimo
>
>
> Detailed changelog
> ===
>
> ## 2.00.2
>
> ### DAL Improvements
>
> - Support for DAL(lazy_tables=True) and db.define_table(on_define=lambda 
> table:), thanks Jonathan
> - db(...).select(cacheable=True) make select 30% faster
> - db(...).select(cache=(cache.ram,3600)) now caches parsed data 100x faster
> - db(...).count(cache=(cache.ram,3600)) now supported
> - MongoDB support in DAL (experimental), thanks Mark Breedveld
> - geodal and spatialite, thanks Denes and Fran (experimental)
> - db.mytable._before_insert, _after_insert, _before_update, _after_update, 
> _before_delete. _after_delete (list of callbacks)
> - db(...).update_naive(...) same as update but ignores 
> table._before_update and table._after_update
> - DAL BIGINT support and DAL(...,bigint_id=True)
> - IS_IN_DB(..., distinct=True)
> - new syntax: db.mytable.insert(myuploadfield=open()), thank you 
> Iceberg
> - db(...).select(db.mytable.myfield.count(distinct=True))
> - db(db.a)._update(name=db(db.b.a==db.a.id).nested_select(db.b.id))
> - db.mytable.myfield.filter_in, filter_out
> - db.mytable._enable_record_versioning(db) adds versioning to this table
> - teradata adapter, thanks Andrew Willimott
> - experimental Sybase Adapter
> - added db.table.field.avg()
> - Support for Google App Engine projections, thanks Christian
> - Field(... 'upload', default=path) now accepts a path to a local file as 
> default value, if user does not upload a file. Relative path looks inside 
> current application folder, thanks Marin
> - executesql(...,fields=,columns=) allows parsing of results in Rows, 
> thanks Anthony
>
> ### Auth improvements
>
> - auth.enable_record_versioning(db)  adds full versioning to all tables
> - @auth.requires_login(otherwise=URL(...))
> - auth supports salt and compatible with third party data, thanks Dave 
> Stoll
> - CRYPT now defaults to pbkdf2(1000,20,sha1)
> - Built-in wiki with menu, tags, search, media, permissions. def index: 
> return auth.wiki()
> - auth.settings.everybody_group_id
> - allow storage of uploads on any PyFileSystem (including amazon)
>
> ### Form improvements
>
> - FORM.confirm('Are you sure?',{'Back':URL(...)})
> - SQLFORM.smartdictform(dict)
> - form.add_button(value,link)
> - SQLFORM.grid(groupby='...')
> - fixed security issue with SQLFORM.grid and SQLFORM.smartgrid
> - more export options in SQLFORM.grid and SQLFORM.smartgrid (html, xml, 
> csv, ...)
>
> ### Admin improvements
>
> - new admin pages: manage_students, bulk_regsiter, and progress reports
> - increased security in admin against CSRF
> - experimental Git integration
> - experimental OpenShift deployment
> - multi-language pluralization engine 
> - ace text web editor in admin
> - Ukrainian translations, thanks Vladyslav Kozlovskyy
> - Romanian translation for welcome, thanks ionel
> - support for mercurial 2.6, thanks Vlad
>
> ### Scheduler Improvements (thanks to niphlod, ykessler, dhx, toomim)
>
> - web2py.py -K myapp -X starts the myapp scheduler alongside the webserver
> - tasks are marked EXPIRED (if stop_time passed)
> - functions with no result don't end up in scheduler_run
> - more options: web2py.py -E -b -L
> - scheduler can now handle 10k tasks with 20 concurrent workers and with 
> no issues
> - new params:
> tasks can be found in the environment (no need to define the tasks 
> parameter)
> max_empty_runs kills the workers automatically if no new tasks are 
> found in queue (nice for "spikes" of processing power)
> discard_results to completely discard the results (if you don'

Re: [web2py] Re: routes.py and patterns with routes_app

2012-08-30 Thread Jonathan Lundell
On 30 Aug 2012, at 1:59 AM, peter  wrote:
> I got inside gluon. The conversion is done within regex_uri
> 
> I have found that 
> 
> http://127.0.0.1:8002/gallery
> becomes
> 127.0.0.1:http://127.0.0.1:get /gallery
> 
> just before the conversion
> 
> http://localhost:8002/gallery
> becomes
> 127.0.0.1:http://localhost:get /gallery
> 
> So Massimo was almost right the problem was putiing the get and post in upper 
> case
> 
> routes_in = [('127\.0\.0\.1:http://.*?:(get|post) /$anything','/welcome')]
> works
> The answer to my challenge to get URLs with localhost to route to the admin 
> app and URLs with 127.0.0.1 to route to the  welcome app
> 
> routes_in = [('.*://localhost:(get|post) /$anything','/admin'),
>('.*://127\.0\.0\.1:(get|post) 
> /$anything','/welcome')]
> 
> So presumably to map mydomain to myapp would be
> 
> routes_in = [('.*://mydomain:(get|post) /myapp/$anything','/myapp/$anything'),
>   ('.*://mydomain:(get|post) /$anything','/myapp/$anything')]
> 
> or if using routes_app
> 
> routes_app=[('.*://mydomain:(get|post) /$anything','myapp'),
> 

Unless you really want to restrict routing to get & post (excluding, say, 
head), why not match on \w* instead of (get|post)?

routes_in = [('.*://localhost:\w* /$anything','/admin/$anything'),
 ('.*://127\.0\.0\.1:\w* /$anything','/welcome/$anything')]

For future reference, you can turn on rewrite logging to see what's going on: 
the router will log the regex strings that it's using, and the result of the 
rewrite.

Notice that this routes_in causes a problem (I think) in welcome/appadmin when 
it generates URLs with URL('admin', ...). These will come in from 127.0.0.1, 
and be routed to welcome instead of admin. So:

routes_in = [('.*://localhost:\w* /$anything','/admin/$anything'),
 ('.*://127\.0\.0\.1:\w* /admin/$anything','/admin/$anything'),
 ('.*://127\.0\.0\.1:\w* /$anything','/welcome/$anything')]

-- 





Re: [web2py] Simultaneously insert in two tables within one form

2012-08-30 Thread Richard Vézina
Think you will need to use jQuery.ajax() about that...

Not sure I understand your other question...

Dropbox menu (or HTML SELECT OPTION) is a form elements that you can have
only for CREATE and UPDATE form, DELETE is not really a form it just a
lamda function attach to a record that when it called will generate a drop
of the record.

So, when you select records you want to show them in a tabular way, so I
don't why you would need a dropbox in that context.

But, you may be talking about of shaping form differently and put fields
element into a table, this is easy to achieve with HELPERS available as
part of web2py.

Richard

On Thu, Aug 30, 2012 at 10:26 AM, jw  wrote:

> Yes, of course. But in my mention, I have a different task to do. There is
> a dircet dependency between groupCards and answer. Answer can only exist,
> when groupCard exist before. There should be a way to test this and to
> generate a groupCard if it doesn't exist before. My problem is, that I want
> to do this just in one step.
> BTW: Am I right, that I can only display a dropdown-menu for a table for
> update/insert/delete-reasons and not just for selecting one row to work
> with the selected item in the next step?
>
>
> On Wednesday, August 29, 2012 4:13:32 PM UTC+2, Richard wrote:
>
>> Did you read this ?
>> http://web2py.com/books/**default/chapter/29/7#One-form-**
>> for-multiple-tables
>>
>> Richard
>>
>>
>> On Wed, Aug 29, 2012 at 6:03 AM, jw  wrote:
>>
>>> I have a quite similar question to this unrepleyd post:
>>> https://groups.google.com/**forum/?fromgroups=#!searchin/**
>>> web2py/form$20simultaneously$**20insert/web2py/w44ZEk0ODsk/**
>>> aCy4XmPmQmQJ
>>>
>>> I try to realize one form within two tables get an insert by accepting
>>> the form.
>>>
>>> db.card.subject_id.default = subject_id
>>> db.groupCards.studyGroup_id.de**fault = auth.user.studyGroup_id
>>> db.answers.user_id.default = auth.user.id
>>> db.answers.datetime.writable = False
>>> factory=SQLFORM.factory(db.car**d,db.groupCards,db.answers)
>>>
>>> As you can see in both pictures and the code above, I've some
>>> default-values when setting up the form.
>>> I would like to select the question (Frage), depending from the default
>>> subject. Now, I get all the questions in the table.
>>> After that, the user writes his answer and the answer should be inserted
>>> in the answer table and in the same time with the link to the new inserted
>>> groupCard.
>>> Is this possible with web2py or do I have first insert a new groupCard
>>> and insert a answer after this in a second form?
>>>
>>> Sorry for my English.
>>>
>>> Thanks in advance,
>>> Jens
>>>
>>>  --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Removing labels from forms

2012-08-30 Thread Alec Taylor
Thanks, but that only worked for the first input (email):

http://pastie.org/4616739

On Thu, Aug 30, 2012 at 9:43 PM, Anthony  wrote:

> Try:
>
> for input in form.elements("input[type=text]"):
>
>
>
> On Thursday, August 30, 2012 3:51:13 AM UTC-4, Alec Taylor wrote:
>
>> No placeholders are added to the HTML.
>>
>> Here is the output:  http://pastie.org/4615036
>>
>> On Thu, Aug 30, 2012 at 3:02 PM, Anthony  wrote:
>>
>>> Can you explain more about what doesn't work? Does the HTML source code
>>> end up not as expected, or is the browser just not rendering it as expected?
>>>
>>>
>>> On Thursday, August 30, 2012 12:01:18 AM UTC-4, Alec Taylor wrote:
>>>
 Thanks, but unfortunately that didn't work.

 {{
 form=auth.register()
 my_extra_element = CAT('Agree to ', A('terms & conditions', 
 _href="/legal/agreement/")), 
 INPUT(_name='agree',value=True,_type='checkbox')
 form[0].insert(-1,my_extra_**ele**ment)for label in form.elements('label'):
 label["_style"] = "display:none;"pass

 placeholders = {
"email": "enter a valid email address",
"password": "be secure",
"post code": "3434343-3434383",
"validator": "captcha"}for input in 
 form.elements("input[type='**tex**t']"):
 input["_placeholder"] = placeholders.get(input["_name"], "")pass
 =form}}


 (this is in my view; and yes, I should move it to a controller, but
 want to get it working first)

 On Thu, Aug 30, 2012 at 4:11 AM, Bruno Rocha 
 wrote:
 > placeholders = {
 > "name": "fill in your name",
 >"email": "enter a valid email address"
 > }
 >
 > for input in form.elements("input[type='**tex**t']"):
 > input["_placeholder"] = placeholders.get(input["_name"], "")
 >
 >
 > On Wed, Aug 29, 2012 at 3:07 PM, Alec Taylor 
 wrote:
 >>
 >> Thanks, also would there be a loop I can add before that to set the
 >> placeholder of each input?
 >>
 >> On Thu, Aug 30, 2012 at 3:58 AM, Bruno Rocha 

 >> wrote:
 >> > for label in form.elements('label'):
 >> > label["_style"] = "display:none;"
 >> >
 >> >
 >> >
 >> >
  >> > On Wed, Aug 29, 2012 at 2:47 PM, Alec Taylor >>> >

 >> > wrote:
 >> >>
 >> >> How do I remove labels from forms?
 >> >>
 >> >> I want to use placeholders instead...
 >> >>
 >> >> (this is for the auth.register form)
 >> >>
 >> >> Thanks for all suggestions,
 >> >>
 >> >> Alec Taylor
 >> >>
 >> >> --
 >> >>
 >> >>
 >> >>
 >> >
 >> >
 >> > --
 >> >
 >> >
 >> >
 >>
 >> --
 >>
 >>
 >>
 >
 >
 > --
 >
 >
 >

  --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





[web2py] Re: Issue rendering URL inside an A

2012-08-30 Thread Anthony
Hmm, I can't reproduce that. Is that all the code? What version of web2py?

Anthony

On Thursday, August 30, 2012 8:00:25 AM UTC-4, Daniel Gonzalez wrote:
>
> Hi,
>
> I have the  following markup in an html viewfile:
>
> {{=DIV(A('click me',callback=URL('mycallback'),target="me"),_id="me")}}
> {{=URL('mycallback')}}
>
> Which is producing the following html:
>
> http://localhost:8000/web2py_jquery/default/index#null"; onclick="ajax('
> ;/web2py_jquery/default/mycallback',[],'me');return false">click 
> me
> /web2py_jquery/default/mycallback
>
> (web2py_jquery is just my test application)
>
> I do not understand why =URL('callback') is rendering differently 
> depending on the context. Specially the "#null" makes me worry
> Is this expected?
>
> Thanks,
> Daniel
>

-- 





[web2py] [Announcement] web2py powered app Vocabilis.NET

2012-08-30 Thread Alexei Vinidiktov
Hi,

I'm glad to announce the launch of my second web2py powered web application
www.vocabilis.net.

It's a flashcard vocabulary builder for language learners.

On the front end I use Flex and on the back end I use web2py.

To see the app in action you'll need to register on the site. Registration
doesn't require email confirmation at the moment.

I'd like to thank the web2py community for all the help I've gotten working
on Vocabilis.NET.

Massimo and all the contributors, thank you for creating such an
indispensable tool!

Thanks, guys!

-- 
Alexei Vinidiktov

-- 





Re: [web2py] Removing labels from forms

2012-08-30 Thread Anthony
It doesn't work for password because type="password" for that field. It 
doesn't work for postcode because your dictionary has "post_code" as the 
key instead of "postcode", which is the name of the form field.

Anthony

On Thursday, August 30, 2012 12:01:18 AM UTC-4, Alec Taylor wrote:
>
> Thanks, but unfortunately that didn't work.
>
> {{
> form=auth.register()
> my_extra_element = CAT('Agree to ', A('terms & conditions', 
> _href="/legal/agreement/")), INPUT(_name='agree',value=True,_type='checkbox')
> form[0].insert(-1,my_extra_element)for label in form.elements('label'):
> label["_style"] = "display:none;"pass
>
> placeholders = {
>"email": "enter a valid email address",
>"password": "be secure",
>"post code": "3434343-3434383",
>"validator": "captcha"}for input in form.elements("input[type='text']"):
> input["_placeholder"] = placeholders.get(input["_name"], "")pass
> =form}}
>
>
> (this is in my view; and yes, I should move it to a controller, but want 
> to get it working first)
>
> On Thu, Aug 30, 2012 at 4:11 AM, Bruno Rocha 
> > 
> wrote:
> > placeholders = {
> > "name": "fill in your name",
> >"email": "enter a valid email address"
> > }
> >
> > for input in form.elements("input[type='text']"):
> > input["_placeholder"] = placeholders.get(input["_name"], "")
> >
> >
> > On Wed, Aug 29, 2012 at 3:07 PM, Alec Taylor 
> > > 
> wrote:
> >>
> >> Thanks, also would there be a loop I can add before that to set the
> >> placeholder of each input?
> >>
> >> On Thu, Aug 30, 2012 at 3:58 AM, Bruno Rocha 
> >> 
> >
> >> wrote:
> >> > for label in form.elements('label'):
> >> > label["_style"] = "display:none;"
> >> >
> >> >
> >> >
> >> >
> >> > On Wed, Aug 29, 2012 at 2:47 PM, Alec Taylor 
> >> > 
> >
> >> > wrote:
> >> >>
> >> >> How do I remove labels from forms?
> >> >>
> >> >> I want to use placeholders instead...
> >> >>
> >> >> (this is for the auth.register form)
> >> >>
> >> >> Thanks for all suggestions,
> >> >>
> >> >> Alec Taylor
> >> >>
> >> >> --
> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> >
> >> >
> >> >
> >>
> >> --
> >>
> >>
> >>
> >
> >
> > --
> >  
> >  
> >  
>
>

-- 





[web2py] Re: Ckeditor(plugin) using the LOAD (....., ajax = True)

2012-08-30 Thread Picheth
Hi simon

How do I set a field to ckeditor ?

>
>> Picheth.
>>
>

-- 





[web2py] Re: How to use the new cache-options with SQLFORM.grid?

2012-08-30 Thread Anthony
cacheable=True just creates a version of the Rows object that can be cached 
-- it lacks the update_record and delete_record functions for each record. 
As a result, it is somewhat faster to create. I don't think the grid uses 
the update_record and delete_record functions, so presumably the grid could 
benefit from setting cacheable=True (i.e., it would speed things up a bit).

Actual caching of the query results could also benefit the grid, as with 
any other queries. Of course, given that the grid involves pagination, a 
potential problem is having some pages cached and others fetched live, but 
not having them in sync (e.g., page 1 was cached but page 2 was fetched 
live after a table update,  so some records are either missing or repeated 
on page 2). If the data are relatively static, though, this should not be 
an issue, and caching would be beneficial.

Anthony

On Thursday, August 30, 2012 6:38:27 AM UTC-4, Niphlod wrote:
>
> If only I had a penny every time in a changelog there is a "big number" 
> speedup and all users starts making questions.I knew those "x% faster" 
> will have raised more questions than answers.
>
> SQLTABLE take the rows after they have been fetched. SQLTABLE is for 
> displaying results only. 
>
> SQLFORM.grid or smartgrid take tables or queries, and the grid is in 
> charge to fetch those records (based on the parameters you use) for every 
> request.
> The grids paginate, order, edit, create, export, find related tables, etc 
> etc etc. If you are going to use SQLFORM grids you can't "use" any 
> improvement regarding "the cache side".
>
>
>
> Il giorno giovedì 30 agosto 2012 12:05:55 UTC+2, Johann Spies ha scritto:
>>
>> I am afraid I do not understand you reasoning:
>>
>> I can do 
>>
>> rows = db(db.sometable).select(
>> cacheable=True, cache = (ram.cache,3600))
>> data = SQLTABLE(rows)
>>
>> or I can do 
>>
>> query = db.sometable.id>0
>> data = SQLFORM.grid(query)
>>
>> or
>>
>> data = SQLFORM.smartgrid(db.sometable)
>>
>> and how do I use those improvements in the latter 2 cases.  That is what 
>> I have asked in my first email.  
>>
>> So what do you mean that it has nothing to do with grid/smartgrid where 
>> both of them run queries?
>>
>> Regards
>> Johann
>>
>>
>>
>>>

-- 





[web2py] Re: IF no redirect

2012-08-30 Thread Anthony
redirect immediately aborts the current request and sends a 303 response 
back to the browser with the location of the redirect. The browser then 
requests the new location, and a whole new request is started. If you want 
to remember things from one request to the next, you can put the values in 
the session.

Anthony

On Thursday, August 30, 2012 8:07:29 AM UTC-4, qwer qwer wrote:
>
> I made default/index.html to execute a function in default.py. If I write 
> redirect(..) in function, I am losing the current variable values in 
> default/index.html as the index.html executes again from beginning..what to 
> do? 

-- 





[web2py] 2.02 Table name in smartgrid changed...

2012-08-30 Thread Adi
Smartgrid used to display the table name automatically. Is that supposed to 
be as before?

-- 



<><>

[web2py] Re: Re-populating a form according to user input

2012-08-30 Thread Daniel Gonzalez
Hi,

I have implemented an example of this here: 
https://github.com/gonvaled/web2py-tests

First-level update is working. I have no idea yet how to implement 
second-level update.
Ideas / comments are greatly appreciated.

Thanks,
Daniel

On Thursday, August 30, 2012 8:03:05 AM UTC+2, Daniel Gonzalez wrote:
>
> I am trying to adapt the lazy_options_widget to my requirements, but I am 
> not sure I will succeed. What I am trying to do is:
>
>- two elements, one is the primary selector, and the other is the 
>secondary selector
>- selecting the primary triggers an ajax call to web2py
>- the ajax call will return an html (typically a select) which will be 
>used to update the secondary selector
>- the html is generated by a user-defined function, and takes as input 
>parameter the value selected in the primary selector
>- nothing is database bound. The user can generate the data as he 
>pleases (maybe from database, maybe not)
>- jQuery is used to perform the ajax accesses and to update the html
>- all the data can be processed by a standard web2py FORM
>
> Basically this is similar to the implementation in the lazy_options_widget, 
> but in my case my data is not in the database.
>
> Ideally the same schema should be useful for multi-selectors. For example: 
> country, region, city:
>
>- Selecting a country updates regions and cities
>- Selecting a region updates cities
>
> I am not sure a generic approach is feasible, at least not with my limited 
> knowledge of web2py.
>
> On Thursday, August 30, 2012 7:14:41 AM UTC+2, lyn2py wrote:
>>
>> +1 
>>
>> Yes! Pls consider built in functionality. I will be happy to help test 
>> this.
>>
>> If I am good with the code I would write it, but I am not. I will be 
>> happy to work with Anthony or any web2py expert to come up with this 
>> functionality.
>>
>> Thank you.
>>
>> On Wednesday, August 29, 2012 10:09:43 PM UTC+8, Anthony wrote:
>>>
>>> This is a very frequent request -- we should probably have some built in 
>>> functionality to handle this. In the meantime, check out 
>>> http://stackoverflow.com/questions/8146260/best-practice-for-populating-dropdown-based-on-other-dropdown-selection-in-web2p/8152910#8152910
>>>  for 
>>> some ideas.
>>>
>>> Anthony
>>>
>>> On Wednesday, August 29, 2012 9:59:37 AM UTC-4, Daniel Gonzalez wrote:

 Hi,

 I have a very common situation. The user has to choose a country and a 
 city. For both fields, I am using a select component.
 The possible choices in the city component depend on what the user has 
 selected in the country component.
 So what I would like to do is:

1. The user selects the country
2. The cities component gets updated with data from the server 
(web2py), *without* reloading the whole form.
3. The user selects the city
4. The form is submitted.

 I have no idea how to implement step 2. Could somebody comment?

 Thanks
 Daniel

>>>

-- 





[web2py] 2.02 can't edit examples - no languages folder

2012-08-30 Thread Adi
 [Errno 2] No such file or directory: 
'/Users/adnan/web2py-branch9/applications/examples/languages'

-- 





Re: [web2py] Re: Re-populating a form according to user input

2012-08-30 Thread Richard Vézina
What you mean a second-level update?

I had hack a bit lazy option in order to make it trigger a js event, so
once the first condition is selected, the field with the widget binded to
it is filtered and become available then when the second field is selected
I trigger a js event, but from the lazy option widget.

I can show my hacked lazy option class.

Richard

On Thu, Aug 30, 2012 at 11:29 AM, Daniel Gonzalez wrote:

> Hi,
>
> I have implemented an example of this here:
> https://github.com/gonvaled/web2py-tests
>
> First-level update is working. I have no idea yet how to implement
> second-level update.
> Ideas / comments are greatly appreciated.
>
> Thanks,
> Daniel
>
> On Thursday, August 30, 2012 8:03:05 AM UTC+2, Daniel Gonzalez wrote:
>>
>> I am trying to adapt the lazy_options_widget to my requirements, but I am
>> not sure I will succeed. What I am trying to do is:
>>
>>- two elements, one is the primary selector, and the other is the
>>secondary selector
>>- selecting the primary triggers an ajax call to web2py
>>- the ajax call will return an html (typically a select) which will
>>be used to update the secondary selector
>>- the html is generated by a user-defined function, and takes as
>>input parameter the value selected in the primary selector
>>- nothing is database bound. The user can generate the data as he
>>pleases (maybe from database, maybe not)
>>- jQuery is used to perform the ajax accesses and to update the html
>>- all the data can be processed by a standard web2py FORM
>>
>> Basically this is similar to the implementation in the lazy_options_widget,
>> but in my case my data is not in the database.
>>
>> Ideally the same schema should be useful for multi-selectors. For
>> example: country, region, city:
>>
>>- Selecting a country updates regions and cities
>>- Selecting a region updates cities
>>
>> I am not sure a generic approach is feasible, at least not with my
>> limited knowledge of web2py.
>>
>> On Thursday, August 30, 2012 7:14:41 AM UTC+2, lyn2py wrote:
>>>
>>> +1
>>>
>>> Yes! Pls consider built in functionality. I will be happy to help test
>>> this.
>>>
>>> If I am good with the code I would write it, but I am not. I will be
>>> happy to work with Anthony or any web2py expert to come up with this
>>> functionality.
>>>
>>> Thank you.
>>>
>>> On Wednesday, August 29, 2012 10:09:43 PM UTC+8, Anthony wrote:

 This is a very frequent request -- we should probably have some built
 in functionality to handle this. In the meantime, check out
 http://stackoverflow.com/**questions/8146260/best-**
 practice-for-populating-**dropdown-based-on-other-**
 dropdown-selection-in-web2p/**8152910#8152910
  for
 some ideas.

 Anthony

 On Wednesday, August 29, 2012 9:59:37 AM UTC-4, Daniel Gonzalez wrote:
>
> Hi,
>
> I have a very common situation. The user has to choose a country and a
> city. For both fields, I am using a select component.
> The possible choices in the city component depend on what the user has
> selected in the country component.
> So what I would like to do is:
>
>1. The user selects the country
>2. The cities component gets updated with data from the server
>(web2py), *without* reloading the whole form.
>3. The user selects the city
>4. The form is submitted.
>
> I have no idea how to implement step 2. Could somebody comment?
>
> Thanks
> Daniel
>
  --
>
>
>
>

-- 





[web2py] fdb patch pending

2012-08-30 Thread Adrian Marius Popa
I have tested the fdb driver integration (just to be sure i have removed 
kinterbasdb sudo rm -rf /usr/local/lib/python2.7/dist-packages/kinterbasdb )
Here is the pull request
https://github.com/web2py/web2py/pull/31

sudo pip install --upgrade fdb

use the raw file 
https://gist.github.com/3529760


python test_fb.py 
firebird
['friend']
['id', 'name']
Tim


-- 





[web2py] Re: web2py 2.0.2 is out

2012-08-30 Thread Annet


> Please can you post a concrete example?
>

In:

Editing file "init/models/db.py" 

... when I click the save button, normally a flash showed up in the 
top-right corner: 

file saved on Thu Aug 30 17:55:13 
2012


In 2.0.2 the  is empty after clicking the save button:




I also noticed that when I inspect the footer element there's a  with 
the following contents:


XyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyXyX


Kind regards,

Annet

-- 





[web2py] Lazy_tables with virtual fields

2012-08-30 Thread Paolo
Dear all, 
I just updated web2py and after turning on the lazy_table I got:

Traceback (most recent call last):
  File "/home/paolo/Dropbox/git/web2py/gluon/restricted.py", line 209, in 
restricted
exec ccode in environment
  File 
"/home/paolo/Dropbox/git/web2py/applications/bikend/views/load/reviewsFilter.html",
 line 57, in 
var str = '{{=T('Route ')}}NAME  
'.replace(/NAME/gi, $(this).text());
  File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 8810, in __call__
return self.method(self.row,*args,**kwargs)
  File "/home/paolo/Dropbox/git/web2py/applications/bikend/models/db.py" 
, line 427, in 

db.reviews.pos = Field.Lazy(lambda row: db((db.reviews_like.review_id == 
row.reviews.id) & (db.reviews_like.helpful == True)).count() )
  File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 8675, in count
return db._adapter.count(self.query,distinct)
  File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1542, in count
self.execute(self._count(query, distinct))
  File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1598, in execute
return self.log_execute(*a, **b)
  File "/home/paolo/Dropbox/git/web2py/gluon/dal.py", line 1592, in log_execute
ret = self.cursor.execute(*a, **b)
ProgrammingError: Cannot operate on a closed database.


The table involved in the error is defined as follows:

db.define_table('reviews_like',
 Field('review_id', 'reference reviews'),  
 Field('helpful', 'boolean',
   widget = BuildRadioButtonWidget),
 Field('created_on', 'datetime', default=request.now,
   writable = False, readable = False),
 Field('user_id', db.auth_user, default=auth.user_id, 
   writable = False, readable = False)
)

db.define_table('reviews',
Field('route_id', 'reference route', default=db.route.id),
Field('rating', 'integer',requires=IS_IN_SET(range(1,6))),
Field('title', 'string', 
requires=(IS_NOT_EMPTY(error_message=T('Enter a 
title')),IS_LENGTH(250,error_message=T('Warning, title too long')), 
IS_LENGTH(minsize=3, error_message=T('Warning, title too short',
Field('description', 'text', 
requires=(IS_NOT_EMPTY(error_message=T('Please, enter a 
description')),IS_LENGTH(250,error_message=T('Warning, description too 
long')), IS_LENGTH(minsize=75, error_message=T('Warning, the description is 
too short, reviews must be at least 75 characters long.',
auth.signature,

)
db.reviews.route_id.readable = False
db.reviews.route_id.writable = False
db.reviews.rating.widget = starWidget
db.reviews.pos = Field.Lazy(lambda row: db((db.reviews_like.review_id == 
row.reviews.id) & (db.reviews_like.helpful == True)).count() )
db.reviews.neg = Field.Lazy(lambda row: db((db.reviews_like.review_id == 
row.reviews.id) & (db.reviews_like.helpful == False)).count() )

what is wrong ?

Cheers
Paolo



-- 





Re: [web2py] Re: Re-populating a form according to user input

2012-08-30 Thread Daniel Gonzalez
by second level update i mean: selecting a country should update the cities
*and* the telephones. currently only cities.
Am 30.08.2012 17:36 schrieb "Richard Vézina" :

> What you mean a second-level update?
>
> I had hack a bit lazy option in order to make it trigger a js event, so
> once the first condition is selected, the field with the widget binded to
> it is filtered and become available then when the second field is selected
> I trigger a js event, but from the lazy option widget.
>
> I can show my hacked lazy option class.
>
> Richard
>
> On Thu, Aug 30, 2012 at 11:29 AM, Daniel Gonzalez wrote:
>
>> Hi,
>>
>> I have implemented an example of this here:
>> https://github.com/gonvaled/web2py-tests
>>
>> First-level update is working. I have no idea yet how to implement
>> second-level update.
>> Ideas / comments are greatly appreciated.
>>
>> Thanks,
>> Daniel
>>
>> On Thursday, August 30, 2012 8:03:05 AM UTC+2, Daniel Gonzalez wrote:
>>>
>>> I am trying to adapt the lazy_options_widget to my requirements, but I
>>> am not sure I will succeed. What I am trying to do is:
>>>
>>>- two elements, one is the primary selector, and the other is the
>>>secondary selector
>>>- selecting the primary triggers an ajax call to web2py
>>>- the ajax call will return an html (typically a select) which will
>>>be used to update the secondary selector
>>>- the html is generated by a user-defined function, and takes as
>>>input parameter the value selected in the primary selector
>>>- nothing is database bound. The user can generate the data as he
>>>pleases (maybe from database, maybe not)
>>>- jQuery is used to perform the ajax accesses and to update the html
>>>- all the data can be processed by a standard web2py FORM
>>>
>>> Basically this is similar to the implementation in the lazy_options_widget,
>>> but in my case my data is not in the database.
>>>
>>> Ideally the same schema should be useful for multi-selectors. For
>>> example: country, region, city:
>>>
>>>- Selecting a country updates regions and cities
>>>- Selecting a region updates cities
>>>
>>> I am not sure a generic approach is feasible, at least not with my
>>> limited knowledge of web2py.
>>>
>>> On Thursday, August 30, 2012 7:14:41 AM UTC+2, lyn2py wrote:

 +1

 Yes! Pls consider built in functionality. I will be happy to help test
 this.

 If I am good with the code I would write it, but I am not. I will be
 happy to work with Anthony or any web2py expert to come up with this
 functionality.

 Thank you.

 On Wednesday, August 29, 2012 10:09:43 PM UTC+8, Anthony wrote:
>
> This is a very frequent request -- we should probably have some built
> in functionality to handle this. In the meantime, check out
> http://stackoverflow.com/**questions/8146260/best-**
> practice-for-populating-**dropdown-based-on-other-**
> dropdown-selection-in-web2p/**8152910#8152910
>  for
> some ideas.
>
> Anthony
>
> On Wednesday, August 29, 2012 9:59:37 AM UTC-4, Daniel Gonzalez wrote:
>>
>> Hi,
>>
>> I have a very common situation. The user has to choose a country and
>> a city. For both fields, I am using a select component.
>> The possible choices in the city component depend on what the user
>> has selected in the country component.
>> So what I would like to do is:
>>
>>1. The user selects the country
>>2. The cities component gets updated with data from the server
>>(web2py), *without* reloading the whole form.
>>3. The user selects the city
>>4. The form is submitted.
>>
>> I have no idea how to implement step 2. Could somebody comment?
>>
>> Thanks
>> Daniel
>>
>  --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 





[web2py] web2py 2.0.2 bug

2012-08-30 Thread Francisco Costa
using ngix + uwsgi I get this:

*  File "/opt/web2py/gluon/languages.py", line 250, in read_possible_plurals
for pname in os.listdir(pdir):
OSError: [Errno 2] No such file or directory: '/gluon/contrib/rules'
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode 


I think absolutepath is not good

-- 





  1   2   3   >