[web2py] Re: Jeditable and SQLTables

2012-07-12 Thread Simon Ashley
Have a rephrased/ simplified controller, and while almost got it working, 
running out of ideas/ talent. 
The problem is in posting parameters to the controller and passing a value 
back to the edited field (its just not seeing them). 

Any ideas would be welcome, but failing that, would anyone be interested in 
taking it on as a paid job to get it working?

Controller
def style(v,s1):
if v==0: s1="background-color:#CFECEC"  
elif v==2: s1="background-color:#EA"
else: s1="background-color:#00"
s1=s1+"; text-align:center"
return s1
 
def update():
if request.args:
  loc = request.args[0].split['.']
  id = loc[0]
  column = loc[1]
  value = request.args[1]
  db(db.Stats.id==id).update(column=value)
  return value

def measure(): 
s1 = []
db.Measure.FP.represent = lambda value, row: DIV(value,  _class="EDit", 
_style=style(value,s1), _id=str(row.id)+'.FP') 
table = SQLFORM.grid(db.Measure)
return dict(form=table, paginate=3)

View
{{response.files.append(URL('static','js/jquery.jeditable.js'))}}
{{extend 'layout.html'}}
 
jQuery(document).ready(function(){
 jQuery('.EDit').editable("{{=URL('update')}}",{
id: 'elementid',
name: 'value',   
tooltip: "Click to edit...",
submit: 'OK',
indicator : 'static\images\indicator.gif', 
 });})  


{{=form}}

TIA,


[web2py] Re: Jeditable and SQLTables

2012-07-16 Thread Simon Ashley
Thanks Brent,

Sorry for the delay - first chance to delve into this again. Still no 
luck. Have tried various combinations but unable to get jeditable fire in 
this setup. 
Do you have a quick example that works (just a cut and paste one would do)?

TIA.

-- 





[web2py] Re: Jeditable and SQLTables

2012-07-17 Thread Simon Ashley
Thanks Brent,

Appreciate that, but the main issue is that the controller does not called 
from jQuery. i.e. from this line

jQuery('.EDit').editable("{{=URL('update')}}",{ 

There no post vars.
(have also used a brute force updates to confirm that it doesn't fire)

If we can only find out why.
(thinking is a fundamental concept that I'm missing)

Will give that another go today, but would be grateful for any hints.





On Wednesday, 18 July 2012 02:25:43 UTC+10, Brent Zeiben wrote:
>
>
> Going back to your first example code you gave above,
>
> Javascript in the view nothing really changed I just don't have the 
> indicator gif
> 
>   jQuery(document).ready(function(){
>
>jQuery('.EDit').editable("{{=URL('update')}}",{
>   style: 'display:inline',
>   indicator: "Saving...",
>   tooltip : "Click to edit...",
>   style : "inherit"
>   });
>   });
>   
>  
>
>
> the update() function in the controller:
>
> def update():
>   if request.post_vars:
>   idloc = request.post_vars.id
>   id,column = idloc.split('.')
>   value = request.post_vars.value
>   db(db.WSProb.id == id).update(**{column:value})
>   return value
>
>
> It seems jeditable submits its values through request.post_vars instead of 
> using request.args 
> I also modified the update clause so it would work with passing a column 
> name in as text.
> I am using the source 1.7.1 version of jeditable from the 
> site<http://www.appelsiini.net/projects/jeditable>. 
>  
>
> With minimal testing this seemed to allow you to update the numbers and 
> display the updated value.
>
> HTH,
> Brent
>
> On Monday, 16 July 2012 20:11:39 UTC-6, Simon Ashley wrote:
>>
>> Thanks Brent,
>>
>> Sorry for the delay - first chance to delve into this again. Still no 
>> luck. Have tried various combinations but unable to get jeditable fire in 
>> this setup. 
>> Do you have a quick example that works (just a cut and paste one would 
>> do)?
>>
>> TIA.
>>
>>

-- 





[web2py] Re: Jeditable and SQLTables

2012-07-18 Thread Simon Ashley
Thanks Brent,

Eventually got it with your help and advice.
The controller was failing silently (revealed with Firefox and Firebug).
Once that was fixed, plugged the rest in and worked perfectly.

(kicking myself that it was so close, but you stuff really helped.
I owe you one)

Cheers,

On Wednesday, 18 July 2012 09:55:36 UTC+10, Brent Zeiben wrote:
>
> Sorry Simon missed that the call wasn't working.
>
> Not sure what it could be. (Assuming jquery.js is loaded before the plugin 
> and you want the update function in app/default/update called)
>
> Attached is the test application I used, that is mainly your code above. 
>  Just install it from web2py admin. On the home page of the app there is a 
> link to the probs test page, just under the "Hello World" message.
>
> On the test page you should be able to modify the values in the Fp column. 
>
>
> Give this a-go and see if the calls to the update() are working for you. 
>
> I'm using 1.99.7 stable of web2py.
>
> Regards,
> Brent
>
> On Tuesday, 17 July 2012 16:14:40 UTC-6, Simon Ashley wrote:
>>
>> Thanks Brent,
>>
>> Appreciate that, but the main issue is that the controller does not 
>> called from jQuery. i.e.S from this line
>>
>> jQuery('.EDit').editable("{{=URL('update')}}",{ 
>>
>> There no post vars.
>> (have also used a brute force updates to confirm that it doesn't fire)
>>
>> If we can only find out why.
>> (thinking is a fundamental concept that I'm missing)
>>
>> Will give that another go today, but would be grateful for any hints.
>>
>>
>>
>>
>>
>> On Wednesday, 18 July 2012 02:25:43 UTC+10, Brent Zeiben wrote:
>>>
>>>
>>> Going back to your first example code you gave above,
>>>
>>> Javascript in the view nothing really changed I just don't have the 
>>> indicator gif
>>> 
>>>   jQuery(document).ready(function(){
>>>
>>>jQuery('.EDit').editable("{{=URL('update')}}",{
>>>   style: 'display:inline',
>>>   indicator: "Saving...",
>>>   tooltip : "Click to edit...",
>>>   style : "inherit"
>>>   });
>>>   });
>>>   
>>>  
>>>
>>>
>>> the update() function in the controller:
>>>
>>> def update():
>>>   if request.post_vars:
>>>   idloc = request.post_vars.id
>>>   id,column = idloc.split('.')
>>>   value = request.post_vars.value
>>>   db(db.WSProb.id == id).update(**{column:value})
>>>   return value
>>>
>>>
>>> It seems jeditable submits its values through request.post_vars instead 
>>> of using request.args 
>>> I also modified the update clause so it would work with passing a column 
>>> name in as text.
>>> I am using the source 1.7.1 version of jeditable from the 
>>> site<http://www.appelsiini.net/projects/jeditable>. 
>>>  
>>>
>>> With minimal testing this seemed to allow you to update the numbers and 
>>> display the updated value.
>>>
>>> HTH,
>>> Brent
>>>
>>> On Monday, 16 July 2012 20:11:39 UTC-6, Simon Ashley wrote:
>>>>
>>>> Thanks Brent,
>>>>
>>>> Sorry for the delay - first chance to delve into this again. Still no 
>>>> luck. Have tried various combinations but unable to get jeditable fire in 
>>>> this setup. 
>>>> Do you have a quick example that works (just a cut and paste one would 
>>>> do)?
>>>>
>>>> TIA.
>>>>
>>>>

-- 





Re: [web2py] displacement of password button [web2py twitter bootstrap]

2012-07-25 Thread Simon Ashley
Negative on that. 
Still have an issue from the most currently nightly build. 
Has anyone tracked down precisely what's causing it?

TIA,

-- 





Re: [web2py] displacement of password button [web2py twitter bootstrap]

2012-07-25 Thread Simon Ashley
Was using the 21/07 truck version. 
Downloaded a fresh version this morning to re check and cache cleared. 
Displays differently in different browsers. 

(

   - Chrome: issue as mentioned, 
   - Firefox: displayed correctly, 
   - IE9: No welcome message, 
   - Safari: No welcome message
   
)

Client machine is Win7 64bit. 
Default browser is Chrome:

*Chrome:*

<https://lh5.googleusercontent.com/-OIouIEV6CVo/UBCGJZEz8_I/ACA/QicbdXqfIZw/s1600/Chrome.png>

*Firefox:*

<https://lh5.googleusercontent.com/-KyUkUs3Kf1c/UBCGX6Uh6JI/ACI/f6z2AXj06H0/s1600/Firefox.png>

*IE9:*

<https://lh5.googleusercontent.com/-GfdRe8ZHip4/UBCGmgXissI/ACQ/-0ZQLIvjTOY/s1600/IE9.png>

*Safari:*

<https://lh6.googleusercontent.com/-aZd0XS3hBDY/UBCGw1TmfcI/ACY/POBWwYQOBow/s1600/safari.png>

On Wednesday, 25 July 2012 23:22:31 UTC+10, dundee wrote:
>
> To me it seems like it was the placement of the welcome message that 
> caused the problem. In the latest build the welcome message is now in the 
> same line as the other auth links.
>
> Are you sure you are using the most current build? If you were using a 
> previous build you should probably clear your browsing data and refresh.
>
> Not sure why you are still having the problem. Is it in both browsers or 
> just google chrome?
>
>
>
>
> On Wed, Jul 25, 2012 at 5:57 AM, Simon Ashley wrote:
>
>> Negative on that. 
>> Still have an issue from the most currently nightly build. 
>> Has anyone tracked down precisely what's causing it?
>>
>> TIA,
>>
>>  -- 
>>  
>>  
>>  
>>
>
>
>  

-- 





Re: [web2py] displacement of password button [web2py twitter bootstrap]

2012-07-25 Thread Simon Ashley
ps: just noticed that the password buttons are different in the last 2 
browsers ...

On Thursday, 26 July 2012 09:57:49 UTC+10, Simon Ashley wrote:
>
> Was using the 21/07 truck version. 
> Downloaded a fresh version this morning to re check and cache cleared. 
> Displays differently in different browsers. 
>
> (
>
>- Chrome: issue as mentioned, 
>- Firefox: displayed correctly, 
>- IE9: No welcome message, 
>- Safari: No welcome message
>
> )
>
> Client machine is Win7 64bit. 
> Default browser is Chrome:
>
> *Chrome:*
>
>
> <https://lh5.googleusercontent.com/-OIouIEV6CVo/UBCGJZEz8_I/ACA/QicbdXqfIZw/s1600/Chrome.png>
>
> *Firefox:*
>
>
> <https://lh5.googleusercontent.com/-KyUkUs3Kf1c/UBCGX6Uh6JI/ACI/f6z2AXj06H0/s1600/Firefox.png>
>
> *IE9:*
>
>
> <https://lh5.googleusercontent.com/-GfdRe8ZHip4/UBCGmgXissI/ACQ/-0ZQLIvjTOY/s1600/IE9.png>
>
> *Safari:*
>
>
> <https://lh6.googleusercontent.com/-aZd0XS3hBDY/UBCGw1TmfcI/ACY/POBWwYQOBow/s1600/safari.png>
>
> On Wednesday, 25 July 2012 23:22:31 UTC+10, dundee wrote:
>>
>> To me it seems like it was the placement of the welcome message that 
>> caused the problem. In the latest build the welcome message is now in the 
>> same line as the other auth links.
>>
>> Are you sure you are using the most current build? If you were using a 
>> previous build you should probably clear your browsing data and refresh.
>>
>> Not sure why you are still having the problem. Is it in both browsers or 
>> just google chrome?
>>
>>
>>
>>
>> On Wed, Jul 25, 2012 at 5:57 AM, Simon Ashley wrote:
>>
>>> Negative on that. 
>>> Still have an issue from the most currently nightly build. 
>>> Has anyone tracked down precisely what's causing it?
>>>
>>> TIA,
>>>
>>>  -- 
>>>  
>>>  
>>>  
>>>
>>
>>
>>  

-- 





[web2py] Re: Accessing db['auth_user'] raises exception

2012-08-22 Thread Simon Ashley
Getting the following error on the latest nightly build. (have just 
downloaded again to make sure). Is this related? 

TRACEBACK

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Traceback (most recent call last):
  File "c:\web2py4\gluon\restricted.py", line 205, in restricted
exec ccode in environment
  File "c:/web2py4/applications/crm05/controllers/lookup.py" 
, line 
68, in 
  File "c:\web2py4\gluon\globals.py", line 182, in 
self._caller = lambda f: f()
  File "c:/web2py4/applications/crm05/controllers/lookup.py" 
, line 4, 
in Jockey
grid=SQLFORM.grid(query, paginate=10 )
  File "c:\web2py4\gluon\sqlhtml.py", line 1633, in grid
(not auth.user and \
NameError: global name 'auth' is not defined




-- 





[web2py] Re: Accessing db['auth_user'] raises exception

2012-08-22 Thread Simon Ashley
It helps, but it seems like a change in trunk causes the error. 
Have rolled back to an earlier version 7/21 version

On Wednesday, 22 August 2012 22:07:43 UTC+10, villas wrote:
>
> With regards the grid,  this parameter may help:  
> user_signature=False
>
>
> On Wednesday, August 22, 2012 8:00:25 AM UTC+1, Simon Ashley wrote:
>>
>> Getting the following error on the latest nightly build. (have just 
>> downloaded again to make sure). Is this related? 
>>
>> TRACEBACK
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>>
>> Traceback (most recent call last):
>>   File "c:\web2py4\gluon\restricted.py", line 205, in restricted
>> exec ccode in environment
>>   File "c:/web2py4/applications/crm05/controllers/lookup.py" 
>> <http://127.0.0.1:8000/admin/default/edit/crm05/controllers/lookup.py>, line 
>> 68, in 
>>   File "c:\web2py4\gluon\globals.py", line 182, in 
>> self._caller = lambda f: f()
>>   File "c:/web2py4/applications/crm05/controllers/lookup.py" 
>> <http://127.0.0.1:8000/admin/default/edit/crm05/controllers/lookup.py>, line 
>> 4, in Jockey
>> grid=SQLFORM.grid(query, paginate=10 )
>>   File "c:\web2py4\gluon\sqlhtml.py", line 1633, in grid
>> (not auth.user and \
>> NameError: global name 'auth' is not defined
>>
>>
>>
>>
>>

-- 





[web2py] Re: Accessing db['auth_user'] raises exception

2012-08-22 Thread Simon Ashley
Noted and confirmed. 
Must be a different issue. 
Will investigate further and raise on a new thread. 

The current situation is that the application/ grid works fine on a trunk 
from 2012-07-21 but not on anything from the last few days.


On Thursday, 23 August 2012 10:30:20 UTC+10, Massimo Di Pierro wrote:
>
> works with current trunk:
>
> $ python web2py.py -S welcome -M -N
> >>> db['auth_user']
> 
>
>
> On Wednesday, 22 August 2012 19:07:13 UTC-5, Simon Ashley wrote:
>>
>> It helps, but it seems like a change in trunk causes the error. 
>> Have rolled back to an earlier version 7/21 version
>>
>> On Wednesday, 22 August 2012 22:07:43 UTC+10, villas wrote:
>>>
>>> With regards the grid,  this parameter may help:  
>>> user_signature=False
>>>
>>>
>>> On Wednesday, August 22, 2012 8:00:25 AM UTC+1, Simon Ashley wrote:
>>>>
>>>> Getting the following error on the latest nightly build. (have just 
>>>> downloaded again to make sure). Is this related? 
>>>>
>>>> TRACEBACK
>>>>
>>>> 1.
>>>> 2.
>>>> 3.
>>>> 4.
>>>> 5.
>>>> 6.
>>>> 7.
>>>> 8.
>>>> 9.
>>>> 10.
>>>> 11.
>>>> 12.
>>>>
>>>> Traceback (most recent call last):
>>>>   File "c:\web2py4\gluon\restricted.py", line 205, in restricted
>>>> exec ccode in environment
>>>>   File "c:/web2py4/applications/crm05/controllers/lookup.py" 
>>>> <http://127.0.0.1:8000/admin/default/edit/crm05/controllers/lookup.py>, 
>>>> line 68, in 
>>>>   File "c:\web2py4\gluon\globals.py", line 182, in 
>>>> self._caller = lambda f: f()
>>>>   File "c:/web2py4/applications/crm05/controllers/lookup.py" 
>>>> <http://127.0.0.1:8000/admin/default/edit/crm05/controllers/lookup.py>, 
>>>> line 4, in Jockey
>>>> grid=SQLFORM.grid(query, paginate=10 )
>>>>   File "c:\web2py4\gluon\sqlhtml.py", line 1633, in grid
>>>> (not auth.user and \
>>>> NameError: global name 'auth' is not defined
>>>>
>>>>
>>>>
>>>>
>>>>

-- 





[web2py] Grid, NameError: name 'auth' is not defined

2012-08-23 Thread Simon Ashley
Having issues with SQLFORM.grid with the latest trunk (2012-08-22 23:37:57) 
 throwing "NameError: name 'auth' is not defined" errors.
To reproduce the error, downloaded a fresh build and unzipped to a fresh 
folder.
In the examples application, created a new controller, with the following 
code extracted from the book:

@auth.requires_login()
def manage_users():
  grid = SQLFORM.grid(db.auth_user)
  return locals()

When run, it throws the following:


127.0.0.1.2012-08-23.19-21-36.0ffdb33a-7e1a-4ea8-adc0-aff4c95eab52
 name 'auth' is not definedVERSIONweb2py™(2, 
0, 0, datetime.datetime(2012, 8, 22, 23, 37, 57), 'dev')PythonPython 2.7.1: 
C:\Python27\pythonw.exeTRACEBACK

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

Traceback (most recent call last):
  File "c:\web2py5\gluon\restricted.py", line 206, in restricted
exec ccode in environment
  File "c:/web2py5/applications/examples/controllers/test.py" 
, line 
1, in 
@auth.requires_login()
NameError: name 'auth' is not defined


Its occurred over the last few trunk versions. A version from 2012-7-21 is 
OK, and have rolled back to that.
Is there something that I should be aware of?


-- 





[web2py] Re: Grid, NameError: name 'auth' is not defined

2012-08-23 Thread Simon Ashley
Yep, sorry about that (was trying to post something quick to illustrate the 
issue).
Part of the issue appears to be the db.auth_user table.
Deleted and manually rebuilt it, and the error disappeared.

Its appears that the latest trunk maybe have broken a callback link 
(reloads the calling form rather than the form being called), but still 
investigating.


-- 





[web2py] Trunk > 20012-08-19 formatting

2012-08-23 Thread Simon Ashley
Its appears that SQLFORM.grid formatting has changed recently in the trunk:
(with no change to the application)


   - The Query button has been dropped, 
   - Add button moved to on top of the query field.
   - Export function changed from before the table to after with hyperlinks 
   options rather than drill down box selections
   

Is this an intentional move?



-- 





[web2py] Re: Trunk > 20012-08-19 formatting

2012-08-23 Thread Simon Ashley
That's OK. 
I'm not sure with the styling of the Export at bottom of the screen but no 
biggy.

The main issue that I'm working through is the a working app in a trunk 
from 2012-07-21 is broken in the current trunk.

One issue appears to be related to the auth_users table. 
Would not play nicely with 2012-08-19 and the fix was to delete the table 
and manually recreate it.
(couldn't see any reason from tools.py, as table defs looked the same)

An unresolved issue is with a .represent link loading the calling, rather 
than the called form in the target div (2012-07-21 works perfectly) i.e.

db.RaceData.date.represent = lambda value,row: A(value, callback=URL(app,
"race","Rcard",args=[row.date,row.course]),target="Rcard")




On Friday, 24 August 2012 11:58:41 UTC+10, Massimo Di Pierro wrote:
>
> Yes. The grid was an experimental feature in 1.99.7. We are still making 
> minor tweaks to it. 
> The query button is gone because its effect can be achieved by giving 
> focus to the search input.
> The add button moved up to save space.
> The export feature has been improved. There are many export options and we 
> thought a good way was to add links at the bottom.
>
> Notice that the old export form was problematic because did not work well 
> with LOADed grids.
>
> Anyway, it should not break existing functionality. Doesn't it look better 
> now?
>
> Massimo
>
> On Thursday, 23 August 2012 20:47:03 UTC-5, Simon Ashley wrote:
>>
>> Its appears that SQLFORM.grid formatting has changed recently in the 
>> trunk:
>> (with no change to the application)
>>
>>
>>- The Query button has been dropped, 
>>- Add button moved to on top of the query field.
>>- Export function changed from before the table to after with 
>>hyperlinks options rather than drill down box selections
>>
>>
>> Is this an intentional move?
>>
>>
>> <https://lh6.googleusercontent.com/-_QRTUDjLW0s/UDbbjh6lYVI/ADg/JFjcfzZV0us/s1600/grid+example+1png.png>
>>
>>

-- 





[web2py] Re: Trunk > 20012-08-19 formatting

2012-08-23 Thread Simon Ashley
The last issue resolved and re iteration of a warning to others. 
*Don't use more than one SQLFORM.grid on a form.*


On Friday, 24 August 2012 12:32:01 UTC+10, Simon Ashley wrote:
>
> That's OK. 
> I'm not sure with the styling of the Export at bottom of the screen but no 
> biggy.
>
> The main issue that I'm working through is that a working app in a trunk 
> from 2012-07-21 is broken in the current trunk.
>
> One issue appears to be related to the auth_users table. 
> Would not play nicely with 2012-08-19 and the fix was to delete the table 
> and manually recreate it.
> (couldn't see any reason from tools.py, as table defs looked the same)
>
> An unresolved issue is with a .represent link loading the calling, rather 
> than the called form in the target div (2012-07-21 works perfectly) i.e.
>
> db.RaceData.date.represent = lambda value,row: A(value, callback=URL(app,
> "race","Rcard",args=[row.date,row.course]),target="Rcard")
>
>
>
>
> On Friday, 24 August 2012 11:58:41 UTC+10, Massimo Di Pierro wrote:
>>
>> Yes. The grid was an experimental feature in 1.99.7. We are still making 
>> minor tweaks to it. 
>> The query button is gone because its effect can be achieved by giving 
>> focus to the search input.
>> The add button moved up to save space.
>> The export feature has been improved. There are many export options and 
>> we thought a good way was to add links at the bottom.
>>
>> Notice that the old export form was problematic because did not work well 
>> with LOADed grids.
>>
>> Anyway, it should not break existing functionality. Doesn't it look 
>> better now?
>>
>> Massimo
>>
>> On Thursday, 23 August 2012 20:47:03 UTC-5, Simon Ashley wrote:
>>>
>>> Its appears that SQLFORM.grid formatting has changed recently in the 
>>> trunk:
>>> (with no change to the application)
>>>
>>>
>>>- The Query button has been dropped, 
>>>- Add button moved to on top of the query field.
>>>- Export function changed from before the table to after with 
>>>hyperlinks options rather than drill down box selections
>>>
>>>
>>> Is this an intentional move?
>>>
>>>
>>> <https://lh6.googleusercontent.com/-_QRTUDjLW0s/UDbbjh6lYVI/ADg/JFjcfzZV0us/s1600/grid+example+1png.png>
>>>
>>>

-- 





[web2py] Plugin Wiki, jqgrid, crud.create error

2012-04-11 Thread Simon Ashley


Just playing with the plugin wiki and jqgrid with a simple example below, but 
it return an error:

Not sure why, any ideas?





# List of Plant

``

name: jqgrid

table: plant

fields: Code,Description,SMU,Date

col_width: 80

width: 700

height: 300

``:widget

# New Plant

``

name: create

table: plant

``:widget








Traceback (most recent call last):

  File "C:\web2py1\applications\MedicalSocialNetwork\models\plugin_wiki.py", 
line 552, in render_widget

html = getattr(PluginWikiWidgets,name)(**args)

  File "C:\web2py1\applications\MedicalSocialNetwork\models\plugin_wiki.py", 
line 174, in create

return crud.create(db[table],message=message,next=next)

  File "C:\web2py1\gluon\dal.py", line 6638, in __getitem__

return dict.__getitem__(self, str(key))

*KeyError: 'plant'*




version  1.99.7 (2012-04-09 09:21:21) dev
os: win7, 64bit
sqlite



Re: [web2py] Plugin Wiki, jqgrid, crud.create error

2012-04-13 Thread Simon Ashley
Thanks Johann,

Sorry for the delay. 
Have just had a chance to have another play.
and you're right, it does need to be defined first in the models
(would have thought that it defeats some of the benefits of the adhoc 
nature of the plugin, but no matter)


On Thursday, 12 April 2012 17:03:14 UTC+10, Johann Spies wrote:
>
> On 12 April 2012 05:38, Simon Ashley wrote:
>
>> Just playing with the plugin wiki and jqgrid with a simple example below, 
>> but it return an error:
>>
>> Not sure why, any ideas?
>>
>>
>>
> Did you create the table 'plant' ?
>
> I also played with this yesterday and it seems that this 'create' widget 
> only creates a form based on  the table (plant in this case).
>
>
> Regards
> Johann 
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>

[web2py] jstree, controller call

2012-04-14 Thread Simon Ashley
Having difficulties coming up with an appropriate call back from a jstree 
triggered from a .bind event. 
Javascript/ JQuery/ jsTree code is as follows:

 ).bind("select_node.jstree", function (event, data) { "xxx" }

what we're trying to do is to make the call back ("xxx") to the controller 
to fire off another form. 
While alert(data.rslt.obj.attr("id")); works, cant work out the appropriate 
code to get back to the controller.
Have tried lines like:

"ajax('index',[],'target')";
"{{=URL('tree','stree','index')}}";
etc, etc,

without any success. 
Can hints?



[web2py] Re: jstree, controller call

2012-04-17 Thread Simon Ashley
Ok, I'll rephrase this:

   - what's the best/ simpliest way of calling a controller from a view?
   - using javascript? or escaping python code?
   

On Sunday, 15 April 2012 16:30:16 UTC+10, Simon Ashley wrote:
>
> Having difficulties coming up with an appropriate call back from a jstree 
> triggered from a .bind event. 
> Javascript/ JQuery/ jsTree code is as follows:
>
>  ).bind("select_node.jstree", function (event, data) { "xxx" }
>
> what we're trying to do is to make the call back ("xxx") to the controller 
> to fire off another form. 
> While alert(data.rslt.obj.attr("id")); works, cant work out the 
> appropriate code to get back to the controller.
> Have tried lines like:
>
> "ajax('index',[],'target')";
> "{{=URL('tree','stree','index')}}";
> etc, etc,
>
> without any success. 
> Can hints?
>
>

[web2py] Re: jstree, controller call

2012-04-17 Thread Simon Ashley
Thanks but unfortunately this doesn't help as the controller needs to be 
called from within the view.

(what we believe to be normal python escaping techniques i.e. {{ ... }} 
doesn't seems to be returning appropriate responses.
Have been stuck on this for weeks now. 
While our javascript skills may be basic, would have thought we would have 
come across example code by now)

On Wednesday, 18 April 2012 00:18:25 UTC+10, villas wrote:
>
> From the book:
>
> response.render(view, vars): a method used to call the view explicitly 
> inside
> the controller. view is an optional parameter which is the name of the view
> file, vars is a dictionary of named values passed to the view.
>
> HTH David
>


[web2py] Re: A helper returning an unexpected result

2012-04-17 Thread Simon Ashley
Thanks, was expecting a call to the the 'index' function as defined within 
the default controller.
('index' is just calling a simple grid - to see if something/ anything 
could be called)

This was a derivation of an earlier thread (jstree, controller call) and 
was part of a many of attempts (all failures) to a function.


On Wednesday, 18 April 2012 00:58:45 UTC+10, Anthony wrote:
>
> Just wondering why a 'A' helper with a call back as follows:
>>
>> {{=A('click me', callback=URL('index'))}}
>>
>> would return the following:
>>
>> http://127.0.0.1:8000/tree/stree/tree#null>" 
>> onclick="ajax('/tree/stree/index',[],'');return 
>> false;">click me
>>
>
> What would you expect it to return? The purpose of the callback argument 
> is to make an Ajax call to the server when the link is clicked. It is 
> explained more here: 
> http://web2py.com/books/default/chapter/29/5#Built-in-helpers.
>
> Anthony
>


[web2py] Re: jstree, controller call

2012-04-17 Thread Simon Ashley
Thanks.
An excellent explanation and much appreciated.
That works.

I'll look at extending this to a new page and/ or a modal window.

On Wednesday, 18 April 2012 08:53:50 UTC+10, Niphlod wrote:
>
> sorry to be so late 
>
> if you have {{=URL('tree','stree','index')}} anywhere in the view it gets 
> translated to:
>
> /appname/tree/stree/index
>
> Now, if you check your source, you should see it.
> So, try to "hardcode" that url without using {{=URL()}} syntax and check 
> if your javascript is working.
>
> Actually, it won't :P. No fault from web2py side, but from the javascript 
> one
>
>  bind("select_node.jstree", function (event, data) { "xxx" } is a function 
> where you have to "decode" data to something useful
> as you said, data.rslt.obj.attr("id") contains the id value of the 
> selected item.
> If you want to pass that to /appname/tree/stree/index, you need to 
> "append" that to the url.
> Prepare the index() function as :
>
> def index():
>   record_id = request.args(0)
>   ...
>   return dict(form=form) 
>  
> so the form returns the form for the correct record if called as 
> /appname/tree/stree/index/the_actual_selected_id
>
> Then, you must "prepare" a div into the page where you want the form to be 
> loaded, as 
>
> 
>
> This is merely a placeholder, you can put it where you want, as long as it 
> is in the same page where the tree is loaded, and where you can then put 
> the following javascript snippet
>
>
> bind("select_node.jstree", function (event, data) { 
> var baseurl = "{{=URL('tree', 'stree', 'index', extension='load')}}" + 
> "/" + data.rslt.obj.attr("id");
> web2py_component(baseurl, 'theformdiv');
>   } 
>
> the "web2py_component" part calls the 
> /appname/tree/stree/index/theselectedid with ajax and place the obtained 
> result into the div with id = #theformdiv
>
> Il giorno mercoledì 18 aprile 2012 00:27:51 UTC+2, Simon Ashley ha scritto:
>>
>> Thanks but unfortunately this doesn't help as the controller needs to be 
>> called from within the view.
>>
>> (what we believe to be normal python escaping techniques i.e. {{ ... }} 
>> doesn't seems to be returning appropriate responses.
>> Have been stuck on this for weeks now. 
>> While our javascript skills may be basic, would have thought we would 
>> have come across example code by now)
>>
>> On Wednesday, 18 April 2012 00:18:25 UTC+10, villas wrote:
>>>
>>> From the book:
>>>
>>> response.render(view, vars): a method used to call the view explicitly 
>>> inside
>>> the controller. view is an optional parameter which is the name of the 
>>> view
>>> file, vars is a dictionary of named values passed to the view.
>>>
>>> HTH David
>>>
>>

[web2py] Re: ImportError with plugin

2012-05-13 Thread Simon Ashley
Has anyone come up with a solution to this? Have the same issue.

On Thursday, December 1, 2011 7:08:38 AM UTC+10, haikuvend Resident wrote:
>
> I have downloaded a plugin from http://dev.s-cubism.com/plugin_solidform
>
> It consists of two files:
>  - controller/plugin_solidform.py (demo)
>  - *modules/plugin_solidform.py* (the actual plugin)
>
> When using the exact same command as in the provided example:
>
> from plugin_solidform import SOLIDFORM
>
> in *controller/default.py*
>
> it gives me the following Traceback:
>
> Traceback (most recent call last):
>   File "C:\Users\xxx\web2py\gluon\restricted.py", line 194, 
> in restricted
> exec ccode in environment
>   File "
> C:/Users/xxx/web2py/applications/haikuvend/controllers/default.py",
>  
> line 56, in 
>   File "C:\Users\xxx\web2py\gluon\globals.py", line 149, in 
> 
> self._caller = lambda f: f()
>   File "
> C:/Users/xxx/web2py/applications/haikuvend/controllers/default.py",
>  
> line 13, in contact
> from plugin_solidform import SOLIDFORM
>   File "C:\Users\xxx\web2py\gluon\custom_import.py", line 294, 
> in __call__
> fromlist, level)
>   File "C:\Users\xxx\web2py\gluon\custom_import.py", line 78, 
> in __call__
> level)
> ImportError: No module named plugin_solidform
>
> Again, I'm using the exact same syntax as on that page. Why doesn't it 
> work for me?
>


[web2py] Re: ImportError with plugin

2012-05-13 Thread Simon Ashley
Answering my own question here. 
Its a path issue. 
If you insert the fill path from the applications folder, its found.

On Monday, May 14, 2012 8:08:23 AM UTC+10, Simon Ashley wrote:
>
> Has anyone come up with a solution to this? Have the same issue.
>
> On Thursday, December 1, 2011 7:08:38 AM UTC+10, haikuvend Resident wrote:
>>
>> I have downloaded a plugin from http://dev.s-cubism.com/plugin_solidform
>>
>> It consists of two files:
>>  - controller/plugin_solidform.py (demo)
>>  - *modules/plugin_solidform.py* (the actual plugin)
>>
>> When using the exact same command as in the provided example:
>>
>> from plugin_solidform import SOLIDFORM
>>
>> in *controller/default.py*
>>
>> it gives me the following Traceback:
>>
>> Traceback (most recent call last):
>>   File "C:\Users\xxx\web2py\gluon\restricted.py", line 194, 
>> in restricted
>> exec ccode in environment
>>   File "
>> C:/Users/xxx/web2py/applications/haikuvend/controllers/default.py",
>>  
>> line 56, in 
>>   File "C:\Users\xxx\web2py\gluon\globals.py", line 149, in 
>> 
>> self._caller = lambda f: f()
>>   File "
>> C:/Users/xxx/web2py/applications/haikuvend/controllers/default.py",
>>  
>> line 13, in contact
>> from plugin_solidform import SOLIDFORM
>>   File "C:\Users\xxx\web2py\gluon\custom_import.py", line 294, 
>> in __call__
>> fromlist, level)
>>   File "C:\Users\xxx\web2py\gluon\custom_import.py", line 78, 
>> in __call__
>> level)
>> ImportError: No module named plugin_solidform
>>
>> Again, I'm using the exact same syntax as on that page. Why doesn't it 
>> work for me?
>>
>

[web2py] Solidform error: list indices must be integers

2012-05-16 Thread Simon Ashley
Any one with any ideas on this one?
(been trying to trouble shoot it all morning)

Environment: Version 1.99.4 (2011-12-31 04:51:15)

Getting the following error, and unable to work it out.
(have other areas using soldiform that are working OK)

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 204, in restricted
exec ccode in environment
  File "C:/web2py/applications/tree/controllers/stree.py" 
, line 310, 
in 
  File "C:\web2py\gluon\globals.py", line 172, in 
self._caller = lambda f: f()
  File "C:/web2py/applications/tree/controllers/stree.py" 
, line 302, 
in SV2
form1 = SOLIDFORM(db.Sample, q1, fields=fields1, readonly=True)
  File "applications\tree\modules\plugin_solidform.py", line 94, in __init__
SQLFORM.__init__(self, *args, **kwds)
  File "C:\web2py\gluon\sqlhtml.py", line 805, in __init__
v = record['id']
  File "C:\web2py\gluon\dal.py", line 6532, in __getitem__
row = self.records[i]

*TypeError: list indices must be integers, not str*


*Model*
db.define_table('Sample',
Field('Compartment', db.Compartment),
Field('Date', 'date'),
Field('Comments'),
Field('Pb', 'integer'),
Field('Fe', 'integer'),
Field('Al', 'integer'),
Field('Cu', 'integer'),
Field('Cr', 'integer'),
Field('Sn', 'integer'),
Field('Ni', 'integer'),
Field('Si', 'integer'),
Field('Na', 'integer'),
Field('Mg', 'integer'),
Field('Zn', 'integer'),
Field('Mo', 'integer'),
Field('Ca', 'integer'),
Field('P', 'integer'),
Field('Bo', 'integer'),
 
format='%(Date)s %(id)s')

*Controller*
Methods 2 and 3 work, 1 doesn't
*
*
def SV2():
session.sample = 1

q1 = db(db.Sample.id == session.sample).select()
#q2 = db.Sample.id == session.sample
#q3 = db.Sample.id == session.sample
fields1 = ['Date','Comments','Fe','Cu','Cr']
#fields3 = ['Date','Comments','Fe','Cu','Cr']

form1 = SOLIDFORM(db.Sample, q1, fields=fields1, readonly=True)
#form2 = SQLFORM.grid(q2, searchable=False, 
create=False,csv=False,editable=False,deletable=False, sortable=False )
#form3 = SQLFORM(db.Sample, session.sample, fields=fields3, 
readonly=True)

return dict(form=form1) #does not work
#return dict(form=form2) #works
#return dict(form=form3) #works


[web2py] Re: Solidform error: list indices must be integers

2012-05-16 Thread Simon Ashley


<https://lh5.googleusercontent.com/-qrlS92szKAE/T7Sbh21ZjPI/AGM/M4GpWU4XMjY/s1600/readonly.png>

<https://lh4.googleusercontent.com/-StOS7GeF4T8/T7Sba3P801I/AGE/JVsInDhicow/s1600/edit.png>
Thanks for that 
(mind in neutral)

(Seems to be a issue with tags on read only forms but will try to work 
around that)

On Thursday, May 17, 2012 12:41:48 PM UTC+10, Massimo Di Pierro wrote:
>
> Assuming SOLIDFORM is an SQLFORM
>
> form1 = SOLIDFORM(db.Sample, q1, fields=fields1, readonly=True)
>
> q1 should be a record id or a Row object. You are passing a Rows object.
>
> On Wednesday, 16 May 2012 21:32:08 UTC-5, Simon Ashley wrote:
>>
>> Any one with any ideas on this one?
>> (been trying to trouble shoot it all morning)
>>
>> Environment: Version 1.99.4 (2011-12-31 04:51:15)
>>
>> Getting the following error, and unable to work it out.
>> (have other areas using soldiform that are working OK)
>>
>> Traceback (most recent call last):
>>   File "C:\web2py\gluon\restricted.py", line 204, in restricted
>> exec ccode in environment
>>   File "C:/web2py/applications/tree/controllers/stree.py" 
>> <http://127.0.0.1:8000/admin/default/edit/tree/controllers/stree.py>, line 
>> 310, in 
>>   File "C:\web2py\gluon\globals.py", line 172, in 
>> self._caller = lambda f: f()
>>   File "C:/web2py/applications/tree/controllers/stree.py" 
>> <http://127.0.0.1:8000/admin/default/edit/tree/controllers/stree.py>, line 
>> 302, in SV2
>> form1 = SOLIDFORM(db.Sample, q1, fields=fields1, readonly=True)
>>   File "applications\tree\modules\plugin_solidform.py", line 94, in __init__
>> SQLFORM.__init__(self, *args, **kwds)
>>   File "C:\web2py\gluon\sqlhtml.py", line 805, in __init__
>> v = record['id']
>>   File "C:\web2py\gluon\dal.py", line 6532, in __getitem__
>> row = self.records[i]
>>
>> *TypeError: list indices must be integers, not str*
>>
>>
>> *Model*
>> db.define_table('Sample',
>> Field('Compartment', db.Compartment),
>> Field('Date', 'date'),
>> Field('Comments'),
>> Field('Pb', 'integer'),
>> Field('Fe', 'integer'),
>> Field('Al', 'integer'),
>> Field('Cu', 'integer'),
>> Field('Cr', 'integer'),
>> Field('Sn', 'integer'),
>> Field('Ni', 'integer'),
>> Field('Si', 'integer'),
>> Field('Na', 'integer'),
>> Field('Mg', 'integer'),
>> Field('Zn', 'integer'),
>> Field('Mo', 'integer'),
>> Field('Ca', 'integer'),
>> Field('P', 'integer'),
>> Field('Bo', 'integer'),
>>  
>> format='%(Date)s %(id)s')
>>
>> *Controller*
>> Methods 2 and 3 work, 1 doesn't
>> *
>> *
>> def SV2():
>> session.sample = 1
>> 
>> q1 = db(db.Sample.id == session.sample).select()
>> #q2 = db.Sample.id == session.sample
>> #q3 = db.Sample.id == session.sample
>> fields1 = ['Date','Comments','Fe','Cu','Cr']
>> #fields3 = ['Date','Comments','Fe','Cu','Cr']
>> 
>> form1 = SOLIDFORM(db.Sample, q1, fields=fields1, readonly=True)
>> #form2 = SQLFORM.grid(q2, searchable=False, 
>> create=False,csv=False,editable=False,deletable=False, sortable=False )
>> #form3 = SQLFORM(db.Sample, session.sample, fields=fields3, 
>> readonly=True)
>> 
>> return dict(form=form1) #does not work
>> #return dict(form=form2) #works
>> #return dict(form=form3) #works
>>
>

[web2py] ExecuteSQL, nested selects

2012-05-20 Thread Simon Ashley
trying the following expression but get an update according to the first 
record rather than being conditional on specific records processed:

db.executesql("UPDATE Plant SET SiteID=(SELECT Site.id FROM Plant, Site 
WHERE Site.SiteId = Plant.SiteIdLink);") 


 ie. all SiteID's get the value of the first Site.SiteId = Plant.SiteIdLink 
encountered.

Just can't see the solution at present.


[web2py] Re: ExecuteSQL, nested selects

2012-05-20 Thread Simon Ashley
To answer my own post, syntax should have been:  

db.executesql("UPDATE Plant SET SiteID=(SELECT Site.id FROM Site WHERE 
Site.SiteId = Plant.SiteIdLink);")  


Sorry about that ... 

On Monday, May 21, 2012 2:50:33 PM UTC+10, Simon Ashley wrote:
>
> trying the following expression but get an update according to the first 
> record rather than being conditional on specific records processed:
>
> db.executesql("UPDATE Plant SET SiteID=(SELECT Site.id FROM Plant, Site 
> WHERE Site.SiteId = Plant.SiteIdLink);") 
>
>
>  ie. all SiteID's get the value of the first Site.SiteId = 
> Plant.SiteIdLink encountered.
>
> Just can't see the solution at present.
>


[web2py] Jeditable and SQLTables

2012-06-22 Thread Simon Ashley
Does anyone have any native python/ web2py code for a jeditable call in a 
table that they are willing to share i.e. a web2py version of save.php?   

-- 





[web2py] Re: Jeditable and SQLTables

2012-06-24 Thread Simon Ashley


OK, a little bit more infor if anyone can help:

Have a requirement for get jeditable working with a grid/ table (sqlform.grid 
or slqtable). Current issue is that using the jeditable.js, return 
parameters seems incorrect i.e. editable td value is the indicator 
parameter rather than what should have been passed as the edited text given 
the following *view* scenario 

{{response.files.append(URL('static','js/jquery.jeditable.js'))}}

{{extend 'layout_bs.html'}}

 

jQuery(document).ready(function(){

 jQuery('.EDit').editable("{{=URL('update')}}",{ 

  style: 'display: inline',

  indicator : "1", //returns this value rather that the user edited 
value. Originally "" as per jeditable demos

  tooltip   : "Click to edit...",

  style  : "inherit" });alert('tested!');})  



{{=form}}

{{=response.toolbar()}}

 

Files attached are the jeditiable.js script downloaded from github, model, 
controller, view.

*Model:*

 db.define_table('WSProb',

  Field('Name','string',label='Name'),

  Field('FP','integer',label='Fp',default=0)) 

*Controller:*

def style(v,s1):

if v==0: s1="background-color:#CFECEC"  

elif v==2: s1="background-color:#EA"

else: s1="background-color:#00"

s1=s1+"; text-align:center"

return s1

 

def probs():

  s1=[]

  t1=[]

  value=0

  db.WSProb.FP.represent = lambda value, row: DIV(value, _class="EDit", 
_style=style(value,s1), _id=str(row.id)+'.FP')

  query = db.WSProb.id>0

  db.WSProb.id.readable=False

  fields = (db.WSProb.id, db.WSProb.Name, db.WSProb.FP)

  table = SQLFORM.grid(db.WSProb, fields=fields, searchable=False)

  return dict(form = table) 

Understanding from documentation was that the DIV id and value was passed 
to the targeted url: i.e.

def update():

if request.args:

  loc = request.args[0].split['.']

  id = loc[0]

  column = loc[1]

  value = request.args[1]

  db(db.WSprob.id==id).update(column=value)

  #response.flash = 'value updated'

  return value

The update controller should update the table with the edited value.

-- 





Re: [web2py] Re: cpdb errors

2013-01-09 Thread Simon Ashley
Just confirming that csv imports fail with Postgres on Ubuntu 12.10, but 
both sqlite and mysql import fine. 

Suspect its a postgres issue, and will attempt different adapters/ refactor 
of the DAL table def to try and identify the cause
Error message is fairly generic.
 



 
>
>

-- 





Re: [web2py] Re: cpdb errors

2013-01-09 Thread Simon Ashley
9.1 (fresh install yesterday)

-- 





Re: [web2py] Re: cpdb errors

2013-01-09 Thread Simon Ashley
I hate this.
Its fixed (stable) for the time being, but cant clearly identify the cause. 
I'm sure that there is a still memory leak and it may appear again.. 
Early in the process, Ubuntu was acting similarly to Windows 7 i.e. 
consuming memory when importing the csv file and eventually failing. 

Steps taken were:

   - installed psycopg2 (still had issues)
   - took the table definition in the DAL back to the first few fields 
   (imported OK)
   - Gradually added the fields back in (import OK on each iteration)
   - when the complete/ original table imported, re imported the entire app 
   data (OK)

The table definition in the DAL has approx 150 fields (and string fields 
had been left at their default length)


-- 





Re: [web2py] Re: cpdb errors

2013-01-10 Thread Simon Ashley

>
> *Final conclusion:* memory leak confined to pg8000.

psycopg2 works fine in Windows and Linux.
>
>
>

-- 





[web2py] Amazon RDS

2013-01-14 Thread Simon Ashley
Wondering if it is possible to connect an EC2 instance/ application to a 
RDS instance (MYSQL), and what the connection string should be?
There is some discussions here implying that it may be possible but 
uncertain of the connection string. 
What's been suggested is db = DAL('mysql//"*connection string - endpoint?*"') 
but that looks wrong and hasn't worked.
Any one clues on this?
TIA

-- 





[web2py] Re: Amazon RDS

2013-01-15 Thread Simon Ashley
Never mind - RTFL. Above string works fine .Issue in the security groups. 

-- 





[web2py] Re: smartgrid - display linked_tables link as a dropdown button instead

2013-01-19 Thread Simon Ashley
Its high on our list as well.  
That plus a denser edit/create/view layout similar to Scubism's Solid Form.

-- 





[web2py] Re: smartgrid - display linked_tables link as a dropdown button instead

2013-01-20 Thread Simon Ashley
My original post hasn't turned up yet, so this may be a duplicate. There 
was an earlier request (last year) by Massimo, with code written by Martin 
Mulone to address the dropdown button issue. It may have slipped through 
the system and never implemented.

https://groups.google.com/forum/#!searchin/web2py-developers/buttons$20in$20grid/web2py-developers/naPIG3ORfrY/f34knZoozfcJ


-- 





[web2py] 2 grids loaded in a single form: back button reference

2013-02-14 Thread Simon Ashley
Trying to embed multiple grids (or at least 2 of them) on a single page 
using load statements as per the following controller, functions and views.
It seems to work fine until you click view or edit, from the called grid, 
on the calling grid (step2).
The related edit and view seem to be rendered ok, but the back button is 
rendered as a link to the called grid (step3).

e.g. Step1



Step2



Step3




i.e.

Controller:
def populate():
   db.dogs.truncate()
db.fleas.truncate()
db.dogs.insert(dog_name='dagwood')
db.dogs.insert(dog_name='daisy')
db.fleas.insert(dog_name='daisy', flea_name='fatso')
db.fleas.insert(dog_name='dagwood', flea_name='felix')
db.fleas.insert(dog_name='dagwood', flea_name='fatso')

def dogsfleas():
return locals()
  
def dogs():
db.dogs.dog_name.represent = lambda value,row: A(value, _href=URL(
"fleas",vars=dict(dog_name=row.dog_name)), cid="fleas")
grid = SQLFORM.grid(db.dogs, csv=False)
return dict(form=grid)

def fleas():
db.fleas.dog_name.default = request.vars.dog_name
q = db(db.fleas.dog_name == request.vars.dog_name)
q1 = (db.fleas.dog_name == request.vars.dog_name)
if q.count() == 0:
grid1 = SQLFORM.grid(db.fleas, csv=False)
else:
grid1 = SQLFORM.grid(q1, user_signature=False, csv=False)
return dict(form1=grid1)
Views:
dogsfleas.html
{{extend 'layout.html'}}

{{=LOAD('dogs','dogs',ajax=True, cid='dogs')}}

  {{#=response.toolbar()}}

 
 
  
  


dogs.html
Dogs
{{=form}}
{{#=response.toolbar()}}

fleas.html
Fleas
{{=form1}}
{{E=response.toolbar()}}

Inspecting the dog edit code, top line buttons
https://groups.google.com/groups/opt_out.




[web2py] Date null display

2013-02-14 Thread Simon Ashley
Traditionally in other field types you could display a null value with an 
expression similar to the following:

db.table.datefield.represent = lambda value, row: A(value) if value else 
'unknown'

Occasional we have a requirement to display null values as alternatively 
i.e. None, Unknown, Not recorded, Not applicable etc 
While it can be done with the above, as it stands, A(value) reverts any 
display formatting back to the default i.e. '%Y-%m-%d' rather than any 
other format that's been set as the default.

Are there any alternatives to this to retain default formatting i.e. 
'%d/%m/%y'?



-- 

--- 
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] Date null display

2013-02-15 Thread Simon Ashley
Thanks Bruno, that works.

(had tried that earlier, but didn't get it.
Time to flex off for the weekend, me thinks)

-- 

--- 
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: 2 grids loaded in a single form: back button reference

2013-02-15 Thread Simon Ashley
Thanks Niphlod, that worked.

(Eventually. 
Had some weird caching going on. 
The submit was originally redirecting to an unrelated controller and 
function. 
Eventually cleared itself after deleting and reinserting the formname 
attribute.
Using current trunk)

-- 

--- 
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] DAL update with a accumated field

2013-02-24 Thread Simon Ashley
Having problems updating from with a row with a db.table.field.count() 
field (similarly with sum(), min(), max() etc.)

i.e.
def update_flea_count():
query = db(db.fleas.id>0).select(db.fleas.dog_name, 
db.fleas.flea_name.count(), orderby=db.fleas.dog_name, 
groupby=db.fleas.dog_name)
for row in query:
db.dogs.update_or_insert(db.dogs.dog_name == row.dog_name,
dog_name = row.dog_name,
flea_count = row.flea_name.count())

fails with 

 File "C:/web2py16/applications/lconfirm/controllers/dogs.py" 
, line 
29, in update_flea_count
db.dogs.update_or_insert(db.dogs.dog_name == row.flea_dog_name,
AttributeError: 'Row' object has no attribute 'flea_dog_name'


but

def update_flea_count():
query = db(db.fleas.id>0).select(db.fleas.dog_name, 
db.fleas.flea_name.count(), orderby=db.fleas.dog_name, 
groupby=db.fleas.dog_name)
form = SQLTABLE(query)
return dict(form=form)

works, as does an update without any db.fleas.flea_name.count() field in 
the select.

Is there a way around this?
(need to build analysis/ accumulation tables for management reporting)
TIA



-- 

--- 
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: DAL update with a accumated field

2013-02-24 Thread Simon Ashley
Sorry, the error should have read:

 File "C:/web2py16/applications/lconfirm/controllers/dogs.py" 
, line 
27, in update_flea_count
db.dogs.update_or_insert(db.dogs.dog_name == row.dog_name,
AttributeError: 'Row' object has no attribute 'dog_name'


The code is as follows:
Model
db.define_table('dogs',
Field('dog_name','string'),
Field('flea_Count','integer'))

db.define_table('fleas',
Field('dog_name','string'),
Field('flea_name','string'))

Controller
def populate():
db.dogs.truncate()
db.fleas.truncate()
db.dogs.insert(dog_name='dagwood')
db.dogs.insert(dog_name='daisy')
db.fleas.insert(dog_name='daisy', flea_name='fatso')
db.fleas.insert(dog_name='dagwood', flea_name='felix')
db.fleas.insert(dog_name='dagwood', flea_name='fatso')

def update_flea_count():
query = db(db.fleas.id>0).select(db.fleas.dog_name, 
db.fleas.flea_name.count(), orderby=db.fleas.dog_name, 
groupby=db.fleas.dog_name)
for row in query:
db.dogs.update_or_insert(db.dogs.dog_name == row.dog_name,
dog_name = row.dog_name,
flea_count = row.fleas.flea_name.count)
form = SQLTABLE(query)
return dict(form=form)

def update_flea_count1():
query = db(db.fleas.id>0).select(db.fleas.dog_name, 
db.fleas.flea_name.count(), orderby=db.fleas.dog_name, 
groupby=db.fleas.dog_name)
form = SQLTABLE(query)
return dict(form=form)

Apologies for that. 
(Its what happens at 1.30am when you suddenly discover that someone has 
just rewritten beancount :))


-- 

--- 
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] admin app 4 x slower with 2.2.1 versus 2.0.9

2012-10-27 Thread Simon Ashley
Experiencing slow screen loads using the standard admin app when editing an 
application. 
Both admins load the same amount of data (900k) but 2.0.9 load in 2.3secs, 
with 2.2.1 taking over 10secs. 

Are there any setting/ tricks to improve 2.2.1's performance?

(900k seems high, when intensive/ complex HTML returns are 120k or less. 
Why so high?)
 
Win7 environment/ SQLite/ Chrome/ Firefox.

-- 





[web2py] DAL update with date arithmetic

2012-10-27 Thread Simon Ashley
Uncertain why the first fails with the following error:

TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 
'Field'

and the second works.

def Update_RData3_dslr():
import datetime
today = datetime.date.today()
db(db.HData.id>0 and db.HData.lrace).update(dslr = (request.now - db.
HData.lrace).days)

  


def Update_RData4_dslr():
import datetime
today = datetime.date.today()
rows = db(db.HData.id>0 and db.HData.lrace).select(db.HData.id, db.HData
.lrace)
for row in rows:
dslr = (today - row.lrace).days
db(db.HData.id == row.id).update(dslr = dslr)

TIA

-- 





[web2py] Re: admin app 4 x slower with 2.2.1 versus 2.0.9

2012-10-27 Thread Simon Ashley
Exiting a controller to return to the main page (back button).
i.e. loads /admin/default/design

Downloaded a new source/ nightly build and seems to be better - 5.3 
seconds, 839k, but still seems a little bit long.


-- 





[web2py] Re: DAL update with date arithmetic

2012-10-27 Thread Simon Ashley
OK, thanks for that :)

-- 





[web2py] Re: admin app 4 x slower with 2.2.1 versus 2.0.9

2012-10-27 Thread Simon Ashley

just to be clear we're running localhost on an i7 with 8g ram. 
The benchmark is taken returning back to the *admin/default/design/someapp 
*page 
from inside a controller. 
(hitting the *back* button to right of screen)
(original reply may have been a bit confusing)

Benchmarks with Win7
1. Chrome 22.0.1229.94 and inspecting: /admin/default/design 5.36 sec for 
816k, (repeatable)
controller folder size 284k, Models 137k, Views 317k.

2. firefox 16.0.1 / firebug 1.10.5 - 5.66 sec wait, 93ms receiving,  7.96 
sec onload from initial request (repeatable)

Don't think twiiter feeds are an issue (that's at the high level site 
screen)

Doing the reverse and editing the same controller is fine @ 201ms for 44kb

Will reboot with Ubuntu 10.4 on same machine / application and test.

-- 





[web2py] Re: admin app 4 x slower with 2.2.1 versus 2.0.9

2012-10-27 Thread Simon Ashley

Ubuntu 12.04, with a standard web2py install /apache/sqlite: Chromium 
/admin/default/design 2.51 sec (repeatable)
Firefox -  2.47 (repeatable) (on load 4.7)

Summary: 2x as quick as Win7 / Rocket.
Slower than expected but acceptable. 
Certainly more productive than Win7 which was becoming a pain.

>
>
>

-- 





[web2py] Re: admin app 4 x slower with 2.2.1 versus 2.0.9

2012-10-28 Thread Simon Ashley
Thanks but bulky, with all due respect, maybe not. 

>From one perspective, its less than 5% of our client/ server applications. 
Currently the web2py app is approx 120 tables, and 250 functions (over 25 
controllers). C/S apps which we intend to convert handle the equivalent of 
900 tables, 10,000 functions over 1200 controllers (per application), with 
uncompressed sizes exceeding 40mb with no slow down. 

While this app isn't one of them (It's reasonably small), we may need to 
investigate ways around it, if it is a scalability issue.

-- 





[web2py] Re: admin app 4 x slower with 2.2.1 versus 2.0.9

2012-10-28 Thread Simon Ashley
#Niphlod. 
Sorry for my original original comment/ response. 

I always realised that there was a going to be a limit/ scalability issue 
with the admin app.
It was intended more to stimulate debate/ ideas on how to handle bulky apps.

(was hoping that we would come across it later rather than sooner.
Bulky is a subjective term, so what we can gather, its probably has a 
thresh hold of about 500k.
Had/ have no issues with that term, but just surprised at the level).

So for bulky apps, the recommendation would be to use external editors.
What would you recommend to execute/ test the functions; the admin app or 
something else?

ps. have always admired your work!


#Massimo.
Its a very important point. 
(still affected by/ sensitive to issues which occurred years ago)
While it will make little sense to those outside of central illinois, will 
try and stick to *Caterpillar Fundamental English :)*.


pss.
We are designing/ architecturing a replacement that would address this and 
other issues but like everything, it will take a bit of time to build. 
We're open to sub contracting portions to members of the community with the 
result being open source.

-- 





[web2py] Re: admin app 4 x slower with 2.2.1 versus 2.0.9

2012-10-29 Thread Simon Ashley
Yep, that makes a lot of sense. Tried that approach with Komodo, and 
certainly is more productive. Just a change in mind set. Thanks for your 
reply.

-- 





[web2py] Icons/ imgs rather than labels for Grid headers

2012-11-04 Thread Simon Ashley
Have a requirement to produce grids / tables with icons rather than label 
headers. 
In messing around, haven't come up with a good solution, and looking for 
ideas 
(header labels are are normally translated as a strings). 

Would manipulated the grid / table variable before return it as a dict be 
the logical way to go? 
TIA.



Or is there something simpler?

-- 





[web2py] Re: Icons/ imgs rather than labels for Grid headers

2012-11-04 Thread Simon Ashley
Thanks.
Will give that another look. 
Have tried this approach (many attempts) but could not generate the correct 
HTML.

(will play around with the class as the default seems to translate the =IMG 
element as text/string)
If you have a snippet of a working example, would appreciate it.


-- 





[web2py] Re: Icons/ imgs rather than labels for Grid headers

2012-11-04 Thread Simon Ashley

>
> ahaa, thanks Paulo, that make sense i.e. to do it all in the view
>
>

-- 





[web2py] Re: we should support this in DAL

2012-11-18 Thread Simon Ashley
What issues are you coming up against with Mongo/ nosql ports and DAL 
operations?
Interested because we need to start investigating this. 

On Sunday, November 18, 2012 12:02:12 PM UTC+10, Adi wrote:
>
> Definitely would be nice to support NoSQL. 
>
> I tried the existing DAL with MongoDB and grid worked fine to the point of 
> view/edit record. Due to different concepts (sql/nosql) if it's hard to 
> keep them in a same DAL, maybe there could be a separate layer for NoSQL. 
>
> I would be glad to test lots in this area, since I'm trying to port 4-5M 
> records into MongoDB, and currently I use web2py with pymongo for that.
>
>
> On Saturday, November 17, 2012 7:19:15 AM UTC-5, Massimo Di Pierro wrote:
>>
>> http://labs.codernity.com/codernitydb/index.html
>>
>

-- 





Re: [web2py] Re: we should support this in DAL

2012-11-19 Thread Simon Ashley
The part would would have interested us is potential to re factor live 
systems, particularly with changing tenancy requirements. 
Thinking that while the DAL, by necessity will have relational database 
tendencies and may never have full nosql capability, it would be 
interesting to explore areas the extended DAL could open.

On Monday, November 19, 2012 7:20:36 PM UTC+11, Vasile Ermicioi wrote:
>
> the main problem is that web2pys DAL is designed for relational databases, 
> and writing nosql adapaters will mean porting just a subset of relational 
> functionality, but you will not be able to take advantage of unstructured 
> data, because from web2py point of view it will look structured, just 
> stored on a nosql database
>
> so I think we need to start designing the functionality for a nosql 
> version of DAL and only after that to start implement it
>

-- 





Re: [web2py] Re: we should support this in DAL

2012-11-19 Thread Simon Ashley
Thanks for that. 
Was looking to see how tender the adapter was and how far it could be 
pushed, and that may have answered it.

On Tuesday, November 20, 2012 2:50:20 AM UTC+11, Adi wrote:
>
> Hi Simon, i didn't go too far with DAL and mongo. Managed to get the grid, 
> but as mentioned before had a problem retrieving individual record 
> (document) for view and update. Then I included pymongo, and got needed 
> functionality outside of grid, but didn't have time then to continue 
> working on it. 
>
> Agreed with Vasile that it should be design properly, and then implemented 
> as a nosql version of DAL. Not sure how I could help, if not with coding, 
> then with testing at least?
>
>
> On Sun, Nov 18, 2012 at 5:02 PM, Simon Ashley 
> > wrote:
>
>> What issues are you coming up against with Mongo/ nosql ports and DAL 
>> operations?
>> Interested because we need to start investigating this. 
>>
>>
>> On Sunday, November 18, 2012 12:02:12 PM UTC+10, Adi wrote:
>>>
>>> Definitely would be nice to support NoSQL. 
>>>
>>> I tried the existing DAL with MongoDB and grid worked fine to the point 
>>> of view/edit record. Due to different concepts (sql/nosql) if it's hard to 
>>> keep them in a same DAL, maybe there could be a separate layer for NoSQL. 
>>>
>>> I would be glad to test lots in this area, since I'm trying to port 4-5M 
>>> records into MongoDB, and currently I use web2py with pymongo for that.
>>>
>>>
>>> On Saturday, November 17, 2012 7:19:15 AM UTC-5, Massimo Di Pierro wrote:
>>>>
>>>> http://labs.codernity.com/**codernitydb/index.html<http://labs.codernity.com/codernitydb/index.html>
>>>>
>>>  -- 
>>  
>>  
>>  
>>
>
>
>
>  

-- 





[web2py] Re: we should support this in DAL

2012-11-19 Thread Simon Ashley
+1 for moving in this direction.

On Saturday, November 17, 2012 10:19:15 PM UTC+10, Massimo Di Pierro wrote:
>
> http://labs.codernity.com/codernitydb/index.html
>

-- 





Re: [web2py] Re: we should support this in DAL

2012-11-19 Thread Simon Ashley
In the not to distant future we need to refactor reasonable large SQL 
databases.
Current open source choices are limited to MySQL and PostgreSQL. 
(trying to avoid vendor lock in issues).
 
Interest in this thread is as a prompt to explore nosql pros and cons.

Both SQL options are mature, well developed etc, but are they using legacy 
thinking? 
(i.e. originally developed for smaller discrete client/ server systems 
rather than where we are today)

Have always found it a pain to refactor existing tables in a production 
environment i.e. if a client wants additional fields, field sizes 
increased, or conditional fields 6 months into the deployment cycle. Sure 
you can do it with relational databases, but sooner or later you have an 
explosion of additional tables, multiple joins on hard to index or de 
normalised structures. 

Can think of one case where a single manifesting table has spawned 25 child 
tables which would be better managed as a single entity. Reports with 
queries joining 10 or more tables are common. Sure you can alter/ drop and 
load tables but its gets difficult over disconnected databases (i.e. 
different sites, different data sets but where schema has to be consistent).

Other complications occur with multi dimensional analysis, pivot tables, 
performance issues, (excessive?) requirements for temporary and posting 
tables. 
It occurs in writing this that maybe we also need to include chart 
databases such as OrientDB.

Even with nosql, believe a schema is a must, but there could be a option of 
a loosely coupled schema (maybe a view superset allowing manipulation and 
updates). Have been using this with SQLite to archive old field formats 
during development. While this can be done with the current DAL, aspects 
can get untidy.

Nothing here is a deal breaker between the choice of SQL/ no sql, but we 
also have to look at developer productivity issues.

It's new territory, and open to comments and criticism. 

>
>

-- 





Re: [web2py] Re: we should support this in DAL

2012-11-20 Thread Simon Ashley
The bottom line seems to be that we/ others need to start to use nosql 
engines to sort the issues. 
My guess is that, currently, critical mass is not present to rely on it for 
production sites.

-- 





[web2py] Conditional {{extend layout.html}}?

2012-12-28 Thread Simon Ashley
Wondering if it is possible to have a conditional {{extend layout.html}} 
similar to the following?

 {{if session.call:}}
  {{extend 'layout_XXX.html'}}
  {{pass}}

{{if not session.call:}}
  {{extend 'layout.html'}}
  {{include 'YYY.html'}}
  {{pass}}



Required for users with requiring different configurations. 
Have tried alternative approaches without success.
TIA

-- 





Re: [web2py] Conditional {{extend layout.html}}?

2012-12-29 Thread Simon Ashley
Thanks, excellent, that works ..
(compiling wont been an immediate issue)


>>  
>>
>
>

-- 





[web2py] Multiple connections/ databases with same app

2013-01-02 Thread Simon Ashley
Quick question - is this do able i.e. some tables - e.g. db = 
DAL('sqlite://storage.sqlite),  other tables - db1 = DAL('mysql://root: 
) etc, within the same application/controller/function?
If so, will write up an issue we're having.

TIA

-- 





Re: [web2py] Multiple connections/ databases with same app

2013-01-02 Thread Simon Ashley
Ok then, should this work?
(Version 2.3.2 (2012-12-17 15:03:30) stable, source, nightly build, from 
12/31)

*Connection*
db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
db1 = DAL('mysql://root:www@localhost:3306/xxx', migrate=True, fake_migrate=
False, check_reserved=['common','mysql'])  #www and xxx's have been blanked 
(place markers)

*Model*
db.define_table('luPace',
  Field('Description','string', label='Pace'),
  Field('icon','string', length=100),
  Field('bgcolor','string'),
  Field('fgcolor','string'))

db1.define_table('luStart1',
  Field('Description','string', label='Start'),
  Field('icon','string'),
  Field('bgcolor','string'),
  Field('fgcolor','string'))

*Controller*
def pace():
tablel = SQLFORM.grid(db.luPace)
return locals()

def start():
tablel = SQLFORM.grid(db.luStart1)
return locals()

Execute the following:

*pace ..*

as expected


*start *

Traceback (most recent call last):
 File "C:\web2py15\gluon\restricted.py", line 212, in restricted
 exec ccode in environment
 File "C:/web2py15/applications/test1/controllers/test.py" 
, line 13, 
in 
 File "C:\web2py15\gluon\globals.py", line 193, in 
 self._caller = lambda f: f()
 File "C:/web2py15/applications/test1/controllers/test.py" 
, line 9, 
in start
 tablel = SQLFORM.grid(db.luStart1)
 File "C:\web2py15\gluon\dal.py", line 7255, in __getattr__
 return ogetattr(self, key)
AttributeError: 'DAL' object has no attribute 'luStart1'

*luStart1* works from appadmin


-- 





Re: [web2py] Multiple connections/ databases with same app

2013-01-02 Thread Simon Ashley
Sorry Alec,

I saw that just as posted it and tried to delete it. It came through again 
afterwards. 
This wasn't the issue, just an example returning the same error. 
Solved it ... was in the query=db() statements, which should have been 
changed to query=db1() etc.

Thanks for your reply.


>

-- 





[web2py] Re: cpdb errors

2013-01-06 Thread Simon Ashley
Interesting but encountering similar problems to *backseat *on windows 7 
using the following command from a prompt in web2py root folder: i.e.

c:\web2py> set path=%path%;c:\web2py\gluon
c:\web2py> c:\python27\python scripts\cpdb.py -d gluon -f 
application\app\databases 
-y 'sqlite://storage.sqlite' -Y 
'postgres://postgres:password@localhost:5432/db_target'

It ends up with the attached errors, implying more path issues:


Can anyone suggest windows commands/ path's that may work? 

(Noted the Aptana environment solution, but have a time frame issue. 
Otherwise may have to go back to backseat's solution of individual exports/ 
imports)




On Saturday, May 26, 2012 11:32:20 PM UTC+10, mart wrote:
>
> the first message is expected because of this import:
>
> try:
>
> from gluon import DAL
>
> except ImportError as err:
>
> print('gluon path not found')  
> It wants to assume that that gluon is already loaded as part of the web2py 
> environment (or as part of some other environment, like Aptana for example) 
> and that you already have /gluon in your path (maybe even hard coded). If 
> the gluon path is not set, well, you will get that "gluon path not found" 
> message and the -d option will be expected. Because the -d option is 
> expecting a *relative* path, your cmd line args will look different 
> depending on the environment in which you are running the script. 
>
> Hum... I guess being relative is relative ;) 
>
> So, as an example, if you were to run this cmd from a simple bash shell 
> (outside of any dev environment, or outside of a web2py context), you would 
> simply cd and drill down into .../blabla/.../web2py/scripts/. In which 
> case, your -d option would look like this:
> -d ../gluon.  
>
> I just did this, and it all worked fine:
>
>
> macMart:Documents mart$ cd Aptana\ Studio\ 
> Workspace/_p4/src/web2py/scripts/
>
> macMart:scripts mart$ python cpdb.py -f ../../db_storage -d ../gluon -y 
> sqlite://storage.sqlite -Y sqlite://storage2.sqlite -F ../../db_storage2
>
> gluon path not found<== THIS IS AN EXPECTED MESSAGE
>
> creating tables...
>
> exporting data...
>
> importing data...
>
> done!
>
>
> Hope it helps and that it makes sense!
>
> Mart :)
>
> On Thursday, May 17, 2012 2:00:08 AM UTC-7, backseat wrote:
>>
>> I'm trying to copy a database from Sqlite to MySQL using the cpdb.py 
>> script. In the manual, it states: 
>>
>> cd web2py 
>> python scripts/cpdb.py \ 
>>-f applications/app/databases \ 
>>-y 'sqlite://storage.sqlite' \ 
>>-Y 'postgresql://username:password@hocalhost/mydb' 
>>
>> However, if I do that I get "gluon path not found". The help file 
>> suggests 
>> that I can specify the path to dal.py with -d, but: 
>>
>> python scripts/cpdb.py -d gluon/dal.py -f applications/pytrack2/databases 
>> -y 'sqlite://storage.sqlite' -Y 
>> 'mysql://pytrack2:pytrack2@localhost/pytrack2' 
>> gluon path not found 
>> EXCEPTION: could not set DAL 
>> No module named dal 
>>
>> If I use '-d gluon', it's better but now fails with a MySQL error (which 
>> I 
>> think relates to foreign keys), although it still gives the 'gluon path 
>> not found' error: 
>>
>> $ python scripts/cpdb.py -d gluon -f applications/pytrack2/databases -y 
>> 'sqlite://storage.sqlite' -Y 
>> 'mysql://pytrack2:pytrack2@localhost/pytrack2' 
>> gluon path not found 
>> creating tables... 
>> EXCEPTION: could not make a copy of the database 
>> (1005, u"Can't create table 'pytrack2.t_companies_archive' (errno: 150)") 
>>
>> I'm going to continue by migrating by hand; if I should report this 
>> elsewhere or if you need more details, let me know. 
>> -- 
>> "You can have everything in life you want if you help enough other people 
>> get what they want" - Zig Ziglar. 
>>
>> Who did you help today? 
>>
>

-- 





[web2py] Re: cpdb errors

2013-01-07 Thread Simon Ashley
Thanks Mart, 

That's sort of fixed it, but starting to get additional issues with the 
auth tables. 


Think have seen this before with csv imports and have gotten around by 
deleting suspect areas from the import source files.
(obviously not really an option here, and now wondering if that hack is 
causing a postgres memory leak on import)

-- 





[web2py] Re: cpdb errors

2013-01-07 Thread Simon Ashley
Thanks Mart,

That gives me some clues and a renewed focus. Issue may be with postgres 
(at least the install I had - has been deleted and will be installed). Will 
also try ubuntu environment. Will report back ...


-- 





[web2py] Re: cpdb errors

2013-01-08 Thread Simon Ashley
That's a negative on cache.py. 
It's from a nightly build pulled about 5 days ago.
The csv in question is about 150k records. 
(have pruned it down to a test of 10 records, and they import OK).
Has about 140 fields, quite a few nulls, and have compensated for the 
adapter's postgres decimal precision issue.
(its the largest table in the app, and others appear to import OK)

Still building a u12.10 environment under vmware to test 
(linux skills are rusty but coming back)

-- 





[web2py] Re: Web2Py on AWS Elastic Beanstalk

2013-01-08 Thread Simon Ashley
Isaac, if you do a search on this group, you'll find a bit more info. 
Failing that, we may need to do the same in the next few days  ... 

-- 





[web2py] Re: Ryan Singer at Future of Web Apps

2012-01-11 Thread Simon Ashley
Interesting ...

We are working on a rewrite of an existing system from another
environment.
(50 tables, 200 screens and reports)

Like paper sketches, they always work well.

Using (trialing) Enterprise Architect (EA)  and using that to setup table and user
interactions.
(as well as providing project documentation and a framework to
communicate with the client).

Part of today's job is to write a parser to convert an EA generated
PostgreSQL DLL to a Web2py model including constraints from external
keys.
Next are some simple (smartgrid) controllers and menus from EA's
reports.

So far, so good.


On Jan 12, 6:45 am, Bruno Rocha  wrote:
> Very nice presentation! 
>
> http://vimeo.com/15772341
>   [image: Ryan Singer at Future of Web Apps, London
> 2010]
>
> *Ryan Singer at Future of Web Apps, London 2010*http://vimeo.com/15772341
>
> *About this video:*
> "Here's a talk I gave at Future of Web Apps 2010 in London. In this talk, I
> walk through the steps of creating a web app including modeling, sketching,
> HTML, Photoshop explorations, and moving from static mockups to live
> running code. Each step is illustrated with a real example, including some
> live sketching and live HTML. I also wanted to give a sense of how we think
> about apps at 37signals, as a stack of different levels that we can iterate
> on individually."
>
> In the case they are using Rails, but it is completelly perfect to fit with
> web2py!
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]


[web2py] Postgres unknown reference field type

2012-01-18 Thread Simon Ashley
Moving from SQLite to Postgres and when running Database
Administration we're getting unknown field type errors when using a db
reference i.e. Field('Client', db.Client)
Any advice or work arounds?

TIA,

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 204, in restricted
exec ccode in environment
  File "C:/web2py/applications/OAS/models/oa.py", line 358, in

Field('Interpretation_Type', db.Interpretation_Type))
  File "C:\web2py\gluon\dal.py", line 5114, in define_table
polymodel=polymodel)
  File "C:\web2py\gluon\dal.py", line 624, in create_table
(field.type, field.name)
SyntaxError: Field: unknown field type: db.Client for Client

Code listing:
  precision, scale = map(int,field.type[8:-1].split(','))
ftype = self.types[field.type[:7]] % \
dict(precision=precision,scale=scale)
elif not field.type in self.types:
raise SyntaxError, 'Field: unknown field type: %s for
%s' % \
(field.type, field.name)

Model:
  db.define_table('Client',
  Field('Company', 'string'),
  Field('Address', 'string'),
  Field('Town', 'string'),
  Field('State', 'string'),
  Field('Zip', 'string'),
  Field('Activity', 'integer'),
  Field('Account', 'integer'),
  format='%(Company)s')

  db.define_table('Contact',
  Field('Client', db.Client),
  Field('Surname', 'string'),
  Field('First_Name', 'string'),
  Field('Position', 'string'),
  Field('Department', 'string'),
  Field('eMail', 'string'),
  Field('Mobile', 'string'),
  Field('Phone', 'string'),
  Field('Fax', 'string'),
  format='%(Surname)s - %(First_Name)s')

Environment:
  Windows 7 64bit
  Current Postgresql (64bit) with psycopy2
  web2py source from trunk: (1, 99, 4, datetime.datetime(2011, 12, 31,
4, 51, 15), 'stable')
  Python 2.7.2: C:\Python27\python.exe




[web2py] Re: Postgres unknown reference field type

2012-01-19 Thread Simon Ashley
Fixed.

+1 to Massimo although it wasn't this error, but one lower down in the
list.
First error was failure to add a 'requires' constraint to pair with
the db.Client.

Thanks, was too tired to spot these.


On Jan 19, 1:58 pm, Massimo Di Pierro 
wrote:
> from the error looks like you have
>
> Field('Client', 'db.Client'),
>
> instead of
>
> Field('Client', db.Client),
>
> is that possible?
>
> On Jan 18, 6:25 pm, Simon Ashley  wrote:
>
>
>
>
>
>
>
> > Moving from SQLite to Postgres and when running Database
> > Administration we're getting unknown field type errors when using a db
> > reference i.e. Field('Client', db.Client)
> > Any advice or work arounds?
>
> > TIA,
>
> > Traceback (most recent call last):
> >   File "C:\web2py\gluon\restricted.py", line 204, in restricted
> >     exec ccode in environment
> >   File "C:/web2py/applications/OAS/models/oa.py", line 358, in
> > 
> >     Field('Interpretation_Type', db.Interpretation_Type))
> >   File "C:\web2py\gluon\dal.py", line 5114, in define_table
> >     polymodel=polymodel)
> >   File "C:\web2py\gluon\dal.py", line 624, in create_table
> >     (field.type, field.name)
> > SyntaxError: Field: unknown field type: db.Client for Client
>
> > Code listing:
> >               precision, scale = map(int,field.type[8:-1].split(','))
> >                 ftype = self.types[field.type[:7]] % \
> >                     dict(precision=precision,scale=scale)
> >             elif not field.type in self.types:
> >                 raise SyntaxError, 'Field: unknown field type: %s for
> > %s' % \
> >                     (field.type, field.name)
>
> > Model:
> >   db.define_table('Client',
> >       Field('Company', 'string'),
> >       Field('Address', 'string'),
> >       Field('Town', 'string'),
> >       Field('State', 'string'),
> >       Field('Zip', 'string'),
> >       Field('Activity', 'integer'),
> >       Field('Account', 'integer'),
> >       format='%(Company)s')
>
> >   db.define_table('Contact',
> >       Field('Client', db.Client),
> >       Field('Surname', 'string'),
> >       Field('First_Name', 'string'),
> >       Field('Position', 'string'),
> >       Field('Department', 'string'),
> >       Field('eMail', 'string'),
> >       Field('Mobile', 'string'),
> >       Field('Phone', 'string'),
> >       Field('Fax', 'string'),
> >       format='%(Surname)s - %(First_Name)s')
>
> > Environment:
> >   Windows 7 64bit
> >   Current Postgresql (64bit) with psycopy2
> >   web2py source from trunk: (1, 99, 4, datetime.datetime(2011, 12, 31,
> > 4, 51, 15), 'stable')
> >   Python 2.7.2: C:\Python27\python.exe


[web2py] Re: SQLFORM.smartgrid query/search don't work for related tables

2012-01-19 Thread Simon Ashley
+1 for a resolution on this.

On Jan 19, 1:20 pm, Jim Steil  wrote:
> Adnan
>
> I did not get this working, but that doesn't mean it has been resolved.
> I've given up on the search that is included in grid/smartgrid and have
> been working on a solution whereby you can override the default behavior
> and provide your own.  I've got a ticket open
> (http://code.google.com/p/web2py/issues/detail?id=523) and am just
> waiting for Massimo to look it over and get it in trunk.
>
> I've been using my mod'd sqlhtml.py for some time and it is working
> really well for me.  I'm hoping my mod can get into trunk.  If it does I
> will then write up a little demo of how it all works.  It is really
> quite simple then to provide your own search capabilities with the
> ability to easily customize it for different pages.
>
>      -Jim
>
> On 1/18/2012 1:59 PM, Adi wrote:
>
> > Hi Jim,
> > Did you get this working, since I too don't see the referenced field
> > in a query?
>
> > Thanks,
> > Adnan
>
> > No virus found in this message.
> > Checked by AVG -www.avg.com
> > Version: 2012.0.1901 / Virus Database: 2109/4752 - Release Date: 01/18/12
>
> --
> Jim Steil
> VP of Information Technology
> Quality Liquid Feeds, 
> Inc.608.935.2345begin_of_the_skype_highlighting608.935.2345  office608.341.9896begin_of_the_skype_highlighting608.341.9896  cell


[web2py] Rackspace install.

2012-01-20 Thread Simon Ashley
Have totally run out of time, and have posted on expect4solutions a
job for someone to complete an install/ fresh install on rackspace.
Postgres / apache (or equivalent).
Need a turnaround in the next 36 hours as required for Monday.
Contact me privately.

TIA,


[web2py] Re: Rackspace install.

2012-01-20 Thread Simon Ashley
Thanks, the job has been let and is under way ...

On Jan 20, 8:42 pm, Simon Ashley  wrote:
> Have totally run out of time, and have posted on expect4solutions a
> job for someone to complete an install/ fresh install on rackspace.
> Postgres / apache (or equivalent).
> Need a turnaround in the next 36 hours as required for Monday.
> Contact me privately.
>
> TIA,


[web2py] Re: Web2py cookbook

2012-03-15 Thread Simon Ashley
Its available now on packtpub

On Monday, March 12, 2012 8:27:44 PM UTC+10, bussiere adrien wrote:
>
> Does anyone know when the web2py cookbook will be available please ?
>
> Regards
> Bussiere
>
> "Les nouvelles technologies offrent pleins de nouvelles possibilités,
> pleins de possibilités d'erreurs surtout en fait."
> insurance.aes256 : http://goo.gl/gHyAY
>
>

[web2py] Tree view, Rendering

2012-04-02 Thread Simon Ashley
Pretty new to this and stumbling a little. 
We need to generate a Treeview structure with the bottom node ending with 
some links to other pages (graphs etc)

Have a 7 level deep structure (each level in a different table) with each 
level have a table format simple to the following: 
  db.define_table('node', Field('parent',db.parent), Field('node_name'))
  Tables will be maintained using smartgrid

The intention is to use jsTree or similiar loaded/ rendered from a JSON 
response.
(structure could get big so may need to look at some dynamic loading)

Was wondering if there is some sample code/ app that some one is will to 
share to shed some light on which way to go?
(have looked at sqlabs but that's not giving us the fuller picture)

TIA


[web2py] Re: Tree view, Rendering

2012-04-03 Thread Simon Ashley
Nope, can probably do this as a dict/ json variable. 
Its the linking the to javascript stuff that was causing the concern.
(attempting a dynatree solution)
Could be coming the the realisation that need python plus javascript skills 
to make things work as a replacement for a c/s framework.


On Tuesday, April 3, 2012 4:25:52 PM UTC+10, mart wrote:
>
> do you mean that you are looking to parse a directory structure (7 dirs 
> deep) and dump the results to tables ?
>
> On Monday, April 2, 2012 8:21:12 PM UTC-4, Simon Ashley wrote:
>>
>> Pretty new to this and stumbling a little. 
>> We need to generate a Treeview structure with the bottom node ending with 
>> some links to other pages (graphs etc)
>>
>> Have a 7 level deep structure (each level in a different table) with each 
>> level have a table format simple to the following: 
>>   db.define_table('node', Field('parent',db.parent), Field('node_name'))
>>   Tables will be maintained using smartgrid
>>
>> The intention is to use jsTree or similiar loaded/ rendered from a JSON 
>> response.
>> (structure could get big so may need to look at some dynamic loading)
>>
>> Was wondering if there is some sample code/ app that some one is will to 
>> share to shed some light on which way to go?
>> (have looked at sqlabs but that's not giving us the fuller picture)
>>
>> TIA
>>
>

[web2py] Re: Tree view, Rendering

2012-04-03 Thread Simon Ashley
Have done so, but its more the plumbing of the JSON output that was wanting 
to get right, rather than inserting the result of a query in secondary 
table that would be dropped each time. 
Then there is the issue of lazy loading for more extensive datasets. 
Was hoping for a more canned solution. 
(had been dragging this project out looking for something)

On Wednesday, April 4, 2012 6:52:37 AM UTC+10, Niphlod wrote:
>
> have you looked into http://dev.s-cubism.com/plugin_jstree and 
> http://dev.s-cubism.com/plugin_mptt ?
> I had a requirement similar (4 level nested structure) and ended writing 
> the logic in web2py and using jstree as a ui in the frontend..
> I defintely learned some javascript in the way, but at the time those 
> wonderful plugins didn't exist :P
>
> Il giorno martedì 3 aprile 2012 12:04:05 UTC+2, Simon Ashley ha scritto:
>>
>> Nope, can probably do this as a dict/ json variable. 
>> Its the linking the to javascript stuff that was causing the concern.
>> (attempting a dynatree solution)
>> Could be coming the the realisation that need python plus javascript 
>> skills to make things work as a replacement for a c/s framework.
>>
>>
>> On Tuesday, April 3, 2012 4:25:52 PM UTC+10, mart wrote:
>>>
>>> do you mean that you are looking to parse a directory structure (7 dirs 
>>> deep) and dump the results to tables ?
>>>
>>> On Monday, April 2, 2012 8:21:12 PM UTC-4, Simon Ashley wrote:
>>>>
>>>> Pretty new to this and stumbling a little. 
>>>> We need to generate a Treeview structure with the bottom node ending 
>>>> with some links to other pages (graphs etc)
>>>>
>>>> Have a 7 level deep structure (each level in a different table) with 
>>>> each level have a table format simple to the following: 
>>>>   db.define_table('node', Field('parent',db.parent), Field('node_name'))
>>>>   Tables will be maintained using smartgrid
>>>>
>>>> The intention is to use jsTree or similiar loaded/ rendered from a JSON 
>>>> response.
>>>> (structure could get big so may need to look at some dynamic loading)
>>>>
>>>> Was wondering if there is some sample code/ app that some one is will 
>>>> to share to shed some light on which way to go?
>>>> (have looked at sqlabs but that's not giving us the fuller picture)
>>>>
>>>> TIA
>>>>
>>>
On Wednesday, April 4, 2012 6:52:37 AM UTC+10, Niphlod wrote:
>
> have you looked into http://dev.s-cubism.com/plugin_jstree and 
> http://dev.s-cubism.com/plugin_mptt ?
> I had a requirement similar (4 level nested structure) and ended writing 
> the logic in web2py and using jstree as a ui in the frontend..
> I defintely learned some javascript in the way, but at the time those 
> wonderful plugins didn't exist :P
>
> Il giorno martedì 3 aprile 2012 12:04:05 UTC+2, Simon Ashley ha scritto:
>>
>> Nope, can probably do this as a dict/ json variable. 
>> Its the linking the to javascript stuff that was causing the concern.
>> (attempting a dynatree solution)
>> Could be coming the the realisation that need python plus javascript 
>> skills to make things work as a replacement for a c/s framework.
>>
>>
>> On Tuesday, April 3, 2012 4:25:52 PM UTC+10, mart wrote:
>>>
>>> do you mean that you are looking to parse a directory structure (7 dirs 
>>> deep) and dump the results to tables ?
>>>
>>> On Monday, April 2, 2012 8:21:12 PM UTC-4, Simon Ashley wrote:
>>>>
>>>> Pretty new to this and stumbling a little. 
>>>> We need to generate a Treeview structure with the bottom node ending 
>>>> with some links to other pages (graphs etc)
>>>>
>>>> Have a 7 level deep structure (each level in a different table) with 
>>>> each level have a table format simple to the following: 
>>>>   db.define_table('node', Field('parent',db.parent), Field('node_name'))
>>>>   Tables will be maintained using smartgrid
>>>>
>>>> The intention is to use jsTree or similiar loaded/ rendered from a JSON 
>>>> response.
>>>> (structure could get big so may need to look at some dynamic loading)
>>>>
>>>> Was wondering if there is some sample code/ app that some one is will 
>>>> to share to shed some light on which way to go?
>>>> (have looked at sqlabs but that's not giving us the fuller picture)
>>>>
>>>> TIA
>>>>
>>>

[web2py] SQLFORM.grid representation

2011-09-12 Thread Simon Ashley
Have a Model as follows:

from gluon.tools import Auth
auth=Auth(db)
auth.define_tables()
db.define_table('person',Field('name'),format='%(name)s')
db.define_table('dog',Field('name'),Field('owner',db.person))
db.dog.owner.requires = IS_IN_DB(db, 'person.id', db.person._format)

and a controller:

def index():
  db.dog.id.readable=False
  fields = (db.dog.id, db.dog.name, db.dog.owner)
  table = SQLFORM.grid(db.dog, fields)
  return dict(table=table)

Main issue:
the grid returns the id rather than the name for the owner.
Edit and view both return the name (as expected).
Is there a problem with the model/ controller syntax?

Side issue:
In the controller, fields line, if db.dog.id is left out, the grid
returns an id ticket error.

Traceback (most recent call last):
  File "gluon/restricted.py", line 194, in restricted
  File "C:/web2py/applications/pt2/controllers/dogs.py", line 7, in

  File "gluon/globals.py", line 145, in 
  File "C:/web2py/applications/pt2/controllers/dogs.py", line 4, in
index
  File "gluon/sqlhtml.py", line 1647, in grid
  File "gluon/dal.py", line 3835, in __getitem__
KeyError: 'id'

This occurs with or without the second line (... readable=False)
commented out.
Wanted to show the id in edit and view forms but not in the grid.
Can this be achieved?


[web2py] Re: SQLFORM.grid representation

2011-09-14 Thread Simon Ashley
While it could be a bug, and seems to be similar to another reported
issue:
  http://groups.google.com/group/web2py/browse_thread/thread/aa5fa98a74e9364f#
there has been no formal acknowledgement of it in .grid or .smartgrid,
nor have there been any defect tickets raised.

You can also see it in a screenshot that Bruno Rocha posted recently:
  http://www.diigo.com/item/image/121xl/3iob
It leads me to think that there may be an alternative method,
particularly when 1.99.1. is due shortly.

Cheers,

(apologies if there are a number of similar posts from me.
The first 2 seemed to be accepted, but haven't appeared yet.
This is posted using a different account)

On Sep 14, 12:11 am, Jim Steil  wrote:
> Is it possible that this is a bug?  (I don't have the
> expertise/confidence to say it is definitely a bug).    I duplicated
> your example and can reproduce your results.  But, if I go through
> appadmin and list out my table the owner name does appear.
>
>      -Jim
>
> On 9/12/2011 9:51 PM, Simon Ashley wrote:
>
>
>
>
>
>
>
> > Have a Model as follows:
>
> > from gluon.tools import Auth
> > auth=Auth(db)
> > auth.define_tables()
> > db.define_table('person',Field('name'),format='%(name)s')
> > db.define_table('dog',Field('name'),Field('owner',db.person))
> > db.dog.owner.requires = IS_IN_DB(db, 'person.id', db.person._format)
>
> > and a controller:
>
> > def index():
> >    db.dog.id.readable=False
> >    fields = (db.dog.id, db.dog.name, db.dog.owner)
> >    table = SQLFORM.grid(db.dog, fields)
> >    return dict(table=table)
>
> > Main issue:
> > the grid returns the id rather than the name for the owner.
> > Edit and view both return the name (as expected).
> > Is there a problem with the model/ controller syntax?
>
> > Side issue:
> > In the controller, fields line, if db.dog.id is left out, the grid
> > returns an id ticket error.
>
> > Traceback (most recent call last):
> >    File "gluon/restricted.py", line 194, in restricted
> >    File "C:/web2py/applications/pt2/controllers/dogs.py", line 7, in
> > 
> >    File "gluon/globals.py", line 145, in
> >    File "C:/web2py/applications/pt2/controllers/dogs.py", line 4, in
> > index
> >    File "gluon/sqlhtml.py", line 1647, in grid
> >    File "gluon/dal.py", line 3835, in __getitem__
> > KeyError: 'id'
>
> > This occurs with or without the second line (... readable=False)
> > commented out.
> > Wanted to show the id in edit and view forms but not in the grid.
> > Can this be achieved?


[web2py] Re: SQLFORM.grid representation

2011-09-14 Thread Simon Ashley
While it looks like a bug, it may not be implemented in the new .grid
or .smartgrid.
There is a posting that may imply this
http://groups.google.com/group/web2py/browse_thread/thread/aa5fa98a74e9364f
and certainly in image examples posted by Bruno Rocha
http://www.diigo.com/item/image/121xl/3iob it doesn't look like its
been implemented.
A little it odd seeing that 1.99.1 is due for release shortly.

cheers,


On Sep 14, 12:11 am, Jim Steil  wrote:
> Is it possible that this is a bug?  (I don't have the
> expertise/confidence to say it is definitely a bug).    I duplicated
> your example and can reproduce your results.  But, if I go through
> appadmin and list out my table the owner name does appear.
>
>      -Jim
>
> On 9/12/2011 9:51 PM, Simon Ashley wrote:
>
>
>
>
>
>
>
> > Have a Model as follows:
>
> > from gluon.tools import Auth
> > auth=Auth(db)
> > auth.define_tables()
> > db.define_table('person',Field('name'),format='%(name)s')
> > db.define_table('dog',Field('name'),Field('owner',db.person))
> > db.dog.owner.requires = IS_IN_DB(db, 'person.id', db.person._format)
>
> > and a controller:
>
> > def index():
> >    db.dog.id.readable=False
> >    fields = (db.dog.id, db.dog.name, db.dog.owner)
> >    table = SQLFORM.grid(db.dog, fields)
> >    return dict(table=table)
>
> > Main issue:
> > the grid returns the id rather than the name for the owner.
> > Edit and view both return the name (as expected).
> > Is there a problem with the model/ controller syntax?
>
> > Side issue:
> > In the controller, fields line, if db.dog.id is left out, the grid
> > returns an id ticket error.
>
> > Traceback (most recent call last):
> >    File "gluon/restricted.py", line 194, in restricted
> >    File "C:/web2py/applications/pt2/controllers/dogs.py", line 7, in
> > 
> >    File "gluon/globals.py", line 145, in
> >    File "C:/web2py/applications/pt2/controllers/dogs.py", line 4, in
> > index
> >    File "gluon/sqlhtml.py", line 1647, in grid
> >    File "gluon/dal.py", line 3835, in __getitem__
> > KeyError: 'id'
>
> > This occurs with or without the second line (... readable=False)
> > commented out.
> > Wanted to show the id in edit and view forms but not in the grid.
> > Can this be achieved?


[web2py] Re: SQLFORM.grid representation

2011-09-14 Thread Simon Ashley
Just tried that, but it still returns the Id ..

1. it just returns a ticket if

On Sep 15, 12:57 am, Martín Mulone  wrote:
> Perhaps you want to use columns instead of fields.
>
> replace your controller with this:
>
> def index():
>     columns = ['dog.name', 'dog.owner']
>     table = SQLFORM.grid(db.dog, columns=columns)
>     return dict(table=table)
>
> columns affect the grid column displaying only. Pass to column the field you
> want to display, no need to put readable=False.
>
> 2011/9/14 Simon Ashley 
>
>
>
>
>
>
>
>
>
> > While it could be a bug, and seems to be similar to another reported
> > issue:
>
> >http://groups.google.com/group/web2py/browse_thread/thread/aa5fa98a74...
> > there has been no formal acknowledgement of it in .grid or .smartgrid,
> > nor have there been any defect tickets raised.
>
> > You can also see it in a screenshot that Bruno Rocha posted recently:
> >  http://www.diigo.com/item/image/121xl/3iob
> > It leads me to think that there may be an alternative method,
> > particularly when 1.99.1. is due shortly.
>
> > Cheers,
>
> > (apologies if there are a number of similar posts from me.
> > The first 2 seemed to be accepted, but haven't appeared yet.
> > This is posted using a different account)
>
> > On Sep 14, 12:11 am, Jim Steil  wrote:
> > > Is it possible that this is a bug?  (I don't have the
> > > expertise/confidence to say it is definitely a bug).    I duplicated
> > > your example and can reproduce your results.  But, if I go through
> > > appadmin and list out my table the owner name does appear.
>
> > >      -Jim
>
> > > On 9/12/2011 9:51 PM, Simon Ashley wrote:
>
> > > > Have a Model as follows:
>
> > > > from gluon.tools import Auth
> > > > auth=Auth(db)
> > > > auth.define_tables()
> > > > db.define_table('person',Field('name'),format='%(name)s')
> > > > db.define_table('dog',Field('name'),Field('owner',db.person))
> > > > db.dog.owner.requires = IS_IN_DB(db, 'person.id', db.person._format)
>
> > > > and a controller:
>
> > > > def index():
> > > >    db.dog.id.readable=False
> > > >    fields = (db.dog.id, db.dog.name, db.dog.owner)
> > > >    table = SQLFORM.grid(db.dog, fields)
> > > >    return dict(table=table)
>
> > > > Main issue:
> > > > the grid returns the id rather than the name for the owner.
> > > > Edit and view both return the name (as expected).
> > > > Is there a problem with the model/ controller syntax?
>
> > > > Side issue:
> > > > In the controller, fields line, if db.dog.id is left out, the grid
> > > > returns an id ticket error.
>
> > > > Traceback (most recent call last):
> > > >    File "gluon/restricted.py", line 194, in restricted
> > > >    File "C:/web2py/applications/pt2/controllers/dogs.py", line 7, in
> > > > 
> > > >    File "gluon/globals.py", line 145, in
> > > >    File "C:/web2py/applications/pt2/controllers/dogs.py", line 4, in
> > > > index
> > > >    File "gluon/sqlhtml.py", line 1647, in grid
> > > >    File "gluon/dal.py", line 3835, in __getitem__
> > > > KeyError: 'id'
>
> > > > This occurs with or without the second line (... readable=False)
> > > > commented out.
> > > > Wanted to show the id in edit and view forms but not in the grid.
> > > > Can this be achieved?
>
> --
>  http://martin.tecnodoc.com.ar


[web2py] Google App Engine Launcher and Deployment

2011-10-15 Thread Simon Ashley
Just a first time play with this.
  (Environment: Python 25, current Web2Py nightly source {copied to
the Python25 root} and fresh copy of the Google App Engine Launcher)
App is working fine from a command line python25 call
When run from the Launcher -> Browse, is fine with a static page, but
when accessing data, it throws the following:

Traceback (most recent call last):
  File "C:\Python25\gluon\restricted.py", line 194, in restricted
exec ccode in environment
  File "C:/Python25/applications/demurage/views/generic.html", line
98, in 
  File "C:\Python25\gluon\globals.py", line 310, in toolbar
for i in thread.instances]
  File "C:\Python25\lib\_threading_local.py", line 193, in
__getattribute__
return object.__getattribute__(self, name)
AttributeError: 'local' object has no attribute 'instances'

Table is generated in the GAE, data can be imported, but nothing
accessed through the application.

Any ideas?


[web2py] Re: Google App Engine Launcher and Deployment

2011-10-15 Thread Simon Ashley
Thanks. Issue 474.

On Oct 16, 12:47 am, Massimo Di Pierro 
wrote:
> could be a bug in toolbar.  I never tried it in GAE. Open a ticket and
> will fix it asap.
>
> On Oct 15, 2:05 am, Simon Ashley  wrote:
>
>
>
>
>
>
>
> > Just a first time play with this.
> >   (Environment: Python 25, current Web2Py nightly source {copied to
> > the Python25 root} and fresh copy of the Google App Engine Launcher)
> > App is working fine from a command line python25 call
> > When run from the Launcher -> Browse, is fine with a static page, but
> > when accessing data, it throws the following:
>
> > Traceback (most recent call last):
> >   File "C:\Python25\gluon\restricted.py", line 194, in restricted
> >     exec ccode in environment
> >   File "C:/Python25/applications/demurage/views/generic.html", line
> > 98, in 
> >   File "C:\Python25\gluon\globals.py", line 310, in toolbar
> >     for i in thread.instances]
> >   File "C:\Python25\lib\_threading_local.py", line 193, in
> > __getattribute__
> >     return object.__getattribute__(self, name)
> > AttributeError: 'local' object has no attribute 'instances'
>
> > Table is generated in the GAE, data can be imported, but nothing
> > accessed through the application.
>
> > Any ideas?


[web2py] Re: web2py on gae

2011-10-18 Thread Simon Ashley
Are you able to post more details of the errors you get?

Generally it works as expected (but with some caveats on the GAE
side).
We've currently going through that exercise, and noting that there
could issues with SQL cloud which we haven't resolved yet
(i.e. runs nosql OK but not mysql)

On Oct 19, 4:38 am, Minocha  wrote:
> I am a beginner and  have been trying to build an app using web2py.
> I have also read the posts related to the uploading of the app.
>
> The things i have done -
> build a general app
> update the app.yaml file in web2py/applications/[application_name]/
>
> But still when i run the app on the google local sdk i get an error or
> a caution sign as soon as i click on the "run" button
>
> P.S - mdipierro  - please check and re-upload a new and better youtube
> video, the video is incomplete 
> -http://www.youtube.com/watch?v=YZTG2IBMXeU&feature=related


[web2py] GAE - SQL cloud connection

2011-10-18 Thread Simon Ashley
Having an issues connecting to the SQL cloud.

Have a simple application which works on SQLite.
Able to deploy to GAE using the following:
  db = DAL('gae')

However if its changed to:
  db = DAL('google:sql://cdmr01:csm/csmcel05',migrate_enabled=True)
  # cdmr01:csm is the sql cloud instance and csmcel05 the GAE
application; which we assume is correct.

It can't create the database failing with the following log:

E 2011-10-19 13:00:14.137
Traceback (most recent call last):
  File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
restricted.py", line 192, in restricted
exec ccode in environment
  File "/base/data/home/apps/s~csmcel05/1.354064527714710096/
applications/demurage/models/db.py", line 16, in 
session.connect(request, response, db=db)
  File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
globals.py", line 425, in connect
migrate=table_migrate,
  File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
dal.py", line 4534, in define_table
polymodel=polymodel)
  File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
dal.py", line 691, in create_table
logfile = self.file_open(table._loggername, 'a')
  File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
dal.py", line 2925, in file_open
return DatabaseStoredFile(self.db,filename,mode)
  File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
dal.py", line 2866, in __init__
self.db.executesql("CREATE TABLE IF NOT EXISTS web2py_filesystem
(path VARCHAR(512), content LONGTEXT, PRIMARY KEY(path) )
ENGINE=InnoDB;")
  File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
dal.py", line 4607, in executesql
self._adapter.execute(query)
  File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
dal.py", line 1339, in execute
return self.log_execute(*a, **b)
  File "/base/data/home/apps/s~csmcel05/1.354064527714710096/gluon/
dal.py", line 1334, in log_execute
ret = self.cursor.execute(*a, **b)
  File "/base/python_runtime/python_lib/versions/1/google/storage/
speckle/python/api/rdbms.py", line 287, in execute
response = self._conn.MakeRequest('Exec', request)
  File "/base/python_runtime/python_lib/versions/1/google/storage/
speckle/python/api/rdbms.py", line 579, in MakeRequest
response = self._MakeRetriableRequest(stub_method, request)
  File "/base/python_runtime/python_lib/versions/1/google/storage/
speckle/python/api/rdbms.py", line 610, in _MakeRetriableRequest
sql_exception.message))
DatabaseError: 1071: Specified key was too long; max key length is 767
bytes

Any ideas or work arounds?
(would be good to have a sample application we know works, if the
issue is with the connection/routes /app configurations)


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-15 Thread Simon Ashley
Since no one has replied for a couple of days, I'll toss my 2 cents
in. Don't how much value this could be, as we just evaluating web2py
and python but in another environment we could have written data in
the normalised records to a temporary record in a denormalised,
virtual table, update and saved this record, and then do selective
updates, insertions and deletions on each normalised record in the
original tables. Not that elegant but ...

On May 13, 9:17 pm, Vineet  wrote:
> pbreit,
> As you say, wherever possible or required, I have already denormalized
> the table-structures.
> Apart from normalization / denormalization issue, in many other forms,
> I need to insert/update/delete records in multiple tables from one
> form.
> (as I mentioned earlier, there will be a mix of insert/update/delete
> of record(s) in different tables.)
>
> Massimo,
> If you too haven't understood what I intend to do with these 5 tables,
> I can elaborate the idea.
> Pl. tell me accordingly.
> The very success of developing my project using web2py hinges on this
> functionality.
>
> ---Vineet
> 
>
> On May 11, 5:17 am, pbreit  wrote:
>
>
>
>
>
>
>
> > Normalizing is not always the best approach. If the database has not yet
> > been designed, perhaps reconsider. I still don't really understand what you
> > are trying to do but 5 small tables might not be necessary.
>
> > I would suggest getting some code working with 2 tables an then go from
> > there.
>
> > Some 
> > options:http://web2py.com/book/default/chapter/07#One-form-for-multiple-table...
>
> > Another approach would to use FORM or SQLFORM.factory and then coding the
> > database updates. You lose some of the Web2py features but it might still be
> > the easiest way to do it.
>
> > But my first suggestion would be to try and simplify what you are intending
> > to do.


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Simon Ashley
Memory tables referred to have no ability to write to disk. Generally
we've used these for report accumulations. You could use a MySQL table
and delete the record at the end (if need be). Crude and there should
be a more pythonic method, but should work.

Define temp table fields as per the following:

1. rec id
2. table1.uid
3. table1.variable
4. table2.uid
5. table2.variable
6. table3.uid
7. table3.variable

Populate the fields before the load. The uids will of course be hidden
on the form but used after the submit in separate database actions.

Zero uid's would trigger inserts, > 0 for deletions where variables
are blank or zero, edits where not. There is a level of programming
involved; Massimo implied that.

In your case, I would be reluctant to denormalise as further
complexity could be cumbersome.
(if not unworkable. Can think of examples in an application that we
are looking at converting that would make anyone's mind spin).

YMMV

On May 16, 1:15 am, Vineet  wrote:
> Simon,
> That is a good idea.
> In fact, almost the same approach is being followed in VFP cursor
> adaptor (the difference being that, data from MySQL tables is
> reproduced in same table structures, i.e cursors).
>
> Here, by virtual table, do you mean to say that we should reproduce
> the data into dictionaries by fetching a dict cursor from MySQLdb?
> (in DABO, they have an excellent concept of bizobj for this task).
>
> I am not asking for exact code, but can you suggest an approach to
> tackle the task?
>
> Dear Massimo & other friends,
> can you pl. suggest something to solve my problem?
>
> Thanks,
> Vineet.
>
> =========
> On May 15, 5:07 pm, Simon Ashley  wrote:
>
>
>
>
>
>
>
> > Since no one has replied for a couple of days, I'll toss my 2 cents
> > in. Don't how much value this could be, as we just evaluating web2py
> > and python but in another environment we could have written data in
> > the normalised records to a temporary record in a denormalised,
> > virtualtable, update and saved this record, and then do selective
> > updates, insertions and deletions on each normalised record in the
> > original tables. Not that elegant but ...
>
> > On May 13, 9:17 pm, Vineet  wrote:
>
> > > pbreit,
> > > As you say, wherever possible or required, I have already denormalized
> > > thetable-structures.
> > > Apart from normalization / denormalization issue, in many other forms,
> > > I need to insert/update/delete records inmultipletables from one
> > > form.
> > > (as I mentioned earlier, there will be a mix of insert/update/delete
> > > of record(s) in different tables.)
>
> > > Massimo,
> > > If you too haven't understood what I intend to do with these 5 tables,
> > > I can elaborate the idea.
> > > Pl. tell me accordingly.
> > > The very success of developing my project using web2py hinges on this
> > > functionality.
>
> > > ---Vineet
> > > 
>
> > > On May 11, 5:17 am, pbreit  wrote:
>
> > > > Normalizing is not always the best approach. If the database has not yet
> > > > been designed, perhaps reconsider. I still don't really understand what 
> > > > you
> > > > are trying to do but 5 small tables might not be necessary.
>
> > > > I would suggest getting some code working with 2 tables an then go from
> > > > there.
>
> > > > Some 
> > > > options:http://web2py.com/book/default/chapter/07#One-form-for-multiple-table...
>
> > > > Another approach would to use FORM or SQLFORM.factory and then coding 
> > > > the
> > > > database updates. You lose some of the Web2py features but it might 
> > > > still be
> > > > the easiest way to do it.
>
> > > > But my first suggestion would be to try and simplify what you are 
> > > > intending
> > > > to do.


[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Simon Ashley
Vineet,

Agreed, the temp file should be in the DAL.
I don't see at this stage why it would be break the logic.

On May 17, 5:47 am, Vineet  wrote:
> Simon,
> I thought on the idea of adding a MySQL temp table to manage insert/
> del/update on multiple tables.
> But there would be a large no. of such forms requiring this
> functionality.
> It is better to avoid fiddling with the schema (which is the database-
> tier) for the sake of business-logic tier.
>
> What if I add a temporary table in DAL itself (along with the other
> linked tables)?
> Would it break the web2py logic of generating, validating, and saving
> the form (if this table is used for generating the form)?
> I mean, if a form is generated from such a temp DAL table, whether it
> is possible to save data in multiple different tables.
>
> ---Vineet
> ========
>
> On May 16, 4:33 pm, Simon Ashley  wrote:
>
>
>
>
>
>
>
> > Memory tables referred to have no ability to write to disk. Generally
> > we've used these for report accumulations. You could use a MySQL table
> > and delete the record at the end (if need be). Crude and there should
> > be a more pythonic method, but should work.
>
> > Define temp table fields as per the following:
>
> > 1. rec id
> > 2. table1.uid
> > 3. table1.variable
> > 4. table2.uid
> > 5. table2.variable
> > 6. table3.uid
> > 7. table3.variable
>
> > Populate the fields before the load. The uids will of course be hidden
> > on the form but used after the submit in separate database actions.
>
> > Zero uid's would trigger inserts, > 0 for deletions where variables
> > are blank or zero, edits where not. There is a level of programming
> > involved; Massimo implied that.
>
> > In your case, I would be reluctant to denormalise as further
> > complexity could be cumbersome.
> > (if not unworkable. Can think of examples in an application that we
> > are looking at converting that would make anyone's mind spin).
>
> > YMMV
>
> > On May 16, 1:15 am, Vineet  wrote:
>
> > > Simon,
> > > That is a good idea.
> > > In fact, almost the same approach is being followed in VFP cursor
> > > adaptor (the difference being that, data from MySQL tables is
> > > reproduced in same table structures, i.e cursors).
>
> > > Here, by virtual table, do you mean to say that we should reproduce
> > > the data into dictionaries by fetching a dict cursor from MySQLdb?
> > > (in DABO, they have an excellent concept of bizobj for this task).
>
> > > I am not asking for exact code, but can you suggest an approach to
> > > tackle the task?
>
> > > Dear Massimo & other friends,
> > > can you pl. suggest something to solve my problem?
>
> > > Thanks,
> > > Vineet.
>
> > > =
> > > On May 15, 5:07 pm, Simon Ashley  wrote:
>
> > > > Since no one has replied for a couple of days, I'll toss my 2 cents
> > > > in. Don't how much value this could be, as we just evaluating web2py
> > > > and python but in another environment we could have written data in
> > > > the normalised records to a temporary record in a denormalised,
> > > > virtualtable, update and saved this record, and then do selective
> > > > updates, insertions and deletions on each normalised record in the
> > > > original tables. Not that elegant but ...
>
> > > > On May 13, 9:17 pm, Vineet  wrote:
>
> > > > > pbreit,
> > > > > As you say, wherever possible or required, I have already denormalized
> > > > > thetable-structures.
> > > > > Apart from normalization / denormalization issue, in many other forms,
> > > > > I need to insert/update/delete records inmultipletables from one
> > > > > form.
> > > > > (as I mentioned earlier, there will be a mix of insert/update/delete
> > > > > of record(s) in different tables.)
>
> > > > > Massimo,
> > > > > If you too haven't understood what I intend to do with these 5 tables,
> > > > > I can elaborate the idea.
> > > > > Pl. tell me accordingly.
> > > > > The very success of developing my project using web2py hinges on this
> > > > > functionality.
>
> > > > > ---Vineet
> > > > > 
>
> > > > > On May 11, 5:17 am,

[web2py] Re: Multiple tables: update/insert/delete: in one form

2011-05-16 Thread Simon Ashley
Vineet,

We're doing the same in a different client server environment.
Lots of business logic, 700+ tables, 10,000+ tasks to translate.
We intend writing a high level tool as a web2py code generator, that
will serve as a gateway between the 2.
However we're probably at a lower level on the learning curve.

On May 17, 6:09 am, Vineet  wrote:
> Villas,
> Let me give a little background.
> I have this entire massive application successfully running at client-
> sites in Microsoft Visual FoxPro.
> I have decided to shift from licensed platform to open-source
> platform.
> Chose Python for programming language & web2py for framework.
>
> My present task is not to define the app from scratch.
> Because the database-logic, business logic, UI is already there.
> I am trying to port the existing app to Python web framework.
>
> I am encouraged by your saying that ---
> "Web2py has all the ingredients you need to split a big horrible job
> in
> smaller easier ones.  It is extremely flexible for specifying queries
> depending on your 'decision-tree'. "
>
> Pl. help me solve my said issue in 'web2py'.
>
> --Vineet
> =


[web2py] Scheduler - calling functions outside a model?

2013-05-04 Thread Simon Ashley
Have a query on the scheduler and whether functions need to be defined 
inside a model or can be offload to a controller?

(have seen a passing comment by Niphlod - which I can no longer find - that 
it may not be the case with ComfortScheduler but haven't been able to 
confirm it or worked out how to do it). 

Have a job that requires extensive parsing and file transformations. For 
performance reasons wouldn't like these extensive routines (estimated at 4 
-5k lines) being loaded each time a task is fetched.

TIA

-- 

--- 
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: Scheduler - calling functions outside a model?

2013-05-04 Thread Simon Ashley
Thanks Niphlod ..

1. yes - a 'controller function" scheduled as a task.
2. routines are in controllers, rather than modules. (some calculations/ 
transforms may change regularly)

On Sunday, 5 May 2013 00:25:30 UTC+10, Niphlod wrote:
>
> I'm not sure I understood your requirements... how can a "controller" 
> function can be scheduled as a task?
> On the last comma you talk about extensive routines: aren't they in a 
> module ?
>
> On Saturday, May 4, 2013 4:12:21 PM UTC+2, Simon Ashley wrote:
>>
>> Have a query on the scheduler and whether functions need to be defined 
>> inside a model or can be offload to a controller?
>>
>> (have seen a passing comment by Niphlod - which I can no longer find - 
>> that it may not be the case with ComfortScheduler but haven't been able to 
>> confirm it or worked out how to do it). 
>>
>> Have a job that requires extensive parsing and file transformations. For 
>> performance reasons wouldn't like these extensive routines (estimated at 4 
>> -5k lines) being loaded each time a task is fetched.
>>
>> TIA
>>
>

-- 

--- 
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: Scheduler - calling functions outside a model?

2013-05-05 Thread Simon Ashley
Extending on from my earlier reply, (which hasn't shown up yet), I think 
what you're suggesting is to store the code as a module, and import it as 
required from a model. Am I correct in assuming that this would have less 
performance impact than storing the code in a model?

-- 

--- 
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: Scheduler - calling functions outside a model?

2013-05-06 Thread Simon Ashley
Went close with the LOAD('controller', 'yourfunction'), but fell at the 
environment when trying to write to the sql.log i.e.

Traceback (most recent call last):
  File "C:\web2py19\gluon\scheduler.py", line 237, in executor
result = dumps(_function(*args, **vars))
  File "applications\xml2\models\scheduler.py", line 31, in p2
LOAD('process1', 'updateFILES')
  File "C:\web2py19\gluon\compileapp.py", line 217, in LOAD
page = run_controller_in(c, f, other_environment)
  File "C:\web2py19\gluon\compileapp.py", line 598, in run_controller_in
restricted(code, environment, filename)
  File "C:\web2py19\gluon\restricted.py", line 225, in restricted
raise RestrictedError(layer, code, output, environment)
RestrictedError:  [Errno 2] No such file or 
directory: 'applications\\xml2\\databases\\sql.log'

-- 

--- 
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: Scheduler - calling functions outside a model?

2013-05-07 Thread Simon Ashley
2.4.6 - stable

-- 

--- 
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: Scheduler - calling functions outside a model?

2013-05-08 Thread Simon Ashley

Thanks Simone,

Turned out to be the following:

  path = os.path.join(request.folder, 'data\\')
- os.chdir(path)
- for files in os.listdir('*.*'):
+ for files in os.listdir(path):

-- 

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