[web2py] Stop menu from collapsing

2013-06-26 Thread James Burke
Hi,

Is it possible to stop the menu from collapsing into a button when the 
window width is resized smaller?

Or do I have to start from scratch.

Cheers

James

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

2013-06-26 Thread Jason (spot) Brower
We could also minify it so people would be nuts to try to change it. :)



On Thu, Jun 27, 2013 at 9:42 AM, Jason (spot) Brower wrote:

> I wonder if we should have a comment in the file that they shouldn't
> change this file as it will be overwritten.
>
>
>
> On Thu, Jun 27, 2013 at 9:38 AM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> The problem is that an old app can be installed after an upgrade and it
>> would not work because it would still come with the old web2py.js. I do not
>> think web2py.js can be update automatically nor it should.
>>
>>
>>
>> On Wednesday, 26 June 2013 14:35:05 UTC-5, LightDot wrote:
>>>
>>> +1 for considering web2py.js as a part of web2py framework, so users
>>> should be requested to update it along with the framework.
>>>
>>> How about extending this definition and requirement to appadmin..?
>>>
>>> Also - what happens with old apps that have ancient jquery.js? Will new
>>> web2py.js cause a chain of upgrades for such users, ie. requires new
>>> jquery.js -> requires new 3rd party js libs -> requires code adjustments in
>>> the application?
>>>
>>> I guess now would be a good time to try out old vanilla welcome apps
>>> with new web2py/web2py.js... I really hate suggesting such things rather
>>> than doing them, but I'm up to ears in a project that's on the deadline so
>>> I have very little free time right now :/
>>>
>>> Regards,
>>> Ales
>>>
>>> On Wednesday, June 26, 2013 7:00:46 PM UTC+2, viniciusban wrote:

 +1


 On Wed, Jun 26, 2013 at 1:46 PM, Anthony  wrote:
 > On Wednesday, June 26, 2013 11:33:59 AM UTC-4, Massimo Di Pierro
 wrote:
 >>
 >> Are you suggested web2py.js should be served by a spacial action and
 not
 >> being part of the applications?
 >
 >
 > Interesting idea.
 >
 > --
 >
 > ---
 > You received this message because you are subscribed to the Google
 Groups
 > "web2py-users" group.
 > To unsubscribe from this group and stop receiving emails from it,
 send an
 > email to web2py+un...@googlegroups.com.
 > For more options, visit 
 > https://groups.google.com/**groups/opt_out.

 >
 >

>>>  --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

2013-06-26 Thread Jason (spot) Brower
I wonder if we should have a comment in the file that they shouldn't change
this file as it will be overwritten.



On Thu, Jun 27, 2013 at 9:38 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> The problem is that an old app can be installed after an upgrade and it
> would not work because it would still come with the old web2py.js. I do not
> think web2py.js can be update automatically nor it should.
>
>
>
> On Wednesday, 26 June 2013 14:35:05 UTC-5, LightDot wrote:
>>
>> +1 for considering web2py.js as a part of web2py framework, so users
>> should be requested to update it along with the framework.
>>
>> How about extending this definition and requirement to appadmin..?
>>
>> Also - what happens with old apps that have ancient jquery.js? Will new
>> web2py.js cause a chain of upgrades for such users, ie. requires new
>> jquery.js -> requires new 3rd party js libs -> requires code adjustments in
>> the application?
>>
>> I guess now would be a good time to try out old vanilla welcome apps with
>> new web2py/web2py.js... I really hate suggesting such things rather than
>> doing them, but I'm up to ears in a project that's on the deadline so I
>> have very little free time right now :/
>>
>> Regards,
>> Ales
>>
>> On Wednesday, June 26, 2013 7:00:46 PM UTC+2, viniciusban wrote:
>>>
>>> +1
>>>
>>>
>>> On Wed, Jun 26, 2013 at 1:46 PM, Anthony  wrote:
>>> > On Wednesday, June 26, 2013 11:33:59 AM UTC-4, Massimo Di Pierro
>>> wrote:
>>> >>
>>> >> Are you suggested web2py.js should be served by a spacial action and
>>> not
>>> >> being part of the applications?
>>> >
>>> >
>>> > Interesting idea.
>>> >
>>> > --
>>> >
>>> > ---
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "web2py-users" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> an
>>> > email to web2py+un...@googlegroups.com.
>>> > For more options, visit 
>>> > https://groups.google.com/**groups/opt_out.
>>>
>>> >
>>> >
>>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

2013-06-26 Thread Massimo Di Pierro
The problem is that an old app can be installed after an upgrade and it 
would not work because it would still come with the old web2py.js. I do not 
think web2py.js can be update automatically nor it should.



On Wednesday, 26 June 2013 14:35:05 UTC-5, LightDot wrote:
>
> +1 for considering web2py.js as a part of web2py framework, so users 
> should be requested to update it along with the framework.
>
> How about extending this definition and requirement to appadmin..?
>
> Also - what happens with old apps that have ancient jquery.js? Will new 
> web2py.js cause a chain of upgrades for such users, ie. requires new 
> jquery.js -> requires new 3rd party js libs -> requires code adjustments in 
> the application?
>
> I guess now would be a good time to try out old vanilla welcome apps with 
> new web2py/web2py.js... I really hate suggesting such things rather than 
> doing them, but I'm up to ears in a project that's on the deadline so I 
> have very little free time right now :/
>
> Regards,
> Ales
>
> On Wednesday, June 26, 2013 7:00:46 PM UTC+2, viniciusban wrote:
>>
>> +1 
>>
>>
>> On Wed, Jun 26, 2013 at 1:46 PM, Anthony  wrote: 
>> > On Wednesday, June 26, 2013 11:33:59 AM UTC-4, Massimo Di Pierro wrote: 
>> >> 
>> >> Are you suggested web2py.js should be served by a spacial action and 
>> not 
>> >> being part of the applications? 
>> > 
>> > 
>> > Interesting idea. 
>> > 
>> > -- 
>> > 
>> > --- 
>> > You received this message because you are subscribed to the Google 
>> Groups 
>> > "web2py-users" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an 
>> > email to web2py+un...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>> > 
>> > 
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Adding custom operators to DAL

2013-06-26 Thread Massimo Di Pierro
I do not know either why it was deleted. Google did it not, us. Sorry.

On Wednesday, 26 June 2013 10:53:34 UTC-5, Calvin wrote:
>
> Not sure why it says my previous reply has been deleted but here it is 
> again:
>
> Hi Massimo
>
>
> I am not familiar with the method you suggested but when I tried it, I got 
> the following error:
>
>
> print db(Expression(db,"business_view.loc && 
> ST_MakeEnvelope(42.179139323652443, 141.20906066894531, 42.307520083522473, 
> 143.34776306152344)")).select().as_list()
>
> NameError: global name 'Expression' is not defined
>
>
> In any case, in the non-working example that I tried, I was trying to use 
> the bounding box operator in postgis, which is not currently available in 
> the DAL... With the approach I suggested, I managed to get it to work 
> without issues.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Auth registration adding a registration key with requires_approval disabled

2013-06-26 Thread Massimo Di Pierro
Which web2py version?

On Wednesday, 26 June 2013 11:16:11 UTC-5, Isaac Dontje Lindell wrote:
>
> I have this in my db.py model:
>
> ## configure auth policy
> auth.settings.registration_requires_verification = False
> auth.settings.registration_requires_approval = False
> auth.settings.reset_password_requires_verification = True
>
> If I register for the application (at %app%/default/user/register), it 
> goes through (I get a "Success" flash and an entry is added to the 
> auth_user table.)  However, every time I register, a registration_key is 
> added to the auth_user entry. The user is prevented from logging in until I 
> remove the registration key from the auth_user row manually.
>
> It's my understanding that the first 2 lines above should stop a 
> registration_key from being added or created - the user should be able to 
> log in immediately.
>
> What am I missing?
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Builtwith.com now recognizes web2py as a framework.

2013-06-26 Thread Massimo Di Pierro
Thank you! How does one report more sites? Or they on;y discover them 
automatically. In this case how to they determine that a site is powered by 
web2py?

On Wednesday, 26 June 2013 11:05:33 UTC-5, pythONtherocks wrote:
>
> Hello all,
> I tried to get Gary from Builtwith.com to identify web2py as a framework 
> in their results. After one month's wait "to refresh the cache", it is now 
> identifying any website using web2py and reports them as such (see screen 
> shot). 
> My 2 cents worth of contribution to this great framework. Cheers!
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Select table in drop down import the file and edit

2013-06-26 Thread Rohitraj Sharma


On Thursday, 27 June 2013 10:52:46 UTC+5:30, Rohitraj Sharma wrote:
>
> This is for fetching data from database
>
> def im(): 
> task=db(db.mydb).select()
> return dict(rows=task)
>
>
>
> For importing file from database
> def import_table():
> form = SQLFORM.factory(Field('table',requires=IS_IN_SET(db.tables)),
>   
>  Field('csvfile','upload',uploadfield=False))
> form.process()
> if form.accepted: 
>   try:
>   
> db[form.vars.table].import_from_csv_file(request.vars.csvfile.file)
>   except: form.errors.csvfile = 'invalid file'
> return dict(form=form)
>
> The View part
>
>  http://www.w3.org/TR/html4/loose.dtd";>
> 
> 
>   http://www.jeasyui.com/easyui/themes/default/easyui.css";>
> http://www.jeasyui.com/easyui/themes/icon.css";>
> http://www.jeasyui.com/easyui/demo/demo.css";>
> http://code.jquery.com/jquery-1.6.min.js";>
> http://www.jeasyui.com/easyui/jquery.easyui.min.js";>
> http://www.jeasyui.com/easyui/jquery.edatagrid.js";>
>
>
>   
> 
> $(function(){
> $('#dg').edatagrid({
>  saveUrl: 'save_user.php',
> updateUrl: 'update_user.php',I am not able to perform these 
> function 
> destroyUrl: 'destroy_user.py'
> });
> });
>
> 
> 
> 
> CRUD DataGrid
> 
>  
> Double click the row to begin editing.
> 
>   style="width:700px;height:250px"toolbar="#toolbar" pagination="true" 
> idField="id"rownumbers="true" fitColumns="true" singleSelect="true">
> 
> 
>   editor="{type:'validatebox',options:{required:true}}">Name
>  editor="{type:'validatebox',options:{required:true}}">Phone
> Email
>  editor="{type:'validatebox',options:{required:true}}">Mobile
>  
>  
>  {{for i,row in enumerate(rows):}}
> 
>  {{=row.name}}
> {{=row.phone}}
> {{=row.email}}
> {{=row.mobile}}
>   {{pass}}
>  
> 
> 
>  onclick="javascript:$('#dg').edatagrid('addRow')">New
>  onclick="javascript:$('#dg').edatagrid('destroyRow')">Destroy
>  onclick="javascript:$('#dg').edatagrid('saveRow')">Save
>  onclick="javascript:$('#dg').edatagrid('cancelRow')">Cancel
>  iconCls="icon-undo" plain="true" >Import
> 
>
> 
> 
>
> Anthony if u can do some thing on that then it is very great for me thanks
>
> On Thursday, 27 June 2013 10:42:00 UTC+5:30, Rohitraj Sharma wrote:
>>
>>
>> Hi Anthony
>>
>> I am not able to get your question. I have one form controller with one 
>> view. http://127.0.0.1:8000/tracker/default/form when i run this url its 
>> show 404 error.
>> Actually what is my requirement, I have one csv file. which i have to 
>> upload. Before saving the file in database, i want to edit in browser. 
>> After editing i want to save in database. Is there any method to do.
>> Thanks
>>
>> On Wednesday, 26 June 2013 19:09:00 UTC+5:30, Anthony wrote:
>>>
>>> Using the browser developer tools, what URL gets requested when the ajax 
>>> call is made?
>>>
>>> On Wednesday, June 26, 2013 2:44:18 AM UTC-4, Rohitraj Sharma wrote:

  I want to select some particular table from database in a drop dowan. 
 Then import csv file. edit that file and update. . Can Any one can help me 
 plz

 i am using the fallowing code for that


 View

 
 jQuery(function() {
   jQuery('#table').change(function() {
 web2py_component("{{=URL('default', 'form.load')}}" + "/" +
   jQuery(this).val(), target='form')
   })})
 {{=SELECT('Select a table', *db.tables, _id='table')}}


 Controller 

 def form():
 if request.args(0) in db.tables:
 response.generic_patterns = ['load']
 return dict(form=SQLFORM(db[request.args(0)]).process())
 else:
 raise HTTP(404)


 every time it toll else part.


 can any one help me.



-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


<>

[web2py] Re: Select table in drop down import the file and edit

2013-06-26 Thread Rohitraj Sharma
The fallowing are python file not php. By mistake i write php 
On Thursday, 27 June 2013 10:52:46 UTC+5:30, Rohitraj Sharma wrote:
>
> This is for fetching data from database
>
> def im(): 
> task=db(db.mydb).select()
> return dict(rows=task)
>
>
>
> For importing file from database
> def import_table():
> form = SQLFORM.factory(Field('table',requires=IS_IN_SET(db.tables)),
>   
>  Field('csvfile','upload',uploadfield=False))
> form.process()
> if form.accepted: 
>   try:
>   
> db[form.vars.table].import_from_csv_file(request.vars.csvfile.file)
>   except: form.errors.csvfile = 'invalid file'
> return dict(form=form)
>
> The View part
>
>  http://www.w3.org/TR/html4/loose.dtd";>
> 
> 
>   http://www.jeasyui.com/easyui/themes/default/easyui.css";>
> http://www.jeasyui.com/easyui/themes/icon.css";>
> http://www.jeasyui.com/easyui/demo/demo.css";>
> http://code.jquery.com/jquery-1.6.min.js";>
> http://www.jeasyui.com/easyui/jquery.easyui.min.js";>
> http://www.jeasyui.com/easyui/jquery.edatagrid.js";>
>
>
>   
> 
> $(function(){
> $('#dg').edatagrid({
>  saveUrl: 'save_user.py',
> updateUrl: 'update_user.py',I am not able to perform these 
> function 
> destroyUrl: 'destroy_user.py'
> });
> });
>
> 
> 
> 
> CRUD DataGrid
> 
>  
> Double click the row to begin editing.
> 
>   style="width:700px;height:250px"toolbar="#toolbar" pagination="true" 
> idField="id"rownumbers="true" fitColumns="true" singleSelect="true">
> 
> 
>   editor="{type:'validatebox',options:{required:true}}">Name
>  editor="{type:'validatebox',options:{required:true}}">Phone
> Email
>  editor="{type:'validatebox',options:{required:true}}">Mobile
>  
>  
>  {{for i,row in enumerate(rows):}}
> 
>  {{=row.name}}
> {{=row.phone}}
> {{=row.email}}
> {{=row.mobile}}
>   {{pass}}
>  
> 
> 
>  onclick="javascript:$('#dg').edatagrid('addRow')">New
>  onclick="javascript:$('#dg').edatagrid('destroyRow')">Destroy
>  onclick="javascript:$('#dg').edatagrid('saveRow')">Save
>  onclick="javascript:$('#dg').edatagrid('cancelRow')">Cancel
>  iconCls="icon-undo" plain="true" >Import
> 
>
> 
> 
>
> Anthony if u can do some thing on that then it is very great for me thanks
>
> On Thursday, 27 June 2013 10:42:00 UTC+5:30, Rohitraj Sharma wrote:
>>
>>
>> Hi Anthony
>>
>> I am not able to get your question. I have one form controller with one 
>> view. http://127.0.0.1:8000/tracker/default/form when i run this url its 
>> show 404 error.
>> Actually what is my requirement, I have one csv file. which i have to 
>> upload. Before saving the file in database, i want to edit in browser. 
>> After editing i want to save in database. Is there any method to do.
>> Thanks
>>
>> On Wednesday, 26 June 2013 19:09:00 UTC+5:30, Anthony wrote:
>>>
>>> Using the browser developer tools, what URL gets requested when the ajax 
>>> call is made?
>>>
>>> On Wednesday, June 26, 2013 2:44:18 AM UTC-4, Rohitraj Sharma wrote:

  I want to select some particular table from database in a drop dowan. 
 Then import csv file. edit that file and update. . Can Any one can help me 
 plz

 i am using the fallowing code for that


 View

 
 jQuery(function() {
   jQuery('#table').change(function() {
 web2py_component("{{=URL('default', 'form.load')}}" + "/" +
   jQuery(this).val(), target='form')
   })})
 {{=SELECT('Select a table', *db.tables, _id='table')}}


 Controller 

 def form():
 if request.args(0) in db.tables:
 response.generic_patterns = ['load']
 return dict(form=SQLFORM(db[request.args(0)]).process())
 else:
 raise HTTP(404)


 every time it toll else part.


 can any one help me.



-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Select table in drop down import the file and edit

2013-06-26 Thread Rohitraj Sharma
This is for fetching data from database

def im(): 
task=db(db.mydb).select()
return dict(rows=task)



For importing file from database
def import_table():
form = SQLFORM.factory(Field('table',requires=IS_IN_SET(db.tables)),
  
 Field('csvfile','upload',uploadfield=False))
form.process()
if form.accepted: 
  try:
  
db[form.vars.table].import_from_csv_file(request.vars.csvfile.file)
  except: form.errors.csvfile = 'invalid file'
return dict(form=form)

The View part

http://www.w3.org/TR/html4/loose.dtd";>


  http://www.jeasyui.com/easyui/themes/default/easyui.css";>
http://www.jeasyui.com/easyui/themes/icon.css";>
http://www.jeasyui.com/easyui/demo/demo.css";>
http://code.jquery.com/jquery-1.6.min.js";>
http://www.jeasyui.com/easyui/jquery.easyui.min.js";>
http://www.jeasyui.com/easyui/jquery.edatagrid.js";>


  

$(function(){
$('#dg').edatagrid({
 saveUrl: 'save_user.php',
updateUrl: 'update_user.php',I am not able to perform these 
function 
destroyUrl: 'destroy_user.py'
});
});




CRUD DataGrid

 
Double click the row to begin editing.

 


 Name
Phone
Email
Mobile
 
 
 {{for i,row in enumerate(rows):}}

 {{=row.name}}
{{=row.phone}}
{{=row.email}}
{{=row.mobile}}
  {{pass}}
 


New
Destroy
Save
Cancel
Import





Anthony if u can do some thing on that then it is very great for me thanks

On Thursday, 27 June 2013 10:42:00 UTC+5:30, Rohitraj Sharma wrote:
>
>
> Hi Anthony
>
> I am not able to get your question. I have one form controller with one 
> view. http://127.0.0.1:8000/tracker/default/form when i run this url its 
> show 404 error.
> Actually what is my requirement, I have one csv file. which i have to 
> upload. Before saving the file in database, i want to edit in browser. 
> After editing i want to save in database. Is there any method to do.
> Thanks
>
> On Wednesday, 26 June 2013 19:09:00 UTC+5:30, Anthony wrote:
>>
>> Using the browser developer tools, what URL gets requested when the ajax 
>> call is made?
>>
>> On Wednesday, June 26, 2013 2:44:18 AM UTC-4, Rohitraj Sharma wrote:
>>>
>>>  I want to select some particular table from database in a drop dowan. 
>>> Then import csv file. edit that file and update. . Can Any one can help me 
>>> plz
>>>
>>> i am using the fallowing code for that
>>>
>>>
>>> View
>>>
>>> 
>>> jQuery(function() {
>>>   jQuery('#table').change(function() {
>>> web2py_component("{{=URL('default', 'form.load')}}" + "/" +
>>>   jQuery(this).val(), target='form')
>>>   })})
>>> {{=SELECT('Select a table', *db.tables, _id='table')}}
>>>
>>>
>>> Controller 
>>>
>>> def form():
>>> if request.args(0) in db.tables:
>>> response.generic_patterns = ['load']
>>> return dict(form=SQLFORM(db[request.args(0)]).process())
>>> else:
>>> raise HTTP(404)
>>>
>>>
>>> every time it toll else part.
>>>
>>>
>>> can any one help me.
>>>
>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Select table in drop down import the file and edit

2013-06-26 Thread Rohitraj Sharma

Hi Anthony

I am not able to get your question. I have one form controller with one 
view. http://127.0.0.1:8000/tracker/default/form when i run this url its 
show 404 error.
Actually what is my requirement, I have one csv file. which i have to 
upload. Before saving the file in database, i want to edit in browser. 
After editing i want to save in database. Is there any method to do.
Thanks

On Wednesday, 26 June 2013 19:09:00 UTC+5:30, Anthony wrote:
>
> Using the browser developer tools, what URL gets requested when the ajax 
> call is made?
>
> On Wednesday, June 26, 2013 2:44:18 AM UTC-4, Rohitraj Sharma wrote:
>>
>>  I want to select some particular table from database in a drop dowan. 
>> Then import csv file. edit that file and update. . Can Any one can help me 
>> plz
>>
>> i am using the fallowing code for that
>>
>>
>> View
>>
>> 
>> jQuery(function() {
>>   jQuery('#table').change(function() {
>> web2py_component("{{=URL('default', 'form.load')}}" + "/" +
>>   jQuery(this).val(), target='form')
>>   })})
>> {{=SELECT('Select a table', *db.tables, _id='table')}}
>>
>>
>> Controller 
>>
>> def form():
>> if request.args(0) in db.tables:
>> response.generic_patterns = ['load']
>> return dict(form=SQLFORM(db[request.args(0)]).process())
>> else:
>> raise HTTP(404)
>>
>>
>> every time it toll else part.
>>
>>
>> can any one help me.
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: JQuery Issue

2013-06-26 Thread Jim S
Try this, you need brackets for your if statements in javascript.

jQuery(document).ready(function(){
 jQuery('#no_table_mothers_name__row').hide();
 jQuery('#is_newborn').change(function(){
   if(jQuery('#is_newborn').attr('checked')) {
 jQuery('#no_table_mothers_name__row').show();
   } else {
 jQuery('#no_table_mothers_name__row').hide();
   });
 });
});


On Wednesday, June 26, 2013 9:09:00 PM UTC-5, Tom Russell wrote:
>
> I cannot seem to get some jquery code to work right and not sure why. 
> Basically when I click a checkbox I want another field to appear below that 
> one.
>
> This is my form code:
>
> @auth.requires_login()
> def register_patient():
> mark_not_empty(db.patient)
> mark_not_empty(db.emergencycontacts)
> mark_not_empty(db.dependents)
> db.patient.medical_record_number.default = 'KND' + 
> str(date.today().year) + '' + str(random.randrange(1, 999+1))
> db.patient.medical_record_number.writable = False
> form=SQLFORM.factory(db.patient, db.emergencycontacts, db.dependents)
>
> fs0=form[0][:27] #patient rows
> fs1=form[0][27:38]   #emergency contacts
> fs2=form[0][38:42] #dependents
> fs3=form[0][-1] # submit row (last)
>
> form[0]=TABLE(
> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"),
> FIELDSET(TAG.legend("Emergency Contact 
> Info"),TABLE(fs1),_id="register1"),
> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"),
> TABLE(fs3))
> if form.process().accepted:
> id = db.patient.insert(**db.patient._filter_fields(form.vars))
> form.vars.patient=id
> id = 
> db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars))
> id = 
> db.dependents.insert(**db.dependents._filter_fields(form.vars))
> #form.vars.dependents=id
> # and get a list of all persons
> redirect(URL('manage_patients'))
>
> style = STYLE(""".not_empty {color:#d00;}""")
>
> return dict(form=DIV(style,form))
>
> My html code:
>
> {{left_sidebar_enabled=True}}
> {{extend 'layout.html'}}
>
> {{block left_sidebar}}
>   Home
>   
>   Home(Physician)
>   Home(Front Desk)
>   Home(Nurse)
>   Home(Lab)
>   Home(Radiology)
>   Home(Pharmacist)
>   Home(Cashier)
>   
>href="/patient/default/manage_patients">Patients
>   Task Lists
>   Appointment
>   Order
>   Consumables
>   Prescriptions
>   Immunization
>   Laboratory Orders
>   Radiology Orders
>   Patient Accounting
>   Admin
>
> {{end}}
>
>
> Register Patient
>
> {{=form}}
>
> 
> jQuery(document).ready(function(){
>jQuery('#no_table_mothers_name__row').hide();
>jQuery('#is_newborn').change(function(){
> if(jQuery('#is_newborn').attr('checked'))
> jQuery('#no_table_mothers_name__row').show();
> else jQuery('#no_table_mothers_name__row').hide();});
> });
> 
>
>
> And this is the info from the page source showing the id's for what fields 
> I am working with:
>
> Is Newborn: 
>  name="is_newborn" type="checkbox" value="on" />
>  for="no_table_mothers_name" id="no_table_mothers_name__label">Mothers 
> Name: 
> I think I have the right code for the jquery but nothing happens when I 
> try this.
>
> Any ideas?
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] JQuery Issue

2013-06-26 Thread Tom Russell
I cannot seem to get some jquery code to work right and not sure why.
Basically when I click a checkbox I want another field to appear below that
one.

This is my form code:

@auth.requires_login()
def register_patient():
mark_not_empty(db.patient)
mark_not_empty(db.emergencycontacts)
mark_not_empty(db.dependents)
db.patient.medical_record_number.default = 'KND' +
str(date.today().year) + '' + str(random.randrange(1, 999+1))
db.patient.medical_record_number.writable = False
form=SQLFORM.factory(db.patient, db.emergencycontacts, db.dependents)

fs0=form[0][:27] #patient rows
fs1=form[0][27:38]   #emergency contacts
fs2=form[0][38:42] #dependents
fs3=form[0][-1] # submit row (last)

form[0]=TABLE(
FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"),
FIELDSET(TAG.legend("Emergency Contact
Info"),TABLE(fs1),_id="register1"),
FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"),
TABLE(fs3))
if form.process().accepted:
id = db.patient.insert(**db.patient._filter_fields(form.vars))
form.vars.patient=id
id =
db.emergencycontacts.insert(**db.emergencycontacts._filter_fields(form.vars))
id = db.dependents.insert(**db.dependents._filter_fields(form.vars))
#form.vars.dependents=id
# and get a list of all persons
redirect(URL('manage_patients'))

style = STYLE(""".not_empty {color:#d00;}""")

return dict(form=DIV(style,form))

My html code:

{{left_sidebar_enabled=True}}
{{extend 'layout.html'}}

{{block left_sidebar}}
  Home
  
  Home(Physician)
  Home(Front Desk)
  Home(Nurse)
  Home(Lab)
  Home(Radiology)
  Home(Pharmacist)
  Home(Cashier)
  
  Patients
  Task Lists
  Appointment
  Order
  Consumables
  Prescriptions
  Immunization
  Laboratory Orders
  Radiology Orders
  Patient Accounting
  Admin

{{end}}


Register Patient

{{=form}}


jQuery(document).ready(function(){
   jQuery('#no_table_mothers_name__row').hide();
   jQuery('#is_newborn').change(function(){
if(jQuery('#is_newborn').attr('checked'))
jQuery('#no_table_mothers_name__row').show();
else jQuery('#no_table_mothers_name__row').hide();});
});



And this is the info from the page source showing the id's for what fields
I am working with:

Is Newborn: 

Mothers Name:
https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

2013-06-26 Thread Niphlod
just to confirm, ANY javascript piece of code relying on web2py.js 
functions will still work as intended. At the end of the new web2py.js 
there is a "compatibility layer" that remaps old function names to the new 
ones.

If someone added his own function, e.g. at the end of "old" web2py.js just 
to avoid creating a new js file, he/she can as well append those functions 
to the new web2py.js, after the "compatibility layer".

However, this (editing web2py.js directly) is NOT encouraged, as Anthony 
explained very well in the previous posts.

Problems will only arise if someone modified e.g. web2py_component() 
altering the default behaviour. This is of course not encouraged/supported 
in any way. 
BTW, shouldn't take that long to adjust everyone owns "customizations" to 
the new "style". There are also lots of comments.

As for what jquery version is required, I can't really say anything in 
regards to the "old" web2py.js. The new one should be fine with query > 
1.7, so ~ anything from november 2011 onwards **should work**. 
it's true that there's a theoretical break in this, but people relying on 
jquery <= 1.6 should be encouraged (or at least feel a little bit of 
pressure) to move forward (for speedups/optimizations at the very least). 
I'm not aware of any jquery plugin that requires such an ancient version of 
jquery.

On Thursday, June 27, 2013 12:25:35 AM UTC+2, viniciusban wrote:
>
> It sounds good. 
>
> On Wed, Jun 26, 2013 at 6:04 PM, villas > 
> wrote: 
> > I was just thinking that some users might have their own functions mixed 
> > together with web2py functions in web2py.js and might not wish to 
> extricate 
> > their work and save it elsewhere. 
> > 
> > To overcome that,  make a completely different file to be the framework 
> > file. I suggested web2py_framework.js but could be any name.  We could 
> then 
> > load that new file directly after web2py.js and override the original 
> > framework functions with the new versions.  At least users would then 
> > hopefuilly get a working version of their own functions and a working 
> > version of web2py_framework.js without any effort.  We specify exactly 
> which 
> > functions can be safely removed from web2py.js at the users' leisure. 
> > 
> > And yes,  we could also do this by overriding the functions 
> conditionally 
> > and then leave users the choice as to whether they want the original 
> version 
> > of the web2py.js or the new framework one,  but there's not much point 
> in 
> > over-complicating it.  Users that care will review their js code. 
> > 
> > The thing I like about web2py_framework.js is that it would be a 
> completely 
> > new file,  without any user code,  so we could then ask everyone never 
> to 
> > touch that file. 
> > 
> > 
> > 
> > 
> > On Wednesday, 26 June 2013 16:21:58 UTC+1, villas wrote: 
> >> 
> >> +1 Anthony 
> >> 
> >> These days any sophisticated web framework must surely include some JS. 
> >> The framework must be able to guarantee which functions will be 
> available 
> >> client-side. 
> >> 
> >> If we accept that at least one JS must be part of the framework,  then 
> we 
> >> can choose whether this should be web2py.js. 
> >> Perhaps alternatively we announce "web2py_framework.js" and overload 
> all 
> >> essential functions from that new file. 
> > 
> > -- 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "web2py-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Help with WebClient and Pytest

2013-06-26 Thread Ian W. Scott
Thanks, that looks really promising. I'll let you know what I come up with 
once I've had a chance to look through the repo.

Ian

On Wednesday, June 26, 2013 6:21:55 PM UTC-4, viniciusban wrote:
>
> See if something in https://github.com/viniciusban/web2py.test helps you. 
>
> On Wed, Jun 26, 2013 at 3:21 PM, Ian W. Scott 
> > 
> wrote: 
> > I'm trying to use WebClient in a pytest suite and getting an error that 
> I 
> > don't understand. I try to connect like this: 
> > 
> > client = WebClient('http://127.0.0.1:8000/paideia/default/', 
> > postbacks=True) 
> > client.get('index') 
> > 
> > But client.get('index') throws an error. The error arises in urllib2.py 
> line 
> > 1184: 
> > 
> > URLError:  
> > 
> > I assume this means that the rocket server isn't running properly. But I 
> > can't quite see what the problem is. I set up the test suite like this: 
> > 
> > 1. from the command-line I launch web2py in the app "paideia" and 
> execute 
> > the test launcher (runtest.py) in that web2py environment: 
> > 
> > python ~/web/web2py/web2py.py -S --ip=127.0.0.1 --port=8000 
> > --password=password paideia -M -R applications/paideia/bin/runtest.py 
> > 
> > 2. In runtest.py I call pytest programmatically: 
> > 
> > import pytest 
> > pytest.main(path/to/test/dir/) 
> > 
> > 3. Pytest then finds my test suite file (there's only one so far) and 
> runs 
> > the test, running into the error when I try to access default/index via 
> the 
> > webclient. 
> > 
> > The strange thing is that the web2py environment seems to be there. I 
> have 
> > access to current and to db. But the http connection seems to fail. 
> > 
> > Any help would be greatly appreciated! 
> > 
> > Ian 
> > 
> > -- 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "web2py-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

2013-06-26 Thread Vinicius Assef
It sounds good.

On Wed, Jun 26, 2013 at 6:04 PM, villas  wrote:
> I was just thinking that some users might have their own functions mixed
> together with web2py functions in web2py.js and might not wish to extricate
> their work and save it elsewhere.
>
> To overcome that,  make a completely different file to be the framework
> file. I suggested web2py_framework.js but could be any name.  We could then
> load that new file directly after web2py.js and override the original
> framework functions with the new versions.  At least users would then
> hopefuilly get a working version of their own functions and a working
> version of web2py_framework.js without any effort.  We specify exactly which
> functions can be safely removed from web2py.js at the users' leisure.
>
> And yes,  we could also do this by overriding the functions conditionally
> and then leave users the choice as to whether they want the original version
> of the web2py.js or the new framework one,  but there's not much point in
> over-complicating it.  Users that care will review their js code.
>
> The thing I like about web2py_framework.js is that it would be a completely
> new file,  without any user code,  so we could then ask everyone never to
> touch that file.
>
>
>
>
> On Wednesday, 26 June 2013 16:21:58 UTC+1, villas wrote:
>>
>> +1 Anthony
>>
>> These days any sophisticated web framework must surely include some JS.
>> The framework must be able to guarantee which functions will be available
>> client-side.
>>
>> If we accept that at least one JS must be part of the framework,  then we
>> can choose whether this should be web2py.js.
>> Perhaps alternatively we announce "web2py_framework.js" and overload all
>> essential functions from that new file.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Help with WebClient and Pytest

2013-06-26 Thread Vinicius Assef
See if something in https://github.com/viniciusban/web2py.test helps you.

On Wed, Jun 26, 2013 at 3:21 PM, Ian W. Scott  wrote:
> I'm trying to use WebClient in a pytest suite and getting an error that I
> don't understand. I try to connect like this:
>
> client = WebClient('http://127.0.0.1:8000/paideia/default/',
> postbacks=True)
> client.get('index')
>
> But client.get('index') throws an error. The error arises in urllib2.py line
> 1184:
>
> URLError: 
>
> I assume this means that the rocket server isn't running properly. But I
> can't quite see what the problem is. I set up the test suite like this:
>
> 1. from the command-line I launch web2py in the app "paideia" and execute
> the test launcher (runtest.py) in that web2py environment:
>
> python ~/web/web2py/web2py.py -S --ip=127.0.0.1 --port=8000
> --password=password paideia -M -R applications/paideia/bin/runtest.py
>
> 2. In runtest.py I call pytest programmatically:
>
> import pytest
> pytest.main(path/to/test/dir/)
>
> 3. Pytest then finds my test suite file (there's only one so far) and runs
> the test, running into the error when I try to access default/index via the
> webclient.
>
> The strange thing is that the web2py environment seems to be there. I have
> access to current and to db. But the http connection seems to fail.
>
> Any help would be greatly appreciated!
>
> Ian
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: feeding python string object to d3.js csv

2013-06-26 Thread Anthony
On Wednesday, June 26, 2013 5:21:16 PM UTC-4, greaneym wrote:

> yes, thanks, that is what I have been doing, and the web error console 
> shows when d3 can't read the string. I didn't compile a list of the errors, 
> but I intend to keep trying with the csv inputs and will post something 
> when it works.  Thanks for all your help.


Are you saying it doesn't even get as far as making the Ajax call to your 
URL because it can't read the URL to begin with? In that case, can you show 
the Javascript code that ends up in the HTML page?

Anthony 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: I cannot get track_changes to work

2013-06-26 Thread Ian W. Scott
I just have this snippet as the first code (after imports) in my 
models/db.py:

from gluon.custom_import import track_changes
track_changes(True)

I don't use the condition that is recommended: 

if request.is_local:

I seem to remember having trouble when that condition was present. So I 
just remember to comment out the two lines when I move the app to 
production. (These problems may also have disappeared. It was a while ago.)

Maybe also try reloading routes (from the admin dashboard)? I'm not sure if 
that would be necessary or not.

Ian

On Wednesday, June 26, 2013 5:29:24 PM UTC-4, jc wrote:
>
> I have a model file which contains
>
> from gluon.custom_import import track_changes; track_changes(True)
>
> When I change a module file in the applications/app/modules directory, the 
> changes don't appear. I have to kill and restart web2py to get the changes.
>
> Seems a simple recipe to follow from Chapter 4 of the book. Can anybody 
> advise me what I am doing wrong?
>
> Thanks.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] I cannot get track_changes to work

2013-06-26 Thread jc
I have a model file which contains

from gluon.custom_import import track_changes; track_changes(True)

When I change a module file in the applications/app/modules directory, the 
changes don't appear. I have to kill and restart web2py to get the changes.

Seems a simple recipe to follow from Chapter 4 of the book. Can anybody 
adsvise me what I am doing wrong?

Thanks.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: feeding python string object to d3.js csv

2013-06-26 Thread greaneym
yes, thanks, that is what I have been doing, and the web error console 
shows when d3 can't read the string. I didn't compile a list of the errors, 
but I intend to keep trying with the csv inputs and will post something 
when it works.  Thanks for all your help.

margaret

On Wednesday, June 26, 2013 3:07:06 PM UTC-5, Anthony wrote:
>
> In your browser developer tools, can you watch the ajax request and see 
> what web2py is returning?
>
> On Wednesday, June 26, 2013 4:03:47 PM UTC-4, greaneym wrote:
>>
>> This addition of quotes did nothing for me. Somehow the d3 does not load 
>> the url because I get a d3 error that there is no data found.
>> I can get  json to work with this,
>>
>> json_data = sj.dumps(pt_data)
>>
>> then in the view,
>> var jdata = {{=XML(response.json(pt_data))}}
>>
>>   g = new Dygraph( document.getElementById("div_pt"),
>>jdata,
>>{} );
>>
>> this loads the data with no problems and makes a graph.
>>
>> BUT, what I want to be able to do is get a pythonic object for each 
>> method of putting data into d3, as described in the d3 wiki.  Except for 
>> json, I haven't been yet able to figure this out.
>>
>> json is a string and so is the pt_data in my code. I need to learn more 
>> about d3 methods.  I really appreciate all the help with my questions,
>> and look forward to any incorporation of d3 into web2py.
>>
>>
>> Margaret
>>
>> On Tuesday, June 25, 2013 6:02:52 PM UTC-5, Anthony wrote:
>>>
>>> I've tried many, many things (I want to get the csv as python solution 
 working), including this,
>>>
>>>   g = new Dygraph( document.getElementById("div_pt"),
d3.csv({{=URL('powertoday','cvstab.csv')}}), 

>>>
>>> Your URL needs to be in quotes:
>>>
>>> d3.csv("{{=URL('powertoday','cvstab.csv')}}")
>>>
>>> which will result in something like:
>>>
>>> d3.csv("/yourapp/powertoday/cvstab.csv")
>>>
>>> Anthony
>>>


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: database disk image is malformed

2013-06-26 Thread Niphlod
whoopsie. If that is indeed web2py's sqlite database, follow these steps

http://techblog.dorogin.com/2011/05/sqliteexception-database-disk-image-is.html

On Wednesday, June 26, 2013 11:01:47 PM UTC+2, Niphlod wrote:
>
> sure that is web2py's database ?
> That message is usually outputted when yum (the package manager) database 
> has something wrong in it.
>
> On Wednesday, June 26, 2013 10:53:25 PM UTC+2, greenpoise wrote:
>>
>> The DB still works but I can see that in my terminal. Just noticed it. Is 
>> this normal?
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

2013-06-26 Thread villas
I was just thinking that some users might have their own functions mixed 
together with web2py functions in web2py.js and might not wish to extricate 
their work and save it elsewhere. 

To overcome that,  make a completely different file to be the framework 
file. I suggested web2py_framework.js but could be any name.  We could then 
load that new file directly after web2py.js and override the original 
framework functions with the new versions.  At least users would then 
hopefuilly get a working version of their own functions and a working 
version of web2py_framework.js without any effort.  We specify exactly 
which functions can be safely removed from web2py.js at the users' leisure.

And yes,  we could also do this by overriding the functions conditionally 
and then leave users the choice as to whether they want the original 
version of the web2py.js or the new framework one,  but there's not much 
point in over-complicating it.  Users that care will review their js code.

The thing I like about web2py_framework.js is that it would be a completely 
new file,  without any user code,  so we could then ask everyone never to 
touch that file.



On Wednesday, 26 June 2013 16:21:58 UTC+1, villas wrote:
>
> +1 Anthony
>
> These days any sophisticated web framework must surely include some JS.  
> The framework must be able to guarantee which functions will be available 
> client-side.
>
> If we accept that at least one JS must be part of the framework,  then we 
> can choose whether this should be web2py.js.
> Perhaps alternatively we announce "web2py_framework.js" and overload all 
> essential functions from that new file.  
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: database disk image is malformed

2013-06-26 Thread Niphlod
sure that is web2py's database ?
That message is usually outputted when yum (the package manager) database 
has something wrong in it.

On Wednesday, June 26, 2013 10:53:25 PM UTC+2, greenpoise wrote:
>
> The DB still works but I can see that in my terminal. Just noticed it. Is 
> this normal?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] database disk image is malformed

2013-06-26 Thread greenpoise
The DB still works but I can see that in my terminal. Just noticed it. Is 
this normal?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Flat text files as data source for web2py

2013-06-26 Thread Ian W. Scott
Ah, I get it. That makes sense.

On Wednesday, June 26, 2013 4:32:50 PM UTC-4, Niphlod wrote:
>
>
>
> On Wednesday, June 26, 2013 7:07:33 PM UTC+2, Ian W. Scott wrote:
>>
>> Thanks Niphlod. I'm intrigued by the diffbook project, so I'll take a 
>> look at your github repo. My main interest is in streamlining my workflow 
>> (not just webdev, but my academic research and teaching as well) around a 
>> large folder of flat files that, when changed, will trigger other events 
>> (like publishing to a blog) automatically.
>>
>> I think you're right that I've confused this kind of flat-file storage 
>> with static site generators like Nikola. So I'll have to think more about 
>> it.
>>
>> When you suggest auth.wiki() you mean to publish text in blog format, 
>> right? It doesn't have anything built in to pull in text files--or does it?
>>
>> Ian
>>
>
> Nope, it doesn't. I was suggesting that in the case you need to have an 
> actual app running that reads something and outputs the HTML every time it 
> gets hit by a request.
>
> That exactly the opposite of the blogging/generator "pattern" of most of 
> those libraries/projects that you referred to, that needs something 
> "external" (i.e. a process watching over files, you manually launching it, 
> etc etc) to trigger a rebuild that outputs the HTML one-time-only (and then 
> save it to disk and/or ship to a static hosting website)
>
> diffbook has no source-code on github: as said before it's a "frozen" 
> version of a "real" app that I freeze with wget and then ship to a static 
> hosting platform (in this case, github pages). 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Flat text files as data source for web2py

2013-06-26 Thread Niphlod


On Wednesday, June 26, 2013 7:07:33 PM UTC+2, Ian W. Scott wrote:
>
> Thanks Niphlod. I'm intrigued by the diffbook project, so I'll take a look 
> at your github repo. My main interest is in streamlining my workflow (not 
> just webdev, but my academic research and teaching as well) around a large 
> folder of flat files that, when changed, will trigger other events (like 
> publishing to a blog) automatically.
>
> I think you're right that I've confused this kind of flat-file storage 
> with static site generators like Nikola. So I'll have to think more about 
> it.
>
> When you suggest auth.wiki() you mean to publish text in blog format, 
> right? It doesn't have anything built in to pull in text files--or does it?
>
> Ian
>

Nope, it doesn't. I was suggesting that in the case you need to have an 
actual app running that reads something and outputs the HTML every time it 
gets hit by a request.

That exactly the opposite of the blogging/generator "pattern" of most of 
those libraries/projects that you referred to, that needs something 
"external" (i.e. a process watching over files, you manually launching it, 
etc etc) to trigger a rebuild that outputs the HTML one-time-only (and then 
save it to disk and/or ship to a static hosting website)

diffbook has no source-code on github: as said before it's a "frozen" 
version of a "real" app that I freeze with wget and then ship to a static 
hosting platform (in this case, github pages). 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

2013-06-26 Thread Anthony


> How about extending this definition and requirement to appadmin..?
>

I don't think any framework functionality depends on appadmin, so you 
should be able to keep an old appadmin if you like, but in both the 
documentation and the admin interface, we should include a reminder to 
update appadmin on upgrade.

Anthony

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: feeding python string object to d3.js csv

2013-06-26 Thread Anthony
In your browser developer tools, can you watch the ajax request and see 
what web2py is returning?

On Wednesday, June 26, 2013 4:03:47 PM UTC-4, greaneym wrote:
>
> This addition of quotes did nothing for me. Somehow the d3 does not load 
> the url because I get a d3 error that there is no data found.
> I can get  json to work with this,
>
> json_data = sj.dumps(pt_data)
>
> then in the view,
> var jdata = {{=XML(response.json(pt_data))}}
>
>   g = new Dygraph( document.getElementById("div_pt"),
>jdata,
>{} );
>
> this loads the data with no problems and makes a graph.
>
> BUT, what I want to be able to do is get a pythonic object for each method 
> of putting data into d3, as described in the d3 wiki.  Except for json, I 
> haven't been yet able to figure this out.
>
> json is a string and so is the pt_data in my code. I need to learn more 
> about d3 methods.  I really appreciate all the help with my questions,
> and look forward to any incorporation of d3 into web2py.
>
>
> Margaret
>
> On Tuesday, June 25, 2013 6:02:52 PM UTC-5, Anthony wrote:
>>
>> I've tried many, many things (I want to get the csv as python solution 
>>> working), including this,
>>
>>   g = new Dygraph( document.getElementById("div_pt"),
>>>d3.csv({{=URL('powertoday','cvstab.csv')}}), 
>>>
>>
>> Your URL needs to be in quotes:
>>
>> d3.csv("{{=URL('powertoday','cvstab.csv')}}")
>>
>> which will result in something like:
>>
>> d3.csv("/yourapp/powertoday/cvstab.csv")
>>
>> Anthony
>>
>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: feeding python string object to d3.js csv

2013-06-26 Thread greaneym
This addition of quotes did nothing for me. Somehow the d3 does not load 
the url because I get a d3 error that there is no data found.
I can get  json to work with this,

json_data = sj.dumps(pt_data)

then in the view,
var jdata = {{=XML(response.json(pt_data))}}

  g = new Dygraph( document.getElementById("div_pt"),
   jdata,
   {} );

this loads the data with no problems and makes a graph.

BUT, what I want to be able to do is get a pythonic object for each method 
of putting data into d3, as described in the d3 wiki.  Except for json, I 
haven't been yet able to figure this out.

json is a string and so is the pt_data in my code. I need to learn more 
about d3 methods.  I really appreciate all the help with my questions,
and look forward to any incorporation of d3 into web2py.


Margaret

On Tuesday, June 25, 2013 6:02:52 PM UTC-5, Anthony wrote:
>
> I've tried many, many things (I want to get the csv as python solution 
>> working), including this,
>
>   g = new Dygraph( document.getElementById("div_pt"),
>>d3.csv({{=URL('powertoday','cvstab.csv')}}), 
>>
>
> Your URL needs to be in quotes:
>
> d3.csv("{{=URL('powertoday','cvstab.csv')}}")
>
> which will result in something like:
>
> d3.csv("/yourapp/powertoday/cvstab.csv")
>
> Anthony
>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: feeding python string object to d3.js csv

2013-06-26 Thread Andrew W
Not sure if its faster, but you'll write less js code if you use json, and it 
makes sense to use the controller to deliver the data in the expected format 
that is directly usable.  Less js coding works for me!

Margaret, as Anthony suggests, try the json approach.  I can post an example 
when I'm next at my computer.

By the way, Im working on a visualisation of the gluon library, once I figure 
out how to extract the module / class hierarchy as a json URL.   Mike uses a 
software package for many of his examples  ( 
http://bl.ocks.org/mbostock/4063550 )

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

2013-06-26 Thread LightDot
+1 for considering web2py.js as a part of web2py framework, so users should 
be requested to update it along with the framework.

How about extending this definition and requirement to appadmin..?

Also - what happens with old apps that have ancient jquery.js? Will new 
web2py.js cause a chain of upgrades for such users, ie. requires new 
jquery.js -> requires new 3rd party js libs -> requires code adjustments in 
the application?

I guess now would be a good time to try out old vanilla welcome apps with 
new web2py/web2py.js... I really hate suggesting such things rather than 
doing them, but I'm up to ears in a project that's on the deadline so I 
have very little free time right now :/

Regards,
Ales

On Wednesday, June 26, 2013 7:00:46 PM UTC+2, viniciusban wrote:
>
> +1 
>
>
> On Wed, Jun 26, 2013 at 1:46 PM, Anthony > 
> wrote: 
> > On Wednesday, June 26, 2013 11:33:59 AM UTC-4, Massimo Di Pierro wrote: 
> >> 
> >> Are you suggested web2py.js should be served by a spacial action and 
> not 
> >> being part of the applications? 
> > 
> > 
> > Interesting idea. 
> > 
> > -- 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "web2py-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Is the "mobile" version of the admin interface not working for you?

2013-06-26 Thread Jason (spot) Brower
I have the latest web2py and it seems the jquery.mobile interface is not
working.  Do you get a similar result?
BR,
Jason

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: auth(), check if name and password from login is in the database

2013-06-26 Thread royski


thx for the quick answer Anthony,

you save my day

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: auth(), check if name and password from login is in the database

2013-06-26 Thread Anthony

>
> def index():


> user_auth = auth.login()
> user_auth.add_button('register me', URL('register_user'))
>

Right after the above, just do:

if auth.user:
session.user_name = auth.user.username

auth.login() not only creates the login form, but it also processes it and 
then logs the user in. So, if the login was successful, auth.user will 
exist after auth.login() has been called.

Do you really need session.user_name in the session, though? You can 
already get it via auth.user.username whenever needed.

Anthony

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Help with WebClient and Pytest

2013-06-26 Thread Ian W. Scott
I'm trying to use WebClient in a pytest suite and getting an error that I 
don't understand. I try to connect like this:

client = WebClient('http://127.0.0.1:8000/paideia/default/', postbacks=
True)
client.get('index')

But client.get('index') throws an error. The error arises in urllib2.py 
line 1184:
   
URLError: 

I assume this means that the rocket server isn't running properly. But I 
can't quite see what the problem is. I set up the test suite like this:

1. from the command-line I launch web2py in the app "paideia" and execute 
the test launcher (runtest.py) in that web2py environment:

python ~/web/web2py/web2py.py -S --ip=127.0.0.1 --port=8000 
--password=password 
paideia -M -R applications/paideia/bin/runtest.py

2. In runtest.py I call pytest programmatically:

import pytest
pytest.main(path/to/test/dir/)

3. Pytest then finds my test suite file (there's only one so far) and runs 
the test, running into the error when I try to access default/index via the 
webclient.

The strange thing is that the web2py environment seems to be there. I have 
access to current and to db. But the http connection seems to fail. 

Any help would be greatly appreciated!

Ian

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Appointment Manager

2013-06-26 Thread Richard Vézina
:)


On Wed, Jun 26, 2013 at 1:54 PM, Tom Russell  wrote:

> Ok thank you. I will update the code for everyone once I have it working.
>
>
>
>
> On Wed, Jun 26, 2013 at 1:52 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I think I cover the week, day, month stuff in your last mail... But it
>> just a matter of initialize the plugin has you want... Just read the plugin
>> doc about that...
>>
>> Richard
>>
>>
>> On Wed, Jun 26, 2013 at 1:51 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> The memory leak was only perceptible with large dataset... Each time the
>>> calendar view is call there is a memory build up until saturation... So I
>>> gues that it could happen when web2py is not restarted during a certain
>>> periode and calendar view is call many many time with a smaller dataset...
>>>
>>> You could use web2py feature to generate data and investigate if the
>>> leak is still there, or you can check the date of the app build... If it
>>> before january 2013, there surely still a memory leak...
>>>
>>> I can provide a code sample for a json feed function, but you will need
>>> to adapt to suit your need...
>>>
>>> Here an example :
>>>
>>> *# Controller*
>>> def calendar():
>>> a='' # empty view only to allow to create a callable view to
>>> initialize the FullCalendar plugin
>>> return dict(a=a)
>>>
>>> def calendar_json_feed():
>>> rows=db(db.your_table.id>0).select(db.your_table.id,
>>> orderby=db.your_table.order_field_if_required, cache=(cache.ram, 86400)) #
>>> 1 day = 86400 sec
>>> # Order issue solve by order in FullCalendar. There is a
>>> specific order issue with chrome :
>>> https://code.google.com/p/fullcalendar/issues/detail?id=379
>>> # To workaround Chrome specific issue I could increment start
>>> time of event of 1 sec
>>> events = []
>>> for i,row in enumerate(rows):
>>> events.append({'title': id_represent[row.id],
>>> 'allDay': False,
>>> 'start': row.date.strftime('%Y-%m-%d 08:30:00'), # Leading
>>> zero is important for Firefox, comment 2 in answer :
>>> http://stackoverflow.com/questions/12771886/jquery-fullcalendar-plugin-events-are-limited-to-3-in-ie-and-firefox
>>> 'end': row.date.strftime('%Y-%m-%d 09:30:00'),
>>> 'url': URL(c='your_controller', f='your_function',
>>> args=('your_table', row.id))})
>>> from gluon.contrib import simplejson
>>> return simplejson.dumps(events)
>>>
>>>
>>> *# View*
>>>
>>> {{response.files.append(URL(r=request,c='static',f='js/fullcalendar.min.js'))}}
>>> {{response.files.append(URL(r=request,c='static',f='js/gcal.js'))}}
>>>
>>> {{response.files.append(URL(r=request,c='static',f='css/fullcalendar.css'))}}
>>>
>>> {{'''response.files.append(URL(r=request,c='static',f='css/fullcalendar.print.css'))'''}}
>>>
>>> {{extend 'layout.html'}}
>>>
>>> {{=T('Calendar')}}
>>>
>>> 
>>>
>>> 
>>>   jQuery(document).ready(function() {
>>>
>>> var date = new Date();
>>> var d = date.getDate();
>>> var m = date.getMonth();
>>> var y = date.getFullYear();
>>>
>>> $('#calendar').fullCalendar({
>>> editable: false,
>>> eventMouseover: function(calEvent, jsEvent, view) {
>>> savBg = $(this).css("background-color");
>>> savClr = $(this).css("color");
>>> $(this).css( { color:'#fff',
>>> backgroundColor:"#006" } );
>>> }, // To set the underline onMouseOver to be
>>> white
>>>// Ex. here :
>>> https://code.google.com/p/fullcalendar/issues/attachmentText?id=1029&aid=10290002000&name=default-mouseover-test.html&token=zcAvPMm_D7u-QIxeSHJm7AiVZic%3A1370289225654
>>> eventSources: [
>>> // Ex.: Google calendar
>>> //{url: '
>>> https://www.google.com/calendar/feeds/ml.richard.vezina%40gmail.com/public/basic
>>> ',
>>> // className: 'gcal-event',
>>> // currentTimezone: 'America/Montreal'},
>>> {url:
>>> '/your_app_name/your_controller/calendar_json_feed', 'color': 'rgb(84, 132,
>>> 237)', cache: true},
>>> // you can insert here all the other json feed you want
>>> for the stuff you want to display, you can change color to make those
>>> differents groups of events distinctive
>>> ],
>>> // feed by simplejson function
>>> //[
>>> //{
>>> //title: "S-20120215-U219-2p",
>>> //allDay: false,
>>> //start: "2013-03-22 08:30:00

Re: [web2py] compute try to understand something

2013-06-26 Thread Richard Vézina
Ok, I think I solve my issues... I had many issues :

First has you said the compute field were not receive all it needs. I solve
this one like this :

form.process().accepted:
for r in session.rows:
row = db[request.args(0)](r.id)
row.update_record(review='TRUE', other_field1=row.other_field1,
etc.)

But there were still a little issue in the way : reveiw='TRUE'

Since in my compute function I was checking for review is True, it was not
working since 'TRUE' was not translated into True because the record wasn't
inserted yet, so I guess my compute function was receiving the raw input.

Damn it!

:)

So now :

row.update_record(review=True, other_field1=row.other_field1, etc.)

Works fine...

Thanks for help.

Richard


On Tue, Jun 25, 2013 at 9:58 AM, Richard Vézina  wrote:

> I will try to pack a little app...
>
> Richard
>
>
> On Fri, Jun 21, 2013 at 4:40 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> It should. Can you provide a concrete example?
>>
>>
>> On Friday, 21 June 2013 10:31:45 UTC-5, Richard wrote:
>>
>>> Further code review lead me to the conclusion that the issue is not
>>> because compute don't get all it needs to compute... I mean I get the row
>>> and since it is a update every field are available in the row and I still
>>> need to redefine the compute field...
>>>
>>> Should computed field computes on db.table(id).update_record(**key=value,
>>> key=value, ...)?
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>> On Thu, Jun 20, 2013 at 5:09 PM, Richard Vézina 
>>> wrote:
>>>
  Ok, yes, it may not have some field that are to None... I had issue
 with that that I have patch my compute function for. I should be the 
 same...

 Thank you Massimo to point me this out.

 Richard


 On Thu, Jun 20, 2013 at 5:02 PM, Massimo Di Pierro <
 massimo@gmail.com> wrote:

> I think the problem is that your form does not contain enough info for
> the computed field. You correctly pull them from DB (in row) and pass to
> the compute function.
>
>
> On Thursday, 20 June 2013 12:13:16 UTC-5, Richard wrote:
>>
>> Hello,
>>
>> I don't understand why I have to redefine my compute field function...
>>
>> I have a compute field like this one :
>>
>> # model
>> db.define_table('mytable',
>> Field('f1', 'string'),
>> Field('review', 'boolean'),
>> Field('record_review_status', compute=lambda record:
>> return_computed(record, request.args(0)))
>>
>> # contoller
>> def fun():
>> form = SQLFORM.factory(Field(...))
>> session.rows = db(db[request.args(0)].review == False).select()
>> table = SQLTABLE(session.rows...)
>> form.process().accepted:
>> for r in session.rows:
>> row = db[request.args(0)](r.id)
>> row.update_record(review='**TRUE**')
>> db.commit()
>> row = db[request.args(0)](r.id)
>> *row.record_review_status = return_record_review_status(row,
>> request.args(0)) # here I need to redefine my record_review_status 
>> compute
>> field or it not get computed*
>> row.update_record()
>> db.commit()
>> ...
>>
>> Note : It is pseudo code, so it may seems dumb or not working, I just
>> try to make an example of what going on in my app...
>>
>> In the book it is said that if we try to update record without
>> passing, web2py tries to compute compute field base on orther field
>> value...
>>
>> http://web2py.com/books/**defaul**t/chapter/29/06?search=**compute**
>> #Computed-fields
>>
>> By the way, this part of the book is not pretty clear... For instance
>> do I have to leave update() of update_record() blank in order to get my
>> compute field to be computed.
>>
>> Also, it is not exactly clear to me why my compute field not get
>> compute on row.update_record(review='**TRUE**')... What I understand
>> is that I need to explicitly update my compute field, but the way to do 
>> it
>> seems to passing not paramaters to update() or update_record().
>>
>> In my case, it seems that my compute function can't get the 'TRUE'
>> for review only once the update(review='TRUE') is committed... I try to
>> remove the line in bold, because it already in my model, but it is not
>> working, my compute field never get updated it status.
>>
>> Thanks to clarify this to me.
>>
>> Richard
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to web2py+un...@**googlegroups.com.
>
> For more options, visit 
> https://groups.goog

Re: [web2py] Appointment Manager

2013-06-26 Thread Tom Russell
Ok thank you. I will update the code for everyone once I have it working.




On Wed, Jun 26, 2013 at 1:52 PM, Richard Vézina  wrote:

> I think I cover the week, day, month stuff in your last mail... But it
> just a matter of initialize the plugin has you want... Just read the plugin
> doc about that...
>
> Richard
>
>
> On Wed, Jun 26, 2013 at 1:51 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> The memory leak was only perceptible with large dataset... Each time the
>> calendar view is call there is a memory build up until saturation... So I
>> gues that it could happen when web2py is not restarted during a certain
>> periode and calendar view is call many many time with a smaller dataset...
>>
>> You could use web2py feature to generate data and investigate if the leak
>> is still there, or you can check the date of the app build... If it before
>> january 2013, there surely still a memory leak...
>>
>> I can provide a code sample for a json feed function, but you will need
>> to adapt to suit your need...
>>
>> Here an example :
>>
>> *# Controller*
>> def calendar():
>> a='' # empty view only to allow to create a callable view to
>> initialize the FullCalendar plugin
>> return dict(a=a)
>>
>> def calendar_json_feed():
>> rows=db(db.your_table.id>0).select(db.your_table.id,
>> orderby=db.your_table.order_field_if_required, cache=(cache.ram, 86400)) #
>> 1 day = 86400 sec
>> # Order issue solve by order in FullCalendar. There is a specific
>> order issue with chrome :
>> https://code.google.com/p/fullcalendar/issues/detail?id=379
>> # To workaround Chrome specific issue I could increment start
>> time of event of 1 sec
>> events = []
>> for i,row in enumerate(rows):
>> events.append({'title': id_represent[row.id],
>> 'allDay': False,
>> 'start': row.date.strftime('%Y-%m-%d 08:30:00'), # Leading
>> zero is important for Firefox, comment 2 in answer :
>> http://stackoverflow.com/questions/12771886/jquery-fullcalendar-plugin-events-are-limited-to-3-in-ie-and-firefox
>> 'end': row.date.strftime('%Y-%m-%d 09:30:00'),
>> 'url': URL(c='your_controller', f='your_function',
>> args=('your_table', row.id))})
>> from gluon.contrib import simplejson
>> return simplejson.dumps(events)
>>
>>
>> *# View*
>>
>> {{response.files.append(URL(r=request,c='static',f='js/fullcalendar.min.js'))}}
>> {{response.files.append(URL(r=request,c='static',f='js/gcal.js'))}}
>>
>> {{response.files.append(URL(r=request,c='static',f='css/fullcalendar.css'))}}
>>
>> {{'''response.files.append(URL(r=request,c='static',f='css/fullcalendar.print.css'))'''}}
>>
>> {{extend 'layout.html'}}
>>
>> {{=T('Calendar')}}
>>
>> 
>>
>> 
>>   jQuery(document).ready(function() {
>>
>> var date = new Date();
>> var d = date.getDate();
>> var m = date.getMonth();
>> var y = date.getFullYear();
>>
>> $('#calendar').fullCalendar({
>> editable: false,
>> eventMouseover: function(calEvent, jsEvent, view) {
>> savBg = $(this).css("background-color");
>> savClr = $(this).css("color");
>> $(this).css( { color:'#fff',
>> backgroundColor:"#006" } );
>> }, // To set the underline onMouseOver to be white
>>// Ex. here :
>> https://code.google.com/p/fullcalendar/issues/attachmentText?id=1029&aid=10290002000&name=default-mouseover-test.html&token=zcAvPMm_D7u-QIxeSHJm7AiVZic%3A1370289225654
>> eventSources: [
>> // Ex.: Google calendar
>> //{url: '
>> https://www.google.com/calendar/feeds/ml.richard.vezina%40gmail.com/public/basic
>> ',
>> // className: 'gcal-event',
>> // currentTimezone: 'America/Montreal'},
>> {url:
>> '/your_app_name/your_controller/calendar_json_feed', 'color': 'rgb(84, 132,
>> 237)', cache: true},
>> // you can insert here all the other json feed you want
>> for the stuff you want to display, you can change color to make those
>> differents groups of events distinctive
>> ],
>> // feed by simplejson function
>> //[
>> //{
>> //title: "S-20120215-U219-2p",
>> //allDay: false,
>> //start: "2013-03-22 08:30:00", // Leading zero is
>> important for Firefox, comment 2 in answer :
>> Re: [web2py] Appointment Manager

I think I cover the week, day, month stuff in your last mail... But it just
a matter of initialize the plugin has you want... Just read the plugin doc
about that...

Richard


On Wed, Jun 26, 2013 at 1:51 PM, Richard Vézina  wrote:

> The memory leak was only perceptible with large dataset... Each time the
> calendar view is call there is a memory build up until saturation... So I
> gues that it could happen when web2py is not restarted during a certain
> periode and calendar view is call many many time with a smaller dataset...
>
> You could use web2py feature to generate data and investigate if the leak
> is still there, or you can check the date of the app build... If it before
> january 2013, there surely still a memory leak...
>
> I can provide a code sample for a json feed function, but you will need to
> adapt to suit your need...
>
> Here an example :
>
> *# Controller*
> def calendar():
> a='' # empty view only to allow to create a callable view to
> initialize the FullCalendar plugin
> return dict(a=a)
>
> def calendar_json_feed():
> rows=db(db.your_table.id>0).select(db.your_table.id,
> orderby=db.your_table.order_field_if_required, cache=(cache.ram, 86400)) #
> 1 day = 86400 sec
> # Order issue solve by order in FullCalendar. There is a specific
> order issue with chrome :
> https://code.google.com/p/fullcalendar/issues/detail?id=379
> # To workaround Chrome specific issue I could increment start time
> of event of 1 sec
> events = []
> for i,row in enumerate(rows):
> events.append({'title': id_represent[row.id],
> 'allDay': False,
> 'start': row.date.strftime('%Y-%m-%d 08:30:00'), # Leading
> zero is important for Firefox, comment 2 in answer :
> http://stackoverflow.com/questions/12771886/jquery-fullcalendar-plugin-events-are-limited-to-3-in-ie-and-firefox
> 'end': row.date.strftime('%Y-%m-%d 09:30:00'),
> 'url': URL(c='your_controller', f='your_function',
> args=('your_table', row.id))})
> from gluon.contrib import simplejson
> return simplejson.dumps(events)
>
>
> *# View*
>
> {{response.files.append(URL(r=request,c='static',f='js/fullcalendar.min.js'))}}
> {{response.files.append(URL(r=request,c='static',f='js/gcal.js'))}}
>
> {{response.files.append(URL(r=request,c='static',f='css/fullcalendar.css'))}}
>
> {{'''response.files.append(URL(r=request,c='static',f='css/fullcalendar.print.css'))'''}}
>
> {{extend 'layout.html'}}
>
> {{=T('Calendar')}}
>
> 
>
> 
>   jQuery(document).ready(function() {
>
> var date = new Date();
> var d = date.getDate();
> var m = date.getMonth();
> var y = date.getFullYear();
>
> $('#calendar').fullCalendar({
> editable: false,
> eventMouseover: function(calEvent, jsEvent, view) {
> savBg = $(this).css("background-color");
> savClr = $(this).css("color");
> $(this).css( { color:'#fff',
> backgroundColor:"#006" } );
> }, // To set the underline onMouseOver to be white
>// Ex. here :
> https://code.google.com/p/fullcalendar/issues/attachmentText?id=1029&aid=10290002000&name=default-mouseover-test.html&token=zcAvPMm_D7u-QIxeSHJm7AiVZic%3A1370289225654
> eventSources: [
> // Ex.: Google calendar
> //{url: '
> https://www.google.com/calendar/feeds/ml.richard.vezina%40gmail.com/public/basic
> ',
> // className: 'gcal-event',
> // currentTimezone: 'America/Montreal'},
> {url: '/your_app_name/your_controller/calendar_json_feed',
> 'color': 'rgb(84, 132, 237)', cache: true},
> // you can insert here all the other json feed you want
> for the stuff you want to display, you can change color to make those
> differents groups of events distinctive
> ],
> // feed by simplejson function
> //[
> //{
> //title: "S-20120215-U219-2p",
> //allDay: false,
> //start: "2013-03-22 08:30:00", // Leading zero is
> important for Firefox, comment 2 in answer :
> http://stackoverflow.com/questions/12771886/jquery-fullcalendar-plugin-events-are-limited-to-3-in-ie-and-firefox
> //end: "2013-03-22 09:30:00",
> //url: '/sgddms/lotns/read/lotns_sample/623'
> //}
> //],
> 

Re: [web2py] Appointment Manager

The memory leak was only perceptible with large dataset... Each time the
calendar view is call there is a memory build up until saturation... So I
gues that it could happen when web2py is not restarted during a certain
periode and calendar view is call many many time with a smaller dataset...

You could use web2py feature to generate data and investigate if the leak
is still there, or you can check the date of the app build... If it before
january 2013, there surely still a memory leak...

I can provide a code sample for a json feed function, but you will need to
adapt to suit your need...

Here an example :

*# Controller*
def calendar():
a='' # empty view only to allow to create a callable view to initialize
the FullCalendar plugin
return dict(a=a)

def calendar_json_feed():
rows=db(db.your_table.id>0).select(db.your_table.id,
orderby=db.your_table.order_field_if_required, cache=(cache.ram, 86400)) #
1 day = 86400 sec
# Order issue solve by order in FullCalendar. There is a specific
order issue with chrome :
https://code.google.com/p/fullcalendar/issues/detail?id=379
# To workaround Chrome specific issue I could increment start time
of event of 1 sec
events = []
for i,row in enumerate(rows):
events.append({'title': id_represent[row.id],
'allDay': False,
'start': row.date.strftime('%Y-%m-%d 08:30:00'), # Leading zero
is important for Firefox, comment 2 in answer :
http://stackoverflow.com/questions/12771886/jquery-fullcalendar-plugin-events-are-limited-to-3-in-ie-and-firefox
'end': row.date.strftime('%Y-%m-%d 09:30:00'),
'url': URL(c='your_controller', f='your_function',
args=('your_table', row.id))})
from gluon.contrib import simplejson
return simplejson.dumps(events)


*# View*
{{response.files.append(URL(r=request,c='static',f='js/fullcalendar.min.js'))}}
{{response.files.append(URL(r=request,c='static',f='js/gcal.js'))}}
{{response.files.append(URL(r=request,c='static',f='css/fullcalendar.css'))}}
{{'''response.files.append(URL(r=request,c='static',f='css/fullcalendar.print.css'))'''}}

{{extend 'layout.html'}}

{{=T('Calendar')}}




  jQuery(document).ready(function() {

var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();

$('#calendar').fullCalendar({
editable: false,
eventMouseover: function(calEvent, jsEvent, view) {
savBg = $(this).css("background-color");
savClr = $(this).css("color");
$(this).css( { color:'#fff',
backgroundColor:"#006" } );
}, // To set the underline onMouseOver to be white
   // Ex. here :
https://code.google.com/p/fullcalendar/issues/attachmentText?id=1029&aid=10290002000&name=default-mouseover-test.html&token=zcAvPMm_D7u-QIxeSHJm7AiVZic%3A1370289225654
eventSources: [
// Ex.: Google calendar
//{url: '
https://www.google.com/calendar/feeds/ml.richard.vezina%40gmail.com/public/basic
',
// className: 'gcal-event',
// currentTimezone: 'America/Montreal'},
{url: '/your_app_name/your_controller/calendar_json_feed',
'color': 'rgb(84, 132, 237)', cache: true},
// you can insert here all the other json feed you want for
the stuff you want to display, you can change color to make those
differents groups of events distinctive
],
// feed by simplejson function
//[
//{
//title: "S-20120215-U219-2p",
//allDay: false,
//start: "2013-03-22 08:30:00", // Leading zero is
important for Firefox, comment 2 in answer :
http://stackoverflow.com/questions/12771886/jquery-fullcalendar-plugin-events-are-limited-to-3-in-ie-and-firefox
//end: "2013-03-22 09:30:00",
//url: '/sgddms/lotns/read/lotns_sample/623'
//}
//],
header: {
left:   'today prevYear,nextYear prev,next',
center: 'title',
right:  'month,basicWeek,basicDay'
},
{{if T.accepted_language.split('-')[0] == 'fr':}}
timeFormat: 'H(:mm)', // uppercase H for 24-hour clock
{{pass}}
monthNames: ["{{=T('January')}}",
"{{=T('February')}}",

[web2py] Builtwith.com now recognizes web2py as a framework.

Hello all,
I tried to get Gary from Builtwith.com to identify web2py as a framework in 
their results. After one month's wait "to refresh the cache", it is now 
identifying any website using web2py and reports them as such (see screen 
shot). 
My 2 cents worth of contribution to this great framework. Cheers!


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


<>

[web2py] Auth registration adding a registration key with requires_approval disabled

I have this in my db.py model:

## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True

If I register for the application (at %app%/default/user/register), it goes 
through (I get a "Success" flash and an entry is added to the auth_user 
table.)  However, every time I register, a registration_key is added to the 
auth_user entry. The user is prevented from logging in until I remove the 
registration key from the auth_user row manually.

It's my understanding that the first 2 lines above should stop a 
registration_key from being added or created - the user should be able to 
log in immediately.

What am I missing?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] auth(), check if name and password from login is in the database



hello,
i am beginner in web2py, and my problem is the login


this is the controller:

def index():

user_auth = auth.login()
user_auth.add_button('register me', URL('register_user'))

#if auth.login():on this point i want authentication if the username 
and password are allready in the db
#session.user_name = user_auth.vars.username
#redirect(URL('welcome'))
#else:
#redirect(URL('invalid_user'))

return dict(user_auth = user_auth)

i simply want to check if the username and the password , which was entered 
by the user in the login form

is in the auth.user database.

I use the default table but name instead of e- mail.



kind regards

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Fields.Virtual says that the column does not exist in 2.5.1 during record edit

Hi Folks,

After update to 2.5.1 I got this message when I try to update a form with
SQLFORM:
 'Row' object has no attribute 'bom'

db.define_table('video',
Field('titulo', requires=IS_NOT_EMPTY(), unique=True),
Field('tag', 'list:reference tag'),
Field('slug', requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,
'video.slug'),IS_NOT_IN_DB(db,'tag.nome'),IS_SLUG(maxlen=80, check=True,
error_message='Isso não é um SLUG')], unique=True),
Field('duracao', requires=IS_NOT_EMPTY()),
Field('thumb', requires=IS_NOT_EMPTY(), represent = lambda value, row:
XML('')),
Field('bom', 'integer', default=1, writable=False, readable=False),
Field('ruim', 'integer', default=1, writable=False, readable=False),
Field('true_views', 'integer', default=0, writable=False,
readable=False),
Field('postar_em', 'datetime', default=request.now),
Field.Virtual('qualidade', lambda row: "%.0f"
%(float(row.video.bom)/(row.video.bom+row.video.ruim)*100)),
Field('ativo', 'boolean', default=True,),
)

 Function argument list

(row=)

But using video.qualidade on views works... it raises the exception during
form edit...

video=db.video(video_id)
form=SQLFORM(db.video,video,submit_button='Salvar')

-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] sqlform.factory widget in field problem

Another solution can be:

{{extend 'layout.html'}}

 Education CV {{=education_form}}

Student {{=student_form}}

School {{=school_form}}


On Wed, Jun 26, 2013 at 12:47 PM, Tom Russell  wrote:

> Saved mine too, got it originally from
> http://www.web2pyslices.com/slice/show/1457/adding-fieldset-and-legend-to-forms
>
>
> On Wed, Jun 26, 2013 at 12:39 PM, António Ramos wrote:
>
>> That is a very clever solution.
>> Saved my day.
>>
>> Thank you
>>
>>
>>
>>
>> 2013/6/26 Tom Russell 
>>
>>> form[0]=TABLE(
>>> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"),
>>> FIELDSET(TAG.legend("Emergency Contact
>>> Info"),TABLE(fs1),_id="register1"),
>>> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"),
>>> TABLE(fs3))
>>>
>>
>>
>>  --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Appointment Manager

Well I updated to the latest fullcalendar and it seems to work good, but do
not know if the memory leak still exists. By any chance could you share
what you did? Also, any chance you added views for week/day in it?

You can see in the example here http://arshaw.com/fullcalendar/ that it has
buttons for day and week also. I tried fiddling with some examples to get
it to show but am not successful yet.

Thanks.


On Wed, Jun 26, 2013 at 1:22 PM, Richard Vézina  wrote:

> Letting FullCalendar consume the json feed...
>
>
> On Wed, Jun 26, 2013 at 1:21 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>>  Take care, I don't know if it has been solve, but I found a memory leak
>> in this app caused by the way FullCalendar is integrated... I solve the
>> issue for my own need by using the json feed feature of FullCalendar doing
>> a simple json feed function returning a well formatted json object with
>> simplejson dump.
>>
>> Richard
>>
>>
>> On Wed, Jun 26, 2013 at 12:55 PM, Tom Russell  wrote:
>>
>>> I am using the appointment manager from
>>> https://github.com/mdipierro/web2py-appliances/tree/master/AppointmentManager
>>> .
>>>
>>> I have tweaked it to my needs and works well so far but there is an
>>> issue trying to use SQLFORM.grid.
>>>
>>> I get an error
>>>  () takes exactly 1 argument (2
>>> given)
>>>
>>> by doing this:
>>>
>>> def appointment_select():
>>> grid = SQLFORM.grid(db.t_appointment, deletable=True, editable=True,
>>> create=False, maxtextlength=64, paginate=25)
>>>
>>> return dict(grid=grid)
>>>
>>> I cannot figure out why it is doing this.
>>>
>>> Any ideas?
>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Appointment Manager

Letting FullCalendar consume the json feed...


On Wed, Jun 26, 2013 at 1:21 PM, Richard Vézina  wrote:

>  Take care, I don't know if it has been solve, but I found a memory leak
> in this app caused by the way FullCalendar is integrated... I solve the
> issue for my own need by using the json feed feature of FullCalendar doing
> a simple json feed function returning a well formatted json object with
> simplejson dump.
>
> Richard
>
>
> On Wed, Jun 26, 2013 at 12:55 PM, Tom Russell  wrote:
>
>> I am using the appointment manager from
>> https://github.com/mdipierro/web2py-appliances/tree/master/AppointmentManager
>> .
>>
>> I have tweaked it to my needs and works well so far but there is an issue
>> trying to use SQLFORM.grid.
>>
>> I get an error
>>  () takes exactly 1 argument (2
>> given)
>>
>> by doing this:
>>
>> def appointment_select():
>> grid = SQLFORM.grid(db.t_appointment, deletable=True, editable=True,
>> create=False, maxtextlength=64, paginate=25)
>>
>> return dict(grid=grid)
>>
>> I cannot figure out why it is doing this.
>>
>> Any ideas?
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Appointment Manager

 Take care, I don't know if it has been solve, but I found a memory leak in
this app caused by the way FullCalendar is integrated... I solve the issue
for my own need by using the json feed feature of FullCalendar doing a
simple json feed function returning a well formatted json object with
simplejson dump.

Richard


On Wed, Jun 26, 2013 at 12:55 PM, Tom Russell  wrote:

> I am using the appointment manager from
> https://github.com/mdipierro/web2py-appliances/tree/master/AppointmentManager
> .
>
> I have tweaked it to my needs and works well so far but there is an issue
> trying to use SQLFORM.grid.
>
> I get an error
>  () takes exactly 1 argument (2 given)
>
> by doing this:
>
> def appointment_select():
> grid = SQLFORM.grid(db.t_appointment, deletable=True, editable=True,
> create=False, maxtextlength=64, paginate=25)
>
> return dict(grid=grid)
>
> I cannot figure out why it is doing this.
>
> Any ideas?
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Flat text files as data source for web2py

Thanks Niphlod. I'm intrigued by the diffbook project, so I'll take a look 
at your github repo. My main interest is in streamlining my workflow (not 
just webdev, but my academic research and teaching as well) around a large 
folder of flat files that, when changed, will trigger other events (like 
publishing to a blog) automatically.

I think you're right that I've confused this kind of flat-file storage with 
static site generators like Nikola. So I'll have to think more about it.

When you suggest auth.wiki() you mean to publish text in blog format, 
right? It doesn't have anything built in to pull in text files--or does it?

Ian

On Tuesday, June 25, 2013 4:24:45 PM UTC-4, Niphlod wrote:
>
> if you want to reinvent the wheel you can play with that, but the "spate" 
> (as you describe that) is actually something that serialize into STATIC 
> webpages a somewhat fixed structure of flat files, on a given command.
>
> I actually did it for the diffbook, http://niphlod.github.io/diffbook/, 
> to use gh-pages as a hosting platform. That is a web2py application that 
> does its own processing, and then gets serialized by a script (a simple 
> wget)
>
> AFAIK, none of the recent "spates" are based on real-time 
> retrieving/recompiling blog posts.
>
> If you need that kind of "process", just use auth.wiki().
>
> On Tuesday, June 25, 2013 8:55:58 PM UTC+2, Ian W. Scott wrote:
>>
>> I'm attracted to the spate of recent flat-file blogging platforms, using 
>> plain text (markdown) files to store the blog posts. I especially like the 
>> idea of using dropbox or a git repo to store the files. 
>>
>> Has anyone experimented with this in web2py? I can imagine at least two 
>> ways of doing it:
>>
>> 1. A controller retrieves the text file at runtime based on its filename, 
>> parses it as necessary, and passes it through to the view. This strikes me 
>> as both simplest and slowest. It would bypass the web2py model structure 
>> altogether. It could be sped up significantly by caching pages on the 
>> server. 
>>
>> 2. A watcher of some sort (cron/scheduler job, other utility watching for 
>> file changes, git hook?) notices any new/changed files in the content 
>> directory. This triggers a call to a background process that parses the 
>> file and stores its content in the db. This would have the advantage of 
>> using a model and the associated data abstraction, and on first page access 
>> I assume it would be faster. But I'm not sure that the small speed-up is 
>> worth the extra complexity, especially if the speed is negated by 
>> server-side caching.
>>
>> I suppose that something like 2 would have to be present in 1 anyway, 
>> since the system would have to recognize the presence of a new file and add 
>> it to the index of available posts.
>>
>> Are there other approaches I'm not thinking of? Tools or libraries that 
>> would be useful in the process? Or do you think it's all just not worth the 
>> trouble?
>>
>> Thanks,
>>
>> Ian 
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

+1


On Wed, Jun 26, 2013 at 1:46 PM, Anthony  wrote:
> On Wednesday, June 26, 2013 11:33:59 AM UTC-4, Massimo Di Pierro wrote:
>>
>> Are you suggested web2py.js should be served by a spacial action and not
>> being part of the applications?
>
>
> Interesting idea.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

On Wednesday, June 26, 2013 11:33:59 AM UTC-4, Massimo Di Pierro wrote:

> Are you suggested web2py.js should be served by a spacial action and not 
> being part of the applications?
>

Interesting idea.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Appointment Manager

I am using the appointment manager from
https://github.com/mdipierro/web2py-appliances/tree/master/AppointmentManager
.

I have tweaked it to my needs and works well so far but there is an issue
trying to use SQLFORM.grid.

I get an error
 () takes exactly 1 argument (2 given)

by doing this:

def appointment_select():
grid = SQLFORM.grid(db.t_appointment, deletable=True, editable=True,
create=False, maxtextlength=64, paginate=25)

return dict(grid=grid)

I cannot figure out why it is doing this.

Any ideas?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Adding custom operators to DAL

Thanks Anthony and Massimo. It all works now!

On Thursday, 27 June 2013 00:42:26 UTC+8, Anthony wrote:
>
> from gluon.dal import Expression
>
> Anthony
>
> On Wednesday, June 26, 2013 11:53:34 AM UTC-4, Calvin wrote:
>>
>> Not sure why it says my previous reply has been deleted but here it is 
>> again:
>>
>> Hi Massimo
>>
>>
>> I am not familiar with the method you suggested but when I tried it, I 
>> got the following error:
>>
>>
>> print db(Expression(db,"business_view.loc && 
>> ST_MakeEnvelope(42.179139323652443, 141.20906066894531, 42.307520083522473, 
>> 143.34776306152344)")).select().as_list()
>>
>> NameError: global name 'Expression' is not defined
>>
>>
>> In any case, in the non-working example that I tried, I was trying to use 
>> the bounding box operator in postgis, which is not currently available in 
>> the DAL... With the approach I suggested, I managed to get it to work 
>> without issues.
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] sqlform.factory widget in field problem

Saved mine too, got it originally from
http://www.web2pyslices.com/slice/show/1457/adding-fieldset-and-legend-to-forms


On Wed, Jun 26, 2013 at 12:39 PM, António Ramos wrote:

> That is a very clever solution.
> Saved my day.
>
> Thank you
>
>
>
>
> 2013/6/26 Tom Russell 
>
>> form[0]=TABLE(
>> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"),
>> FIELDSET(TAG.legend("Emergency Contact
>> Info"),TABLE(fs1),_id="register1"),
>> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"),
>> TABLE(fs3))
>>
>
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Adding custom operators to DAL

from gluon.dal import Expression

Anthony

On Wednesday, June 26, 2013 11:53:34 AM UTC-4, Calvin wrote:
>
> Not sure why it says my previous reply has been deleted but here it is 
> again:
>
> Hi Massimo
>
>
> I am not familiar with the method you suggested but when I tried it, I got 
> the following error:
>
>
> print db(Expression(db,"business_view.loc && 
> ST_MakeEnvelope(42.179139323652443, 141.20906066894531, 42.307520083522473, 
> 143.34776306152344)")).select().as_list()
>
> NameError: global name 'Expression' is not defined
>
>
> In any case, in the non-working example that I tried, I was trying to use 
> the bounding box operator in postgis, which is not currently available in 
> the DAL... With the approach I suggested, I managed to get it to work 
> without issues.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] sqlform.factory widget in field problem

That is a very clever solution.
Saved my day.

Thank you




2013/6/26 Tom Russell 

> form[0]=TABLE(
> FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"),
> FIELDSET(TAG.legend("Emergency Contact
> Info"),TABLE(fs1),_id="register1"),
> FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"),
> TABLE(fs3))
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Ref another table in another app

How would I do this:

I need to create an appointment for a patient so from my list of patients i
have a link to call another app to do the appointment. I have the link set
so it looks like this:

links = [lambda row: A(T('Create
Appointment'),_href=URL("AppointmentManager","default",
"appointment_create"), args=[row.id])]

In the appointment app how do I let it know what to use for the patient?
Basically I want to pass in the patient info to the other app and have that
displayed in the app. I know you can reference another table but not sure
how to do this in this situation.

Any suggestions?

Thanks.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] sqlform.factory widget in field problem

To group inside a field I do something like this with 3 different tables:

form=SQLFORM.factory(db.patient, db.emergencycontacts, db.dependents)
fs0=form[0][:26] #patient rows
fs1=form[0][26:37]   #emergency contacts
fs2=form[0][37:41] #dependents
fs3=form[0][-1] # submit row (last)

form[0]=TABLE(
FIELDSET(TAG.legend("Patient Info"),TABLE(fs0),_id="register0"),
FIELDSET(TAG.legend("Emergency Contact
Info"),TABLE(fs1),_id="register1"),
FIELDSET(TAG.legend("Dependents"),TABLE(fs2),_id="register2"),
TABLE(fs3))


HTH


On Wed, Jun 26, 2013 at 11:58 AM, António Ramos wrote:

> Just drafting something but here is the problem
>
> My context:
> I have 3 tables
>
> table form
> table steps
> table fields
>
> A form can have many steps
> a step can have many fields
>
> This way i can have one form with 3 steps, each with some fields and
> another form with 10 steps , each with some more fields.
>
> i read these tables to create a form using factory.
>
> i have 2 problems
>
>
> *1 i need to mark the input fields with a "step" tag *
>
> here is my code:
>
> def my_string_widget(field, value,step):
>
> return INPUT(_name=field.name,
>   _id="%s_%s" % (field._tablename, field.name),
>   _class=field.type,
>   _value='',
>   *_step=step,*
>   requires=field.requires)
>
> def index():
> cont=0
> fields=[]
> formid=db.form(request.args(0) or 1)
> steps=formid.steps.select()
> for step in steps:
> print "step id-",step.id
> for field in step.fields.select():
> print "field...",field.step
> fields.append(Field(field.nome,widget=lambda
> field,value:my_string_widget(field,value,*step.id*)))
>
> form=SQLFORM.factory(*fields)
> print form
> if form.process().accepted:
> response.flash='a gravar registo'
> return dict(nome=formid.nome,form=form)
>
>
> The problem is:
> It marks all fields with the same "step" value, the last value in *step.id,
> why?*
> *
> *
> *2 - sqlformfactory *
> how do i group sqlformfactory fields inside a div?
> i want to create a section for each step in the form to style with css
>
> Best regards
> António
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] sqlform.factory widget in field problem

Just drafting something but here is the problem

My context:
I have 3 tables

table form
table steps
table fields

A form can have many steps
a step can have many fields

This way i can have one form with 3 steps, each with some fields and
another form with 10 steps , each with some more fields.

i read these tables to create a form using factory.

i have 2 problems


*1 i need to mark the input fields with a "step" tag *

here is my code:

def my_string_widget(field, value,step):

return INPUT(_name=field.name,
  _id="%s_%s" % (field._tablename, field.name),
  _class=field.type,
  _value='',
  *_step=step,*
  requires=field.requires)

def index():
cont=0
fields=[]
formid=db.form(request.args(0) or 1)
steps=formid.steps.select()
for step in steps:
print "step id-",step.id
for field in step.fields.select():
print "field...",field.step
fields.append(Field(field.nome,widget=lambda
field,value:my_string_widget(field,value,*step.id*)))

form=SQLFORM.factory(*fields)
print form
if form.process().accepted:
response.flash='a gravar registo'
return dict(nome=formid.nome,form=form)


The problem is:
It marks all fields with the same "step" value, the last value in *step.id,
why?*
*
*
*2 - sqlformfactory *
how do i group sqlformfactory fields inside a div?
i want to create a section for each step in the form to style with css

Best regards
António

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Adding custom operators to DAL

Not sure why it says my previous reply has been deleted but here it is 
again:

Hi Massimo


I am not familiar with the method you suggested but when I tried it, I got 
the following error:


print db(Expression(db,"business_view.loc && 
ST_MakeEnvelope(42.179139323652443, 141.20906066894531, 42.307520083522473, 
143.34776306152344)")).select().as_list()

NameError: global name 'Expression' is not defined


In any case, in the non-working example that I tried, I was trying to use 
the bounding box operator in postgis, which is not currently available in 
the DAL... With the approach I suggested, I managed to get it to work 
without issues.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Add button to smartgrid?

I need to add a button to the smartgrid but not like doing create=True
because I have a form factory that has 2 other tables associated with the
one. I know in html I can simply add a line for a button but since I am not
using html for this how would I add a button to that page to reference my
own view?

Thanks.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

Are you suggested web2py.js should be served by a spacial action and not 
being part of the applications?

On Wednesday, 26 June 2013 10:21:58 UTC-5, villas wrote:
>
> +1 Anthony
>
> These days any sophisticated web framework must surely include some JS.  
> The framework must be able to guarantee which functions will be available 
> client-side.
>
> If we accept that at least one JS must be part of the framework,  then we 
> can choose whether this should be web2py.js.
> Perhaps alternatively we announce "web2py_framework.js" and overload all 
> essential functions from that new file.  
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Can view, but can't edit files

Let me clarify.  The server is a headless system (actually, a small plug 
computer).  So, I can access it like this:

Local LAN PC#1: 192.168.xxx.111 -> Server: 192.168.xxx.222 .  This works ok.

Now, when I ssh tunnel to PC#1 or to Server, I can go to URL: 
https://192.168.xxx.222/admin or https://127.0.0.1/admin and I can connect 
to web2py admin and authenticate to it.  But when I open an application 
file, nothing appears in the edit window.  I've tried this using different 
browsers, etc.  but I can't get the edit window to appear.


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

+1 Anthony

These days any sophisticated web framework must surely include some JS.  
The framework must be able to guarantee which functions will be available 
client-side.

If we accept that at least one JS must be part of the framework,  then we 
can choose whether this should be web2py.js.
Perhaps alternatively we announce "web2py_framework.js" and overload all 
essential functions from that new file.  

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: SQLFORM.smartgrid

That is awesome, I did not know that! Just when you think its more
complicated than not, its easy.

So how do I reference that from the dependents table so that in my smart
grid it shows the patients name associated with the dependent?

Thanks


On Wed, Jun 26, 2013 at 10:43 AM, Anthony  wrote:

> db.define_table('patient',
> ...,
> format='%(first_name)s %(last_name)s')
>
> "format" can also be a function that takes a row object and generates the
> desired output.
>
> The "format" attribute is used to create a default "represent" attribute
> for any reference fields that reference this table.
>
> Anthony
>
>
> On Wednesday, June 26, 2013 10:24:32 AM UTC-4, Tom Russell wrote:
>
>> db.define_table('patient',
>> #db.patient.id.readable=False # Since we do not want to expose the id
>> field on the grid
>> Field('alternatepid', label='Alternate PID', writable=False,
>> readable=False),
>> Field('first_name', label='First Name', requires=IS_NOT_EMPTY()),
>> Field('middle_name', label='Middle Name'),
>> Field('last_name', label='Last Name', requires=IS_NOT_EMPTY()),
>> Field('suffix', label='Suffix', requires=IS_IN_SET(['I', 'II', 'III',
>> 'IV', 'V', 'Jr', 'Sr'])),
>> Field('date_of_birth', 'date', label='Date of Birth',
>> required=IS_DATE(), requires=IS_NOT_EMPTY()),
>> Field('gender', label='Gender', requires=IS_IN_SET(['Male', 'Female',
>> 'Other'])),
>> Field('full_name',  label='Full Name', writable=False,
>> readable=False),
>> Field('address1', label='Address1', requires=IS_NOT_EMPTY()),
>> Field('address2', label='Address2'),
>> Field('city',  label='City', requires=IS_NOT_EMPTY()),
>> Field('state',  label='State', requires=IS_NOT_EMPTY()),
>> Field('zipcode',  label='Zip Code', requires=IS_NOT_EMPTY()),
>> Field('addresstype',  label='AddressType'),
>> Field('county',  label='County', ),
>> Field('country',  label='Country', requires=IS_IN_SET(COUNTRIES))**,
>> Field('phone',  label='Phone', ),
>> Field('mobile_phone',  label='Mobile Phone'),
>> Field('emailaddress',  label='Email Address', requires =
>> IS_EMAIL(error_message='**invalid email!')),
>> Field('ethnicity',  label='Ethnicity', requires=IS_IN_SET(['**Caucasian',
>> 'Hispanic', 'Chinese'])),
>> Field('age', label='Age'),
>> Field('marital_status',  label='Marital Status',
>> requires=IS_IN_SET(['Single', 'Married', 'Divorced', 'Separated',
>> 'Widowed'])),
>> Field('comment', 'text', label='Comment'),
>> Field('government_id_number',  label='Government ID Number',
>> requires=IS_NOT_EMPTY()),
>> Field('is_newborn', 'boolean',  label='Is Newborn', ),
>> Field('medical_record_number',  label='MRN', readable=True,
>> requires=IS_NOT_EMPTY()),
>> Field('other_id_type',  label='Other ID Type',
>> requires=IS_IN_SET(['Work', 'Library Card', 'Drivers License', 'School ID',
>> 'Other'])),
>> Field('other_id', label='Other ID'),
>> )
>>
>>
>> db.define_table(
>> 'dependents',
>> #Field('patient name', db.linked patient, represent=lambda c,
>> row:first_name of patient(c), requires=IS_IN_DB(db,'field.id**
>> ','%(patient)s')),
>> Field('patient','reference patient', writable=False, readable=False),
>> Field('dep_firstname', label='First Name'),
>> Field('dep_middlename', label='Middle Name'),
>> Field('dep_lastname', label='Last Name'),
>> Field('dep_relationship', label='Relationship',
>> requires=IS_IN_SET(['Son', 'Daughter', 'Other'])),
>> )
>>
>> db.define_table(
>> 'emergencycontacts',
>> Field('patient','reference patient', writable=False, readable=False),
>> Field('em_first_name', label='First Name'),
>> Field('em_middle_name', label='Middle Name'),
>> Field('em_last_name', label='Last Name'),
>> Field('em_address1', label='Address1'),
>> Field('em_address2', label='Address2'),
>> Field('em_city', label='City'),
>> Field('em_state', label='State'),
>> Field('em_zipcode', label='Zip Code'),
>> Field('em_country', label='Country', requires=IS_IN_SET(COUNTRIES))**
>> ,
>> Field('em_phone', label='Phone'),
>> Field('em_relationship', label='Relationship',
>> requires=IS_IN_SET(['Aunt', 'Uncle', 'Parent', 'Sibling', 'Spouse',
>> 'Guardian'])),
>> )
>>
>> I'd like to reference the first and last name of the patient the record
>> is associated with.
>>
>> Thanks.
>>
>>
>> On Wed, Jun 26, 2013 at 10:20 AM, Anthony  wrote:
>>
>>> Can you show your three table definitions? The simplest method is just
>>> to specify a "format" attribute for db.patient, which will be used by any
>>> referencing fields.
>>>
>>> Anthony
>>>
>>>
>>> On Wednesday, June 26, 2013 1:06:03 AM UTC-4, Tom Russell wrote:

 Another question on the smartgrid.

 I have linked tables in my smartgrid like:

 grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True,
 create=False, maxtextlength=64, paginate=25, links=links,
 links

Re: [web2py] Re: SQLFORM.smartgrid

db.define_table('patient',
...,
format='%(first_name)s %(last_name)s')

"format" can also be a function that takes a row object and generates the 
desired output.

The "format" attribute is used to create a default "represent" attribute 
for any reference fields that reference this table.

Anthony

On Wednesday, June 26, 2013 10:24:32 AM UTC-4, Tom Russell wrote:
>
> db.define_table('patient',
> #db.patient.id.readable=False # Since we do not want to expose the id 
> field on the grid
> Field('alternatepid', label='Alternate PID', writable=False, 
> readable=False),
> Field('first_name', label='First Name', requires=IS_NOT_EMPTY()),
> Field('middle_name', label='Middle Name'),
> Field('last_name', label='Last Name', requires=IS_NOT_EMPTY()),
> Field('suffix', label='Suffix', requires=IS_IN_SET(['I', 'II', 'III', 
> 'IV', 'V', 'Jr', 'Sr'])),
> Field('date_of_birth', 'date', label='Date of Birth', 
> required=IS_DATE(), requires=IS_NOT_EMPTY()),
> Field('gender', label='Gender', requires=IS_IN_SET(['Male', 'Female', 
> 'Other'])),
> Field('full_name',  label='Full Name', writable=False, readable=False),
> Field('address1', label='Address1', requires=IS_NOT_EMPTY()),
> Field('address2', label='Address2'),
> Field('city',  label='City', requires=IS_NOT_EMPTY()),
> Field('state',  label='State', requires=IS_NOT_EMPTY()),
> Field('zipcode',  label='Zip Code', requires=IS_NOT_EMPTY()),
> Field('addresstype',  label='AddressType'),
> Field('county',  label='County', ),
> Field('country',  label='Country', requires=IS_IN_SET(COUNTRIES)),
> Field('phone',  label='Phone', ),
> Field('mobile_phone',  label='Mobile Phone'),
> Field('emailaddress',  label='Email Address', requires = 
> IS_EMAIL(error_message='invalid email!')),
> Field('ethnicity',  label='Ethnicity', 
> requires=IS_IN_SET(['Caucasian', 'Hispanic', 'Chinese'])),
> Field('age', label='Age'),
> Field('marital_status',  label='Marital Status', 
> requires=IS_IN_SET(['Single', 'Married', 'Divorced', 'Separated', 
> 'Widowed'])),
> Field('comment', 'text', label='Comment'),
> Field('government_id_number',  label='Government ID Number', 
> requires=IS_NOT_EMPTY()),
> Field('is_newborn', 'boolean',  label='Is Newborn', ),
> Field('medical_record_number',  label='MRN', readable=True, 
> requires=IS_NOT_EMPTY()),
> Field('other_id_type',  label='Other ID Type', 
> requires=IS_IN_SET(['Work', 'Library Card', 'Drivers License', 'School ID', 
> 'Other'])),
> Field('other_id', label='Other ID'),
> )
>
>
> db.define_table(
> 'dependents',
> #Field('patient name', db.linked patient, represent=lambda c, 
> row:first_name of patient(c), requires=IS_IN_DB(db,'field.id
> ','%(patient)s')),
> Field('patient','reference patient', writable=False, readable=False),
> Field('dep_firstname', label='First Name'),
> Field('dep_middlename', label='Middle Name'),
> Field('dep_lastname', label='Last Name'),
> Field('dep_relationship', label='Relationship', 
> requires=IS_IN_SET(['Son', 'Daughter', 'Other'])),
> )
>
> db.define_table(
> 'emergencycontacts',
> Field('patient','reference patient', writable=False, readable=False),
> Field('em_first_name', label='First Name'),
> Field('em_middle_name', label='Middle Name'),
> Field('em_last_name', label='Last Name'),
> Field('em_address1', label='Address1'),
> Field('em_address2', label='Address2'),
> Field('em_city', label='City'),
> Field('em_state', label='State'),
> Field('em_zipcode', label='Zip Code'),
> Field('em_country', label='Country', requires=IS_IN_SET(COUNTRIES)),
> Field('em_phone', label='Phone'),
> Field('em_relationship', label='Relationship', 
> requires=IS_IN_SET(['Aunt', 'Uncle', 'Parent', 'Sibling', 'Spouse', 
> 'Guardian'])),
> )
>
> I'd like to reference the first and last name of the patient the record is 
> associated with.
>
> Thanks.
>
>
> On Wed, Jun 26, 2013 at 10:20 AM, Anthony 
> > wrote:
>
>> Can you show your three table definitions? The simplest method is just to 
>> specify a "format" attribute for db.patient, which will be used by any 
>> referencing fields.
>>
>> Anthony
>>
>>
>> On Wednesday, June 26, 2013 1:06:03 AM UTC-4, Tom Russell wrote:
>>>
>>> Another question on the smartgrid.
>>>
>>> I have linked tables in my smartgrid like:
>>>
>>> grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True, 
>>> create=False, maxtextlength=64, paginate=25, links=links,
>>> links_in_grid=True, linked_tables=['**emergencycontacts','**
>>> dependents'])
>>>
>>> When clicking on the linked table it shows the id of patient since thats 
>>> what reference but how can I show the name of the patient rather than the 
>>> id of patient?
>>>
>>> Thanks,
>>>
>>> Tom
>>>
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>>

Re: [web2py] Re: SQLFORM.smartgrid

db.define_table('patient',
#db.patient.id.readable=False # Since we do not want to expose the id
field on the grid
Field('alternatepid', label='Alternate PID', writable=False,
readable=False),
Field('first_name', label='First Name', requires=IS_NOT_EMPTY()),
Field('middle_name', label='Middle Name'),
Field('last_name', label='Last Name', requires=IS_NOT_EMPTY()),
Field('suffix', label='Suffix', requires=IS_IN_SET(['I', 'II', 'III',
'IV', 'V', 'Jr', 'Sr'])),
Field('date_of_birth', 'date', label='Date of Birth',
required=IS_DATE(), requires=IS_NOT_EMPTY()),
Field('gender', label='Gender', requires=IS_IN_SET(['Male', 'Female',
'Other'])),
Field('full_name',  label='Full Name', writable=False, readable=False),
Field('address1', label='Address1', requires=IS_NOT_EMPTY()),
Field('address2', label='Address2'),
Field('city',  label='City', requires=IS_NOT_EMPTY()),
Field('state',  label='State', requires=IS_NOT_EMPTY()),
Field('zipcode',  label='Zip Code', requires=IS_NOT_EMPTY()),
Field('addresstype',  label='AddressType'),
Field('county',  label='County', ),
Field('country',  label='Country', requires=IS_IN_SET(COUNTRIES)),
Field('phone',  label='Phone', ),
Field('mobile_phone',  label='Mobile Phone'),
Field('emailaddress',  label='Email Address', requires =
IS_EMAIL(error_message='invalid email!')),
Field('ethnicity',  label='Ethnicity', requires=IS_IN_SET(['Caucasian',
'Hispanic', 'Chinese'])),
Field('age', label='Age'),
Field('marital_status',  label='Marital Status',
requires=IS_IN_SET(['Single', 'Married', 'Divorced', 'Separated',
'Widowed'])),
Field('comment', 'text', label='Comment'),
Field('government_id_number',  label='Government ID Number',
requires=IS_NOT_EMPTY()),
Field('is_newborn', 'boolean',  label='Is Newborn', ),
Field('medical_record_number',  label='MRN', readable=True,
requires=IS_NOT_EMPTY()),
Field('other_id_type',  label='Other ID Type',
requires=IS_IN_SET(['Work', 'Library Card', 'Drivers License', 'School ID',
'Other'])),
Field('other_id', label='Other ID'),
)


db.define_table(
'dependents',
#Field('patient name', db.linked patient, represent=lambda c,
row:first_name of patient(c), requires=IS_IN_DB(db,'field.id
','%(patient)s')),
Field('patient','reference patient', writable=False, readable=False),
Field('dep_firstname', label='First Name'),
Field('dep_middlename', label='Middle Name'),
Field('dep_lastname', label='Last Name'),
Field('dep_relationship', label='Relationship',
requires=IS_IN_SET(['Son', 'Daughter', 'Other'])),
)

db.define_table(
'emergencycontacts',
Field('patient','reference patient', writable=False, readable=False),
Field('em_first_name', label='First Name'),
Field('em_middle_name', label='Middle Name'),
Field('em_last_name', label='Last Name'),
Field('em_address1', label='Address1'),
Field('em_address2', label='Address2'),
Field('em_city', label='City'),
Field('em_state', label='State'),
Field('em_zipcode', label='Zip Code'),
Field('em_country', label='Country', requires=IS_IN_SET(COUNTRIES)),
Field('em_phone', label='Phone'),
Field('em_relationship', label='Relationship',
requires=IS_IN_SET(['Aunt', 'Uncle', 'Parent', 'Sibling', 'Spouse',
'Guardian'])),
)

I'd like to reference the first and last name of the patient the record is
associated with.

Thanks.


On Wed, Jun 26, 2013 at 10:20 AM, Anthony  wrote:

> Can you show your three table definitions? The simplest method is just to
> specify a "format" attribute for db.patient, which will be used by any
> referencing fields.
>
> Anthony
>
>
> On Wednesday, June 26, 2013 1:06:03 AM UTC-4, Tom Russell wrote:
>>
>> Another question on the smartgrid.
>>
>> I have linked tables in my smartgrid like:
>>
>> grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True,
>> create=False, maxtextlength=64, paginate=25, links=links,
>> links_in_grid=True, linked_tables=['**emergencycontacts','**
>> dependents'])
>>
>> When clicking on the linked table it shows the id of patient since thats
>> what reference but how can I show the name of the patient rather than the
>> id of patient?
>>
>> Thanks,
>>
>> Tom
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Storing attachments

Hi,

I have a question:
if request.env.request_method == "POST":
attachments = request.vars.attachments
if len(attachments) > 0:
for attachment in attachments:
image = db.entry_value.upload_value.store(attachment.
file, attachment.filename)
I have a code like this, i would like to use store() without any relation 
to database.
db.entry_value.upload_value.store(attachment.file, attachment.filename)

I am not using DAL, i am using pymongo directly, all i need is to store 
image on the filesystem and then write the filename in MongoDB with 
pymongo. Is it possible to upload the file without any relation to database?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: SQLFORM.smartgrid

Can you show your three table definitions? The simplest method is just to 
specify a "format" attribute for db.patient, which will be used by any 
referencing fields.

Anthony

On Wednesday, June 26, 2013 1:06:03 AM UTC-4, Tom Russell wrote:
>
> Another question on the smartgrid.
>
> I have linked tables in my smartgrid like:
>
> grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True, 
> create=False, maxtextlength=64, paginate=25, links=links,
> links_in_grid=True, linked_tables=['emergencycontacts','dependents'])
>
> When clicking on the linked table it shows the id of patient since thats 
> what reference but how can I show the name of the patient rather than the 
> id of patient?
>
> Thanks,
>
> Tom
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

On Wednesday, June 26, 2013 9:19:23 AM UTC-4, Massimo Di Pierro wrote:

> That is dangerous. What if people rely on an older version of have edited 
> it?


That's the point. web2py.js is not like the rest of the scaffold (i.e., 
optional and customizable) -- it interacts with the core framework, so it 
really belongs to the framework. You shouldn't edit it or rely on an older 
version of it any more than you should edit or rely on an older version of 
one of the gluon modules.

My understanding is that the changes to web2py.js in 2.6.0 will preserve 
backward compatibility of the API for older apps that call ajax(), 
web2py_component(), etc., so apps should only break if they have customized 
web2py.js or if they use some of its non-public functions (behaviors that 
we should discourage going forward).

Anyway, we're already requiring the web2py.js upgrade with 2.6.0 -- why not 
take the opportunity to explicitly make this a general requirement going 
forward rather than being locked in to a frozen version of web2py.js?
 

> I think it is part of the specs that web2py upgrades do not touch the apps.


I think this one file has to be an exception. It doesn't seem feasible to 
have Javascript/ajax integrated with the core framework and yet not require 
that the Javascript be updated along with the framework.

Moreover, what if an old app is installed after an upgrade?


They'll break, but such apps will already break with the planned changes in 
2.6.0.

Anthony

On Wednesday, 26 June 2013 07:10:16 UTC-5, Anthony wrote:
>>
>> More generally, we should probably make it more clear that web2py.js is 
>> properly a part of the framework and must be upgraded whenever the 
>> framework is upgraded (this could be mentioned 
>> here, 
>> and maybe a reminder message could be shown in admin when its upgrade 
>> button is used).
>>
>> Anthony
>>
>> On Wednesday, June 26, 2013 7:36:07 AM UTC-4, viniciusban wrote:
>>>
>>> I think this is a note that must be highlighted before releasing as 
>>> stable, right? 
>>>
>>> On Wed, Jun 26, 2013 at 7:14 AM, Massimo DiPierro 
>>>  wrote: 
>>> > There is a major change upcoming in web2py 2.6 (which can be tested in 
>>> trunk). 
>>> > 
>>> > The change involves a better rewrite of web2py.js agreed upon the 
>>> developers and implemented by Niphlod. 
>>> > 
>>> > Because of this change  applications which use components will break 
>>> unless you upgrade the old web2py.js with the new one. 
>>> > 
>>> > Anyway, try the latest trunk, check it out, and send us comments. 
>>> > 
>>> > Massimo 
>>> > 
>>> > 
>>> > -- 
>>> > 
>>> > --- 
>>> > You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group. 
>>> > To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com. 
>>> > For more options, visit https://groups.google.com/groups/opt_out. 
>>> > 
>>> > 
>>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: SQLFORM.smartgrid

Apparently something is not correct as I cannot figure out what the syntax
erro is based on the example you gave here.

This is what I have:

Field('patient name', db.linked patient, represent=lambda c, row:first_name
of patient(c), requires=IS_IN_DB(db,'field.id','%(patient)s')),


On Wed, Jun 26, 2013 at 2:49 AM, Rohitraj Sharma <
rohitraj.sha...@themislexsol.com> wrote:

> You can use labda function in your db
>
> Field('companyField name',db.linked table name, represent=lambda c,
> row:field name of linked table(c), requires=IS_IN_DB(db,'field.id
> ','%(patient)s')),
>
>
> On Wednesday, 26 June 2013 10:36:03 UTC+5:30, Tom Russell wrote:
>>
>> Another question on the smartgrid.
>>
>> I have linked tables in my smartgrid like:
>>
>> grid = SQLFORM.smartgrid(db.patient, deletable=True, editable=True,
>> create=False, maxtextlength=64, paginate=25, links=links,
>> links_in_grid=True, linked_tables=['**emergencycontacts','**
>> dependents'])
>>
>> When clicking on the linked table it shows the id of patient since thats
>> what reference but how can I show the name of the patient rather than the
>> id of patient?
>>
>> Thanks,
>>
>> Tom
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] about routes.py

On 26 Jun 2013, at 6:33 AM, Martin Weissenboeck  wrote:
> I have tried routes.py with the builtin server - works fine.
> Afterward I went to another computer, which runs Apache.
> I want  
> https://contr1.mydomain.com to route to https://myapp.mydomain.com/contr1
> https://contr2.mydomain.com to route to https://myapp.mydomain.com/contr2
> https://contr3.mydomain.com to route to https://myapp.mydomain.com/contr3
> 
> But it seems, that Apache wants three virtual servers 
> (https://contr1.mydomain.com and so on).
> Is it possible to solve this problem with one virtual server and the 
> routes.py-file?

I'm no expert on Apache configuration, but I think you want to have a single 
VirtualHost section with something like this:

ServerName contr1.mydomain.com
ServerAlias contr2.mydomain.com
ServerAlias contr3.mydomain.com

http://httpd.apache.org/docs/current/vhosts/examples.html

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Select table in drop down import the file and edit

Using the browser developer tools, what URL gets requested when the ajax 
call is made?

On Wednesday, June 26, 2013 2:44:18 AM UTC-4, Rohitraj Sharma wrote:
>
>  I want to select some particular table from database in a drop dowan. 
> Then import csv file. edit that file and update. . Can Any one can help me 
> plz
>
> i am using the fallowing code for that
>
>
> View
>
> 
> jQuery(function() {
>   jQuery('#table').change(function() {
> web2py_component("{{=URL('default', 'form.load')}}" + "/" +
>   jQuery(this).val(), target='form')
>   })})
> {{=SELECT('Select a table', *db.tables, _id='table')}}
>
>
> Controller 
>
> def form():
> if request.args(0) in db.tables:
> response.generic_patterns = ['load']
> return dict(form=SQLFORM(db[request.args(0)]).process())
> else:
> raise HTTP(404)
>
>
> every time it toll else part.
>
>
> can any one help me.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development



On Wednesday, June 26, 2013 3:19:23 PM UTC+2, Massimo Di Pierro wrote:
>
>  Moreover, what if an old app is installed after an upgrade? 
>
>  
it won't work, plain and simple.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] about routes.py

I have tried routes.py with the builtin server - works fine.
Afterward I went to another computer, which runs Apache.
I want

   - https://contr1.mydomain.com to route to
   https://myapp.mydomain.com/contr1
   - https://contr2.mydomain.com to route to
   https://myapp.mydomain.com/contr2
   - https://contr3.mydomain.com to route to
   https://myapp.mydomain.com/contr3


But it seems, that Apache wants three virtual servers (
https://contr1.mydomain.com and so on).
Is it possible to solve this problem with one virtual server and the
routes.py-file?

Regards, Martin

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Web2py via cgi on shared hosting

Hi there,

I'd like to get web2py running on a shared hosting environment. Referred to 
the official 
Docs,
 
I've created an folder "htdocs". In this the folder web2py contains the 
whole web2py framework (including my created application) and the 
file "web2py_modpython.py". 
My domain web2py.domain.de routes to the folder where .htaccess and the 
folder "htdocs" exists. Unfortunately this produces a 500 error.
Here is my folder structure:

.htaccess
htdocs
|web2py
 |_web2py_modpython.py
   web2py framework

Any suggestions?

Thanks
SK

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] E-commerce solution

Hi,

I found a project called eStore (https://code.google.com/p/web2py-estore/), 
but it seems that has not being updated for a while and there are some 
important features missing.

Dear all,

Is there any other web2py ecommerce project?

Learnt also that http://rockiger.com was developed with web2py. The site 
looks awesome. Does anybody know what app was used or if it was made from 
scratch?

Thanks in advance,

Paulo



Em quarta-feira, 26 de junho de 2013 04h42min17s UTC-3, encompass escreveu:
>
> I am thinking of building one as part of my business.  Just starting to 
> look if there are others in Web2py as that's what we use for business. :)
> BR,
> Jason
>
>
>
> On Wed, Jun 26, 2013 at 1:53 AM, >wrote:
>
>> Hello guys,
>>
>> I am new here.
>>
>> Is there a full e-commerce web2py app like Sachmo, LFS, Cartridge 
>> (Mezzanine) or oscarCommerce?
>>
>> Is there a blog app?
>>
>> I would be glad if you have live site examples.
>>
>> Thanks in advance,
>>
>>
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

That is dangerous. What if people rely on an older version of have edited 
it? I think it is part of the specs that web2py upgrades do not touch the 
apps. Moreover, what if an old app is installed after an upgrade? 

On Wednesday, 26 June 2013 07:10:16 UTC-5, Anthony wrote:
>
> More generally, we should probably make it more clear that web2py.js is 
> properly a part of the framework and must be upgraded whenever the 
> framework is upgraded (this could be mentioned 
> here, 
> and maybe a reminder message could be shown in admin when its upgrade 
> button is used).
>
> Anthony
>
> On Wednesday, June 26, 2013 7:36:07 AM UTC-4, viniciusban wrote:
>>
>> I think this is a note that must be highlighted before releasing as 
>> stable, right? 
>>
>> On Wed, Jun 26, 2013 at 7:14 AM, Massimo DiPierro 
>>  wrote: 
>> > There is a major change upcoming in web2py 2.6 (which can be tested in 
>> trunk). 
>> > 
>> > The change involves a better rewrite of web2py.js agreed upon the 
>> developers and implemented by Niphlod. 
>> > 
>> > Because of this change  applications which use components will break 
>> unless you upgrade the old web2py.js with the new one. 
>> > 
>> > Anyway, try the latest trunk, check it out, and send us comments. 
>> > 
>> > Massimo 
>> > 
>> > 
>> > -- 
>> > 
>> > --- 
>> > You received this message because you are subscribed to the Google 
>> Groups "web2py-users" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an email to web2py+un...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>> > 
>> > 
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Catch-all function in controller

You must use routes.py to redirect /app/controller/$anything to 
/app/controller/common/$anything

On Wednesday, 26 June 2013 06:30:46 UTC-5, Daniel Gonzalez wrote:
>
> Hi,
>
> I have an api.py controller which is the interface to my restful api. 
> Currently I have to do the following to extend my api:
>
> def common(obj):
> response.view = 'generic.json'
>
> response.headers['Content-Type'] = CONTENT_TYPE_JSON
> def GET(*args,**vars):
>
> return api_router(API_GET, obj, *args, **vars)
> def POST(*args,**vars):
> return api_router(API_POST, obj, *args, **vars)
> def PUT(*args,**vars):
> return api_router(API_PUT, obj, *args, **vars)
> def DELETE(*args, **vars):
> return api_router(API_DELETE, obj, *args, **vars)
> return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)
>
> @request.restful()
> def index():
> return common('root')
>
> @request.restful()
> def nodes():
> return common('nodes')
>
> @request.restful()
> def agents():
> return common('agents')
> ...
>
> For any new object that I want to offer via my api, I need to list it as 
> @request.restful funcion, and link to common (the common api 
> implementation). I would like to define this common function as the 
> "catch-all" restful function for my api. My api_router already knows which 
> objects are supported, and replies with 404 if a requested object is not 
> supported, so it makes no sense for me to be forced to do this again on the 
> controller.
>
> How can I define this "catch-all" function in my api controller?
>
> Thanks,
> Daniel
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

More generally, we should probably make it more clear that web2py.js is 
properly a part of the framework and must be upgraded whenever the 
framework is upgraded (this could be mentioned 
here, 
and maybe a reminder message could be shown in admin when its upgrade 
button is used).

Anthony

On Wednesday, June 26, 2013 7:36:07 AM UTC-4, viniciusban wrote:
>
> I think this is a note that must be highlighted before releasing as 
> stable, right? 
>
> On Wed, Jun 26, 2013 at 7:14 AM, Massimo DiPierro 
> > wrote: 
> > There is a major change upcoming in web2py 2.6 (which can be tested in 
> trunk). 
> > 
> > The change involves a better rewrite of web2py.js agreed upon the 
> developers and implemented by Niphlod. 
> > 
> > Because of this change  applications which use components will break 
> unless you upgrade the old web2py.js with the new one. 
> > 
> > Anyway, try the latest trunk, check it out, and send us comments. 
> > 
> > Massimo 
> > 
> > 
> > -- 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups "web2py-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

ETA is more or less 1 year on this :-P

However, yes, it will be promply highlighted (and maybe in the far distant 
future web2py.js will be overwritten automatically ).



On Wednesday, June 26, 2013 1:36:07 PM UTC+2, viniciusban wrote:
>
> I think this is a note that must be highlighted before releasing as 
> stable, right? 
>
> On Wed, Jun 26, 2013 at 7:14 AM, Massimo DiPierro 
> > wrote: 
> > There is a major change upcoming in web2py 2.6 (which can be tested in 
> trunk). 
> > 
> > The change involves a better rewrite of web2py.js agreed upon the 
> developers and implemented by Niphlod. 
> > 
> > Because of this change  applications which use components will break 
> unless you upgrade the old web2py.js with the new one. 
> > 
> > Anyway, try the latest trunk, check it out, and send us comments. 
> > 
> > Massimo 
> > 
> > 
> > -- 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups "web2py-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

I think this is a note that must be highlighted before releasing as
stable, right?

On Wed, Jun 26, 2013 at 7:14 AM, Massimo DiPierro
 wrote:
> There is a major change upcoming in web2py 2.6 (which can be tested in trunk).
>
> The change involves a better rewrite of web2py.js agreed upon the developers 
> and implemented by Niphlod.
>
> Because of this change  applications which use components will break unless 
> you upgrade the old web2py.js with the new one.
>
> Anyway, try the latest trunk, check it out, and send us comments.
>
> Massimo
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Catch-all function in controller

Hi,

I have an api.py module which is the interface to my restful api. Currently 
I have to do the following to extend my api:

def common(obj):
response.view = 'generic.json'

response.headers['Content-Type'] = CONTENT_TYPE_JSON
def GET(*args,**vars):

return api_router(API_GET, obj, *args, **vars)
def POST(*args,**vars):
return api_router(API_POST, obj, *args, **vars)
def PUT(*args,**vars):
return api_router(API_PUT, obj, *args, **vars)
def DELETE(*args, **vars):
return api_router(API_DELETE, obj, *args, **vars)
return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)


@request.restful()
def index():
return common('root')


@request.restful()
def nodes():
return common('nodes')


@request.restful()
def agents():
return common('agents')
...


For any new object that I want to offer via my api, I need to list it as 
@request.restful funcion, and link to common (the common api 
implementation). I would like to define this common function as the 
"catch-all" restful function for my api. My api_router already knows which 
objects are supported, and replies with 404 if a requested object is not 
supported, so it makes no sense for me to be forced to do this again on the 
controller.

How can I define this "catch-all" function in my api controller?

Thanks,
Daniel

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] web2py cgi shared hosting problem


Hi there!

I've some issues deploying web2py to a shared hosting environment. 
I created an application within the web2py environment. Referred to 
official 
Docs
 I 
put the whole web2py folder in a folder called "htdocs", edited the 
.htacces and created a file called "web2py_modpython.py".
My domain web2py.domain.de routes to /web2py. Within this I have my 
"htdocs" folder container the whole web2py framework including my created 
application.
Unfortunately I get a 500 error page.

Any suggestions?

Thanks in advance
SK

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Understanding Checkboxes widget

Fixed the typos and this is the part where I get stuck. It prompts me the 
data validation error "Value not in database". I see the values in the 
checkboxes.




db.define_table('finish',
>> Field('name'),
>> Field('abbr'))
>> db.finish.name.requires = IS_NOT_IN_DB(db,db.finish.name)
>> db.finish.abbr.requires = IS_NOT_IN_DB(db,db.finish.abbr)
>>
>>
>> db.define_table('product',
>> Field('series', 'reference series'),
>> Field('material', 'reference material'),
>> Field('finish', 'reference finish'),
>> Field('cut', 'reference cut'),
>> Field('name'))
>>
>>
>> db.define_table('productfinishes',
>> Field('product', 'reference product'),
>> Field('finish', 'reference 
>> finish',widget=SQLFORM.widgets.checkboxes.widget))
>> db.product_finishes.requires = IS_IN_DB(db,db.product.id,'%(name)s')
>> db.finish.requires = IS_IN_DB(db,db.finish.id,'%(name)s')
>>
>> Shouldnt this work??? it prompts me an error.
>>
>> Thanks
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Adding custom operators to DAL

Hi Massimo

I am not familiar with the method you suggested but when I tried it, I got 
the following error:

print db(Expression(db,"business_view.loc && 
ST_MakeEnvelope(42.179139323652443, 141.20906066894531, 42.307520083522473, 
143.34776306152344)")).select().as_list()
NameError: global name 'Expression' is not defined


In any case, in the non-working example that I tried, I was trying to use the 
bounding box operator in postgis, which is not currently available in the 
DAL... With the approach I suggested, I managed to get it to work without 
issues.



On Wednesday, 26 June 2013 15:09:25 UTC+8, Massimo Di Pierro wrote:
>
> Can you show an example of how you plan to use something like this. I 
> believe there is already a method 
>
> db(Expression(db," ... raw query ...")).select()
>
> perhaps I do not understand.
>
> On Tuesday, 25 June 2013 22:36:45 UTC-5, Calvin wrote:
>>
>> I think it would be nice to specify custom operators that can be used 
>> with the DAL as I believe this would allow for operators that are currently 
>> yet to be supported with a built-in DAL operator...
>>
>> From dal.py, I am thinking this should be relatively easy to implement, 
>> and code would be along the lines of:
>>
>> update to dal.py
>>
>> def raw_where(self, value, op):
>>   db = self.db
>>   return Query(db, op, self, value)
>>
>>
>> which enables the following in a project
>>
>> def OPERATOR(self, first, second):
>>   return '(%s && %s)' % (self.expand(first), self.expand(second)) //'this 
>> return expression should be customised...
>>
>>
>> rows = db(db.table.field.raw_where(parameter, OPERATOR)).select()
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Encrypting/decrypting db values

Yes, I inspected the data with psql - they're indeed encrypted. Again, 
thanks.

On Wednesday, June 26, 2013 12:35:54 PM UTC+2, Niphlod wrote:
>
> if you're inspecting your db with web2py then of course you have all in 
> clear that's the whole point of the filter_in and filter_out methods, 
> being "transparent".
>
> Try to inspect your database with an external tool instead.
>
> On Wednesday, June 26, 2013 12:19:24 PM UTC+2, lesssugar wrote:
>>
>> @Niphlod,
>>
>> Thanks very much for your solution. Implemented it, it works -- no errors 
>> when inserting/updating data.
>>
>> However, one thing I don't fully get: the data I store using the 
>> encryption are displayed as normal strings in the database. I'm not very 
>> familiar with encryption specifics but isn't it the point to keep the data 
>> in sort of a hard-to-crack code?
>>
>> I use a normal string as key.
>>
>> my test table:
>>
>> db.define_table('contact',
>> Field('user_id', db.auth_user, default=auth.user_id, readable=False, 
>> writable=False),
>> Field('email', label='Contact email'),
>> Field('phone', label='Contact phone')
>> )
>>
>> db.contact.email.requires = [IS_EMAIL(error_message="Wrong email 
>> address")]
>> db.contact.phone.requires= [IS_LENGTH(maxsize=30, error_message="Bit too 
>> long, right?")]
>> db.contact.email.filter_in = lambda value : w2p_encrypt(value)
>> db.contact.phone.filter_in = lambda value : w2p_encrypt(value)
>> db.contact.email.filter_out = lambda value : w2p_decrypt(value)
>> db.contact.phone.filter_out = lambda value : w2p_decrypt(value)
>>
>>
>>
>> On Tuesday, June 25, 2013 8:42:29 PM UTC+2, Niphlod wrote:
>>>
>>> sorry, cut&paste error.
>>>
>>>
>>>
>>> import gluon.contrib.aes as AES
>>> import threading 
>>> import os
>>> import base64
>>>
>>> def fast_urandom16(urandom=[], locker=threading.RLock()):
>>> """
>>> this is 4x faster than calling os.urandom(16) and prevents
>>> the "too many files open" issue with concurrent access to 
>>> os.urandom()
>>> """
>>> try:
>>> return urandom.pop()
>>> except IndexError:
>>> try:
>>> locker.acquire()
>>> ur = os.urandom(16 * 1024)
>>> urandom += [ur[i:i + 16] for i in xrange(16, 1024 * 16, 16)]
>>> return ur[0:16]
>>> finally:
>>> locker.release()
>>> 
>>> def pad(s, n=32, padchar=' '):
>>> return s + (32 - len(s) % 32) * padchar
>>>
>>> def AES_new(key, IV=None):
>>> """ Returns an AES cipher object and random IV if None specified """
>>> if IV is None:
>>> IV = fast_urandom16()
>>>
>>> return AES.new(key, AES.MODE_CBC, IV), IV
>>>
>>> def w2p_encrypt(data):
>>> key = 'asdsaddasdasdas'
>>> key = pad(key[:32])
>>> cipher, IV = AES_new(key)
>>> encrypted_data = IV + cipher.encrypt(pad(data))
>>> return base64.urlsafe_b64encode(encrypted_data)
>>>
>>> def w2p_decrypt(data):
>>> key = 'asdsaddasdasdas'
>>> key = pad(key[:32])
>>> data = base64.urlsafe_b64decode(data)
>>> IV, data = data[:16], data[16:]
>>> cipher, _ = AES_new(key, IV=IV)
>>> data = cipher.decrypt(data)
>>> data = data.rstrip(' ')
>>> return data
>>>
>>> db.define_table('t_test',
>>> Field('f_field')
>>> )
>>>
>>> db.t_test.f_field.filter_in = lambda value : w2p_encrypt(value)
>>> db.t_test.f_field.filter_out = lambda value : w2p_decrypt(value)
>>>
>>>
>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Multiple files upload

I have one more question, is it possible to disable this uploading feature? 
I thought i can add attachment field manually in my form, not 
trought SQLFORM.factory, but if i add this field manually, i still get an 
error. This basically means that if i want to have multiple uploads the way 
i imagined i can't use SQLFORM.factory at all and need to make everything 
custom (validators, etc..) 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Multiple files upload

Ok, thanks. I would be great if upload would be mapped to list.


On Wednesday, June 26, 2013 12:34:38 PM UTC+2, Niphlod wrote:
>
> just handle it outside web2py. Building a form with SQLFORM changing the 
> widget at your will is not going to work.
> it's like you asking for a checkbox field but using a textarea to do 
> it.it doesn't make any sense...
>
> Maybe we'll have in the future an upload mapped to a list:string (sounds 
> about right) and something that processes that accordingly, but out of the 
> box right now you just can't use SQLFORM facilities for this expecting it 
> to work. 
>
> AFAIK cgi.FieldStorage can't process out of the box HTML5's multiple input 
> files.
>
> On Wednesday, June 26, 2013 12:24:17 PM UTC+2, Domagoj Kovač wrote:
>>
>> Hi Niphlod, 
>>
>> I reviewed your code, in your test method you have: 
>> form = SQLFORM.factory(
>> Field('an_integer', 'integer'),
>> Field('upload_1', 'upload', uploadfolder=upf),
>> Field('upload_2', 'upload', uploadfolder=upf),
>> table_name='an_entry'
>> )
>> i don't want two field, i only want one field.
>> form = SQLFORM.factory(
>> Field('an_integer', 'integer'),
>> Field('attachment', 'upload', uploadfolder=upf),
>> table_name='an_entry'
>> )
>> and in my view
>> {{form.custom.widget["attachment"]['_multiple'] = "multiple"}}
>>
>> Now this attachment has multiple attribute, multiple is HTML 5 attribute 
>> and it enables me to select more than one file.
>>
>> When i add multiple attribute and select more than one file, web2py gives 
>> me an error:
>>  local variable 'source_file' 
>> referenced before assignment
>>
>> This is the code listing with the problem:
>>
>>  (source_file, original_filename) = (f.file, f.filename)
>>  elif isinstance(f, (str, unicode)):
>>  ### do not know why this happens, it should not
>>  (source_file, original_filename) = \
>>  (cStringIO.StringIO(f), 'file.txt')
>>
>>  newfilename = field.store(source_file, original_filename,
>>  field.uploadfolder)
>>  # this line was for backward compatibility but problematic
>>  # self.vars['%s_newfilename' % fieldname] = newfilename
>>  fields[fieldname] = newfilename
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] IMPORTANT: web2py 2.6.0-development

I'm testing





 Ovidio Marinho Falcao Neto
  ITJP.NET.BR
 ovidio...@gmail.com
   83   8826 9088 - Oi
   83   9336 3782 - Claro
Brasil



2013/6/26 Massimo DiPierro 

> There is a major change upcoming in web2py 2.6 (which can be tested in
> trunk).
>
> The change involves a better rewrite of web2py.js agreed upon the
> developers and implemented by Niphlod.
>
> Because of this change  applications which use components will break
> unless you upgrade the old web2py.js with the new one.
>
> Anyway, try the latest trunk, check it out, and send us comments.
>
> Massimo
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Encrypting/decrypting db values

if you're inspecting your db with web2py then of course you have all in 
clear that's the whole point of the filter_in and filter_out methods, 
being "transparent".

Try to inspect your database with an external tool instead.

On Wednesday, June 26, 2013 12:19:24 PM UTC+2, lesssugar wrote:
>
> @Niphlod,
>
> Thanks very much for your solution. Implemented it, it works -- no errors 
> when inserting/updating data.
>
> However, one thing I don't fully get: the data I store using the 
> encryption are displayed as normal strings in the database. I'm not very 
> familiar with encryption specifics but isn't it the point to keep the data 
> in sort of a hard-to-crack code?
>
> I use a normal string as key.
>
> my test table:
>
> db.define_table('contact',
> Field('user_id', db.auth_user, default=auth.user_id, readable=False, 
> writable=False),
> Field('email', label='Contact email'),
> Field('phone', label='Contact phone')
> )
>
> db.contact.email.requires = [IS_EMAIL(error_message="Wrong email address")]
> db.contact.phone.requires= [IS_LENGTH(maxsize=30, error_message="Bit too 
> long, right?")]
> db.contact.email.filter_in = lambda value : w2p_encrypt(value)
> db.contact.phone.filter_in = lambda value : w2p_encrypt(value)
> db.contact.email.filter_out = lambda value : w2p_decrypt(value)
> db.contact.phone.filter_out = lambda value : w2p_decrypt(value)
>
>
>
> On Tuesday, June 25, 2013 8:42:29 PM UTC+2, Niphlod wrote:
>>
>> sorry, cut&paste error.
>>
>>
>>
>> import gluon.contrib.aes as AES
>> import threading 
>> import os
>> import base64
>>
>> def fast_urandom16(urandom=[], locker=threading.RLock()):
>> """
>> this is 4x faster than calling os.urandom(16) and prevents
>> the "too many files open" issue with concurrent access to 
>> os.urandom()
>> """
>> try:
>> return urandom.pop()
>> except IndexError:
>> try:
>> locker.acquire()
>> ur = os.urandom(16 * 1024)
>> urandom += [ur[i:i + 16] for i in xrange(16, 1024 * 16, 16)]
>> return ur[0:16]
>> finally:
>> locker.release()
>> 
>> def pad(s, n=32, padchar=' '):
>> return s + (32 - len(s) % 32) * padchar
>>
>> def AES_new(key, IV=None):
>> """ Returns an AES cipher object and random IV if None specified """
>> if IV is None:
>> IV = fast_urandom16()
>>
>> return AES.new(key, AES.MODE_CBC, IV), IV
>>
>> def w2p_encrypt(data):
>> key = 'asdsaddasdasdas'
>> key = pad(key[:32])
>> cipher, IV = AES_new(key)
>> encrypted_data = IV + cipher.encrypt(pad(data))
>> return base64.urlsafe_b64encode(encrypted_data)
>>
>> def w2p_decrypt(data):
>> key = 'asdsaddasdasdas'
>> key = pad(key[:32])
>> data = base64.urlsafe_b64decode(data)
>> IV, data = data[:16], data[16:]
>> cipher, _ = AES_new(key, IV=IV)
>> data = cipher.decrypt(data)
>> data = data.rstrip(' ')
>> return data
>>
>> db.define_table('t_test',
>> Field('f_field')
>> )
>>
>> db.t_test.f_field.filter_in = lambda value : w2p_encrypt(value)
>> db.t_test.f_field.filter_out = lambda value : w2p_decrypt(value)
>>
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Multiple files upload

just handle it outside web2py. Building a form with SQLFORM changing the 
widget at your will is not going to work.
it's like you asking for a checkbox field but using a textarea to do 
it.it doesn't make any sense...

Maybe we'll have in the future an upload mapped to a list:string (sounds 
about right) and something that processes that accordingly, but out of the 
box right now you just can't use SQLFORM facilities for this expecting it 
to work. 

AFAIK cgi.FieldStorage can't process out of the box HTML5's multiple input 
files.

On Wednesday, June 26, 2013 12:24:17 PM UTC+2, Domagoj Kovač wrote:
>
> Hi Niphlod, 
>
> I reviewed your code, in your test method you have: 
> form = SQLFORM.factory(
> Field('an_integer', 'integer'),
> Field('upload_1', 'upload', uploadfolder=upf),
> Field('upload_2', 'upload', uploadfolder=upf),
> table_name='an_entry'
> )
> i don't want two field, i only want one field.
> form = SQLFORM.factory(
> Field('an_integer', 'integer'),
> Field('attachment', 'upload', uploadfolder=upf),
> table_name='an_entry'
> )
> and in my view
> {{form.custom.widget["attachment"]['_multiple'] = "multiple"}}
>
> Now this attachment has multiple attribute, multiple is HTML 5 attribute 
> and it enables me to select more than one file.
>
> When i add multiple attribute and select more than one file, web2py gives 
> me an error:
>  local variable 'source_file' 
> referenced before assignment
>
> This is the code listing with the problem:
>
>  (source_file, original_filename) = (f.file, f.filename)
>  elif isinstance(f, (str, unicode)):
>  ### do not know why this happens, it should not
>  (source_file, original_filename) = \
>  (cStringIO.StringIO(f), 'file.txt')
>
>  newfilename = field.store(source_file, original_filename,
>  field.uploadfolder)
>  # this line was for backward compatibility but problematic
>  # self.vars['%s_newfilename' % fieldname] = newfilename
>  fields[fieldname] = newfilename
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Multiple files upload

Hi Niphlod, 

I reviewed your code, in your test method you have: 
form = SQLFORM.factory(
Field('an_integer', 'integer'),
Field('upload_1', 'upload', uploadfolder=upf),
Field('upload_2', 'upload', uploadfolder=upf),
table_name='an_entry'
)
i don't want two field, i only want one field.
form = SQLFORM.factory(
Field('an_integer', 'integer'),
Field('attachment', 'upload', uploadfolder=upf),
table_name='an_entry'
)
and in my view
{{form.custom.widget["attachment"]['_multiple'] = "multiple"}}

Not this attachment has multiple attribute, multiple is HTML 5 attribute 
and it enables me to select more than one file.

When i add multiple attribute and select more than one files, web2py gives 
me an error:
 local variable 'source_file' 
referenced before assignment

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Encrypting/decrypting db values

@Niphlod,

Thanks very much for your solution. Implemented it, it works -- no errors 
when inserting/updating data.

However, one thing I don't fully get: the data I store using the encryption 
are displayed as normal strings in the database. I'm not very familiar with 
encryption specifics but isn't it the point to keep the data in sort of a 
hard-to-crack code?

I use a normal string as key.

my test table:

db.define_table('contact',
Field('user_id', db.auth_user, default=auth.user_id, readable=False, 
writable=False),
Field('email', label='Contact email'),
Field('phone', label='Contact phone')
)

db.contact.email.requires = [IS_EMAIL(error_message="Wrong email address")]
db.contact.phone.requires= [IS_LENGTH(maxsize=30, error_message="Bit too 
long, right?")]
db.contact.email.filter_in = lambda value : w2p_encrypt(value)
db.contact.phone.filter_in = lambda value : w2p_encrypt(value)
db.contact.email.filter_out = lambda value : w2p_decrypt(value)
db.contact.phone.filter_out = lambda value : w2p_decrypt(value)



On Tuesday, June 25, 2013 8:42:29 PM UTC+2, Niphlod wrote:
>
> sorry, cut&paste error.
>
>
>
> import gluon.contrib.aes as AES
> import threading 
> import os
> import base64
>
> def fast_urandom16(urandom=[], locker=threading.RLock()):
> """
> this is 4x faster than calling os.urandom(16) and prevents
> the "too many files open" issue with concurrent access to os.urandom()
> """
> try:
> return urandom.pop()
> except IndexError:
> try:
> locker.acquire()
> ur = os.urandom(16 * 1024)
> urandom += [ur[i:i + 16] for i in xrange(16, 1024 * 16, 16)]
> return ur[0:16]
> finally:
> locker.release()
> 
> def pad(s, n=32, padchar=' '):
> return s + (32 - len(s) % 32) * padchar
>
> def AES_new(key, IV=None):
> """ Returns an AES cipher object and random IV if None specified """
> if IV is None:
> IV = fast_urandom16()
>
> return AES.new(key, AES.MODE_CBC, IV), IV
>
> def w2p_encrypt(data):
> key = 'asdsaddasdasdas'
> key = pad(key[:32])
> cipher, IV = AES_new(key)
> encrypted_data = IV + cipher.encrypt(pad(data))
> return base64.urlsafe_b64encode(encrypted_data)
>
> def w2p_decrypt(data):
> key = 'asdsaddasdasdas'
> key = pad(key[:32])
> data = base64.urlsafe_b64decode(data)
> IV, data = data[:16], data[16:]
> cipher, _ = AES_new(key, IV=IV)
> data = cipher.decrypt(data)
> data = data.rstrip(' ')
> return data
>
> db.define_table('t_test',
> Field('f_field')
> )
>
> db.t_test.f_field.filter_in = lambda value : w2p_encrypt(value)
> db.t_test.f_field.filter_out = lambda value : w2p_decrypt(value)
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] IMPORTANT: web2py 2.6.0-development

There is a major change upcoming in web2py 2.6 (which can be tested in trunk).

The change involves a better rewrite of web2py.js agreed upon the developers 
and implemented by Niphlod.

Because of this change  applications which use components will break unless you 
upgrade the old web2py.js with the new one.

Anyway, try the latest trunk, check it out, and send us comments.

Massimo 
  

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] E-commerce solution

I am thinking of building one as part of my business.  Just starting to
look if there are others in Web2py as that's what we use for business. :)
BR,
Jason



On Wed, Jun 26, 2013 at 1:53 AM,  wrote:

> Hello guys,
>
> I am new here.
>
> Is there a full e-commerce web2py app like Sachmo, LFS, Cartridge
> (Mezzanine) or oscarCommerce?
>
> Is there a blog app?
>
> I would be glad if you have live site examples.
>
> Thanks in advance,
>
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Article: How fast can we make interpreted Python?

http://www.phi-node.com/2013/06/how-fast-can-we-make-interpreted-python.html
https://github.com/rjpower/falcon


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Adding custom operators to DAL

Can you show an example of how you plan to use something like this. I 
believe there is already a method 

db(Expression(db," ... raw query ...")).select()

perhaps I do not understand.

On Tuesday, 25 June 2013 22:36:45 UTC-5, Calvin wrote:
>
> I think it would be nice to specify custom operators that can be used with 
> the DAL as I believe this would allow for operators that are currently yet 
> to be supported with a built-in DAL operator...
>
> From dal.py, I am thinking this should be relatively easy to implement, 
> and code would be along the lines of:
>
> update to dal.py
>
> def raw_where(self, value, op):
>   db = self.db
>   return Query(db, op, self, value)
>
>
> which enables the following in a project
>
> def OPERATOR(self, first, second):
>   return '(%s && %s)' % (self.expand(first), self.expand(second)) //'this 
> return expression should be customised...
>
>
> rows = db(db.table.field.raw_where(parameter, OPERATOR)).select()
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Encrypting/decrypting db values

You have a choice already. You can import any library you like and use that 
for encryption. The issue is making the default choice more easily 
available. A built-in web2py faction cannot have a parameter to choose the 
encryption algorithm because web2py only comes with AES.

On Tuesday, 25 June 2013 17:26:35 UTC-5, Derek wrote:
>
> Something other than AES, yes. Perhaps ECE (elliptic curve encryption) or 
> something other than AES. Shouldn't I have a choice?
>
> On Tuesday, June 25, 2013 1:36:56 PM UTC-7, Niphlod wrote:
>>
>> because you want something else from AES ?
>>
>> On Tuesday, June 25, 2013 10:31:47 PM UTC+2, Derek wrote:
>>>
>>> Only if there is an optional algorithm argument.
>>>
>>> On Tuesday, June 25, 2013 1:23:32 PM UTC-7, Massimo Di Pierro wrote:

 Should we include decrypt(key,data) and encrypt(key,data) in 
 gluon.utils?

 On Tuesday, 25 June 2013 13:42:29 UTC-5, Niphlod wrote:
>
> sorry, cut&paste error.
>
>
>
> import gluon.contrib.aes as AES
> import threading 
> import os
> import base64
>
> def fast_urandom16(urandom=[], locker=threading.RLock()):
> """
> this is 4x faster than calling os.urandom(16) and prevents
> the "too many files open" issue with concurrent access to 
> os.urandom()
> """
> try:
> return urandom.pop()
> except IndexError:
> try:
> locker.acquire()
> ur = os.urandom(16 * 1024)
> urandom += [ur[i:i + 16] for i in xrange(16, 1024 * 16, 16
> )]
> return ur[0:16]
> finally:
> locker.release()
> 
> def pad(s, n=32, padchar=' '):
> return s + (32 - len(s) % 32) * padchar
>
> def AES_new(key, IV=None):
> """ Returns an AES cipher object and random IV if None specified 
> """
> if IV is None:
> IV = fast_urandom16()
>
> return AES.new(key, AES.MODE_CBC, IV), IV
>
> def w2p_encrypt(data):
> key = 'asdsaddasdasdas'
> key = pad(key[:32])
> cipher, IV = AES_new(key)
> encrypted_data = IV + cipher.encrypt(pad(data))
> return base64.urlsafe_b64encode(encrypted_data)
>
> def w2p_decrypt(data):
> key = 'asdsaddasdasdas'
> key = pad(key[:32])
> data = base64.urlsafe_b64decode(data)
> IV, data = data[:16], data[16:]
> cipher, _ = AES_new(key, IV=IV)
> data = cipher.decrypt(data)
> data = data.rstrip(' ')
> return data
>
> db.define_table('t_test',
> Field('f_field')
> )
>
> db.t_test.f_field.filter_in = lambda value : w2p_encrypt(value)
> db.t_test.f_field.filter_out = lambda value : w2p_decrypt(value)
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




  1   2   >