Re: [web2py] Re: creating a shopping cart using session

2012-04-11 Thread Hassan Alnatour
i am trying to work with session like you showed me but still when i add 
somthing it just changes the last element in the session to the element i 
added
>
>  

Re: [web2py] Re: creating a shopping cart using session

2012-04-11 Thread Keith Edmunds
On Wed, 11 Apr 2012 00:11:18 -0700 (PDT), halna...@gardeniatelco.com said:

> i am trying to work with session like you showed me but still when i add 
> somthing it just changes the last element in the session to the element
> i added

Show us the code.
-- 
"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: nice to introduce new button in grid

2012-04-11 Thread stefaan



I really think these buttons should go away in favor of a dropdown menu.
>
>
>> I'm not convinced. A dropdown menu is less intuitive for the end user.
If you only expose a few operations, I think separate buttons are better.




Re: [web2py] Re: SQLFORM.grid pagination

2012-04-11 Thread Keith Edmunds
On Tue, 10 Apr 2012 21:38:15 -0700 (PDT), massimo.dipie...@gmail.com said:

> Please open a ticket about this in google code.

Added: http://code.google.com/p/web2py/issues/detail?id=758

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


Re: [web2py] Re: new feature in trunk: full auditing

2012-04-11 Thread Rakesh Singh
Thanks Massimo. Will do.
I'll test it against Oracle today as well.



On Wednesday, 11 April 2012 06:40:56 UTC+2, Massimo Di Pierro wrote:
>
> This helps a lot. WIll check this asap. To make sure I do not foget and it 
> tracked, plase open an issue in google code.
>
>
> On Tuesday, 10 April 2012 14:12:38 UTC-5, Rakesh Singh wrote:
>>
>> Hi Massimo,
>>
>> Regarding the MySQL error,  re-created the database and started a new app 
>> with auth.signature=True
>>
>> Here is the auth_user creation log on MySQL followed by the insert that 
>> generates the error :
>>
>> CREATE TABLE auth_user(
>> id INT AUTO_INCREMENT NOT NULL,
>> first_name VARCHAR(128),
>> last_name VARCHAR(128),
>> email VARCHAR(255),
>> username VARCHAR(128),
>> password VARCHAR(255),
>> registration_key VARCHAR(255),
>> reset_password_key VARCHAR(255),
>> registration_id VARCHAR(255),
>> is_active CHAR(1),
>> created_on DATETIME,
>> created_by INT, INDEX created_by__idx (created_by), FOREIGN KEY 
>> (created_by) REFERENCES auth_user(id) ON DELETE CASCADE,
>> modified_on DATETIME,
>> modified_by INT, INDEX modified_by__idx (modified_by), FOREIGN KEY 
>> (modified_by) REFERENCES auth_user(id) ON DELETE CASCADE,
>> PRIMARY KEY(id)
>> ) ENGINE=InnoDB CHARACTER SET utf8
>> 3 QueryCOMMIT
>>
>>   
>> INSERT INTO 
>> auth_user(username,first_name,last_name,modified_by,is_active,registration_id,created_by,
>> reset_password_key,created_on,modified_on,password,registration_key,email) 
>>
>> VALUES ('rakesh','Rakesh','Singh',0,'T','',0,'','2012-04-10 
>> 20:47:09','2012-04-10 20:47:09',
>> '0835d7189a6927648202bd9d8a8562a8','','rakeshsingh...@gmail.com')
>> 6 QueryROLLBACK
>>
>> Manually executing the insert returns:
>> ERROR 1452 (23000): Cannot add or update a child row: a foreign key 
>> constraint fails (`web2py_dev`.`auth_user`, CONSTRAINT `auth_user_ibfk_1` 
>> FOREIGN KEY (`created_by`) REFERENCES `auth_user` (`id`) ON DELETE CASCADE)
>>
>>
>> Which makes sense, since the value for created_by (and modified_by) 
>> defaults to 0 and that ID does not exist in auth_user.id
>> Modifying the created_by and modified_by values to NULL allows this 
>> record to be inserted.
>>
>> Thank you for your help once again.
>>
>> Regards,
>>
>> Rakesh
>>
>>
>>
>>
>>
>>
>>
>>
>>
 On Tue, Apr 10, 2012 at 9:33 AM, Massimo Di Pierro <
 massimo.dipie...@gmail.com> wrote:

> Actually I was wrong. this is not the problem. Web2py does the right 
> thing. Is there any way you can look into the mysql logs what is the sql 
> string that causes the problem?
>
>
> On Tuesday, 10 April 2012 08:23:03 UTC-5, Massimo Di Pierro wrote:
>>
>> I figured this out. The table has a self reference and web2py inserts 
>> a zero in it instead of NULL. Works for sqlite but not MySQL.
>> Changing zero with NULL may be treated as a bug fix it will 
>> constitute a minor change of backward compatibility in case you 
>> incorrectly 
>> do 
>>
>> db(db.table.reference_field==**0).select()
>>
>> while the correct thing to do would be 
>>
>> db(~(db.table.reference_field>**0)).select() 
>>
>> I will try fix it and then will ask for comments.
>>
>> On Monday, 9 April 2012 18:29:10 UTC-5, tomt wrote:
>>>
>>> I have declared the table in db.py with auth.signature, and 
>>> uncommented auth.enable_record_versioning(**db), but the _archive 
>>> table isn't created.
>>>  - Tom
>>>
>>> On Monday, April 9, 2012 8:33:18 AM UTC-6, Massimo Di Pierro wrote:

 the signature=True only adds a signature to the auth_* tables so 
 that if a user creates an account for another user or creates a group, 
 you 
 can keep track of who did it.

 The mything_archive table should be created by:

 auth.enable_record_versioning(**db)

 This should be called after the mything table is defined. Does it 
 work?

 On Sunday, 8 April 2012 22:08:47 UTC-5, tomt wrote:
>
> Hi,
> Thanks for your response.  I deleted the database as you suggested 
> and changed signature=False.  The problem did go away and I was able 
> to add 
> users without the error.  
> I then reverted to signature=True.  While subsequent modifications 
> did show the signature, the 'mything_archive' was never created.
>
> - Tom
>
> On Sunday, April 8, 2012 9:04:14 AM UTC-6, Massimo Di Pierro wrote:
>>
>> Can you try again with mysql, delete the database and replace:
>>
>> auth.define_tables(signature=**True)
>> with
>> auth.define_tables(signature=**False)
>>
>> Does the problem does away? It looks like it does not like the 
>> self reference in auth_user. 
>>>

Re: [web2py] Re: creating a shopping cart using session

2012-04-11 Thread Hassan Alnatour

>
> session.cart_items=[{'id':123 ,'qty':1}, {'id':456, 'qty':3}]
> items = session.cart_items
> if request.vars:
> 
> session.cart_items.append({'id':request.vars.id 
> ,'qty':request.vars.qyt})
>
>

and in the view :
add

{{=session.cart_items}}
 


Re: [web2py] Re: Design question. Opinions please

2012-04-11 Thread Johann Spies
On 11 April 2012 02:40, Cliff  wrote:

> I also just realized how to fix this.  All of the tab 2 and tab 3
> interactions get triggered when a field is changed.  But the Ajax call can
> also include the fields from the form on tab 1 and the server side script
> can update them as well.
>
>
>
So what if the customer changed his/her mind and although some information
has been entered  in tab 1 decides to abort the transaction.  If I
understand you correctly then the changes will be recorded anyhow?

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


Re: [web2py] Re: unable to login in web2py through janrain

2012-04-11 Thread Sonu Srivastava
how to register ip on janrain
*Thanks regards,*
*Sonu Kumar Srivastava*
*Trainee*
*8955199189*
*www.zero-group.com* 



On Tue, Apr 10, 2012 at 7:06 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Why are you unable to login? Does it ask you a password? Try replace
> localhost with 127.0.0.1. Did you register this IP with Janrain?
>
> On Tuesday, 10 April 2012 00:28:52 UTC-5, Sonu Srivastava wrote:
>>
>> for using multiple signin i am register with rpxnow.com and create app
>> and use the key in our web2py application bt i m unable to login...plz help
>> me...i use below code for it
>>
>> import os
>> from gluon.contrib.login_methods.**rpx_account import RPXAccount
>> # we disable actions that will be provided by Janrain, not auth
>> auth.settings.actions_disabled = ['register','change_password',**
>> 'request_reset_password']
>> # we read the key frm a file because we want to keep it private
>> api_key =open(os.path.join(request.**folder,'private','janrain_api_**
>> key.txt'),'r').read().strip()
>> # we connect auth to janrain
>> auth.settings.login_form = RPXAccount(request, api_key=api_key,domain='**
>> web2py',
>> url = "http://localhost:8000/%s/**default/user/login"; %
>> request.application)
>>
>


Re: [web2py] Eclipse and autocomplete

2012-04-11 Thread szimszon
That's interesting.

It seems that the order in pythonpath is relevant.

If I put first web2py/gluon than web2py/ in external libs autocomplet is 
not working. If I reverse the order autocomplet is working.
I still have to specify all the request, response... object for code 
analyze...

But if autocomplet works than the following lines give an error:
if 0:
  ...
  from gluon.tools import Auth

Auth: Unresolved import :(

2012. április 10., kedd 22:34:09 UTC+2 időpontban simon a következőt írta:
>
> I have found that aptana does not import packages by reading the __init__ 
> file. So "from gluon import *" fails to define anything. However if you 
> copy gluon.__init__ into ide.py and "from ide.py import *", then it seems 
> to work.
>
> Adding to the pythonpath does not seem to do anything. Also aptana is a 
> little forgetful. One day it recognises all the imports and the next day it 
> has apparently forgotten.
>
>
> On Monday, 9 April 2012 20:04:30 UTC+1, ikdme wrote:
>>
>> Tang, please how do i implement this your suggestion?
>>
>> On Thu, Apr 5, 2012 at 3:54 PM, Xiaofeng Tang wrote:
>>
>>> I use PyDev and add web2py src into "PyDev - PythonPath" to resolve the
>>> incorrect refs and enable autocompletion.
>>>
>>> Alternatively, u could install the path of web2py src into systeml
>>> envirnoment vairable "pythonpath".
>>>
>>> --- on 2012/4/5 22:51:41, Rod Watkins  wrote:
>>> > I know this has been asked before. I don't mean to be an annoyance.
>>> > I've done the searches are read numerous posts about how to handle
>>> > this. But the advice conflicts and I've yet to actually fix the 
>>> problem.
>>> >
>>> > What is the best way to handle imports for eclipse to get autocomplete
>>> > to work properly (as well as rid eclipse of all the incorrect error
>>> > messages?
>>> >
>>> > I rather like having autocomplete functioning since, as a beginner, it
>>> > helps me discover functionality that I might otherwise miss (besides
>>> > saving some typing).
>>> >
>>> > Please accept my thanks in advance for any help on this.
>>> >
>>> > Cordially,
>>> > Rod Watkins
>>>
>>>
>>

Re: [web2py] Eclipse and autocomplete

2012-04-11 Thread szimszon
Ok. It works as follow:


   1. I made a soft link to gluon/__init__.py and named it gluon/ide.py
   2. PythonPath / external libraries: first web2py/ than web2py/gluon
   3. Put the following code to my controller:

if 0:
from ide import *
request, session, response, T, cache = current.request, 
current.session,current
.response, current.t, current.cache
from tools import Auth, Service, Crud
db = DAL()
auth = Auth()
service = Service()
crud = Crud()

Can something be missing but that code now can be extended as requires.

I have code completion and I got only 1 warning because the *from ide import
* unused in wild import...

Something for debugging. If breakpoints are not working try to put in the 
code:
import pydevd;pydevd.settrace()

It should stop the execution... If web2py is running in debugging mode. :)

Have a nice day!

2012. április 11., szerda 10:15:33 UTC+2 időpontban szimszon a következőt 
írta:
>
> That's interesting.
>
> It seems that the order in pythonpath is relevant.
>
> If I put first web2py/gluon than web2py/ in external libs autocomplet is 
> not working. If I reverse the order autocomplet is working.
> I still have to specify all the request, response... object for code 
> analyze...
>
> But if autocomplet works than the following lines give an error:
> if 0:
>   ...
>   from gluon.tools import Auth
>
> Auth: Unresolved import :(
>
> 2012. április 10., kedd 22:34:09 UTC+2 időpontban simon a következőt írta:
>>
>> I have found that aptana does not import packages by reading the __init__ 
>> file. So "from gluon import *" fails to define anything. However if you 
>> copy gluon.__init__ into ide.py and "from ide.py import *", then it seems 
>> to work.
>>
>> Adding to the pythonpath does not seem to do anything. Also aptana is a 
>> little forgetful. One day it recognises all the imports and the next day it 
>> has apparently forgotten.
>>
>>
>> On Monday, 9 April 2012 20:04:30 UTC+1, ikdme wrote:
>>>
>>> Tang, please how do i implement this your suggestion?
>>>
>>> On Thu, Apr 5, 2012 at 3:54 PM, Xiaofeng Tang wrote:
>>>
 I use PyDev and add web2py src into "PyDev - PythonPath" to resolve the
 incorrect refs and enable autocompletion.

 Alternatively, u could install the path of web2py src into systeml
 envirnoment vairable "pythonpath".

 --- on 2012/4/5 22:51:41, Rod Watkins  wrote:
 > I know this has been asked before. I don't mean to be an annoyance.
 > I've done the searches are read numerous posts about how to handle
 > this. But the advice conflicts and I've yet to actually fix the 
 problem.
 >
 > What is the best way to handle imports for eclipse to get autocomplete
 > to work properly (as well as rid eclipse of all the incorrect error
 > messages?
 >
 > I rather like having autocomplete functioning since, as a beginner, it
 > helps me discover functionality that I might otherwise miss (besides
 > saving some typing).
 >
 > Please accept my thanks in advance for any help on this.
 >
 > Cordially,
 > Rod Watkins


>>>

[web2py] Re: Memory leak with import_from_csv_file in loop

2012-04-11 Thread Łukasz Adamczewski
Linux3.0.0-17-generic #30-Ubuntu SMP Thu Mar 8 20:45:39 UTC 2012 x86_64 
x86_64 x86_64 GNU/Linux

Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
[GCC 4.6.1] on linux2


I used gae tasks as alternative to loops so i create task for each file 
import. I don't know if it will cause the same result on gae but on local 
env memory after task execution was not released for web2py server process.

def csv_import():

imp = db[request.vars.table].import_from_csv_file
file = open(request.vars.filename, 'r')

imp(file)
db._timings = []
file.close()

return True

def tasks():

path = os.path.join(os.path.join(request.folder,'uploads', 
request.vars.table))
from google.appengine.api import taskqueue

files = os.listdir(path)
for file in files:
taskqueue.add(url = URL(r=request, c='import',f='csv_import', vars 
= {'table': request.vars.table, 'filename': os.path.join(path, file)}), 
method='GET')



return "Tasks added"




W dniu poniedziałek, 9 kwietnia 2012 14:26:36 UTC+2 użytkownik Massimo Di 
Pierro napisał:
>
> What os? what python version?
>
> On Sunday, 8 April 2012 16:08:00 UTC-5, Czeski wrote:
>>
>> Hi,
>>
>> I am new web2py user and I have some performance problems with 
>> import_from_csv_file method. First of all i have big collection of data 
>> that i want to upload to Google App Engine. I splited data into 1000 parts, 
>> each contains csv serialized rows - about 1367 rows per file. I am doing 
>> loop to import each file to database using:
>>
>> def csv_import():
>> 
>> for i in xrange(0, 1000):
>> file = open(os.path.join(request.folder,'private', 'geonames', 
>> 'chunk_' + str(i)), 'r')
>> db.geonames.import_from_csv_file(file)
>> db._timings = []
>> file.close()
>>
>> As You can see it is rather simple method to achieve this. But the main 
>> problem is that every loop iteration is increasing the overall memory usage 
>> for application. It is never stoped and in 10 iteration it used all system 
>> resources and app is terminated.
>>
>> I think that with every iteration some objects related with DAL still 
>> stay in memory and are not collected by gc.
>>
>> Please advise so I could import all 1000 parts with constant memory usage.
>>
>> Best Regards
>> Lucas
>>
>

Re: [web2py] Eclipse and autocomplete

2012-04-11 Thread szimszon
Now I have trouble if I have to import something in the code:

from gluon.tools import Auth

Grrr...


[web2py] Re: Problem in adding janrain

2012-04-11 Thread Roma Asnani


No I am not using janrain.key file. But as i am trying janrain so i should 
create as instead i was working with a different code

import os
from gluon.contrib.login_methods.rpx_account import RPXAccount
# we disable actions that will be provided by Janrain, not auth
auth.settings.actions_disabled = 
['register','change_password','request_reset_password']
# we read the key frm a file because we want to keep it private
api_key 
=open(os.path.join(request.folder,'private','janrain_api_key.txt'),'r').read().strip()
# we connect auth to janrain
auth.settings.login_form = RPXAccount(request, 
api_key=api_key,domain='web2py',
url = "http://localhost:8000/%s/default/user/login"; % 
request.application)

and i had created a file with name janrain_api_key.txt in app/private/ 
folder now in this i added the api key provided by janrain.
After all this i find my application works but it only stucks at login. It 
get sign in redirects to rpxnow page communicates the login information in 
another page graps the permission and come back to my application but still 
at same situation from where it starts. As the user doesn't get logged in. 



On Monday, April 9, 2012 2:17:25 PM UTC+5:30, Roma Asnani wrote:
>
> I am trying to add janrain to my application for open id but it gives 
> error like 
>
> RPXNOW._base_cb(false, "Invalid Parameter: token_url must be an absolute 
> URL");
> that describes i have to write complete URL in my janrain key file but it 
> still is not working. Can anyone help.
>
>

[web2py] Re: Problem in adding janrain

2012-04-11 Thread Roma Asnani

No I am not using janrain.key file. But as i am trying janrain so i should 
create as instead i was working with a different code

import os
from gluon.contrib.login_methods.
rpx_account import RPXAccount
# we disable actions that will be provided by Janrain, not auth
auth.settings.actions_disabled = 
['register','change_password','request_reset_password']
# we read the key frm a file because we want to keep it private
api_key 
=open(os.path.join(request.folder,'private','janrain_api_key.txt'),'r').read().strip()
# we connect auth to janrain
auth.settings.login_form = RPXAccount(request, 
api_key=api_key,domain='web2py',
url = "http://localhost:8000/%s/default/user/login"; % 
request.application)

and i had created a file with name janrain_api_key.txt in app/private/ 
folder now in this i added the api key provided by janrain.
After all this i find my application works but it only stucks at login. It 
get sign in redirects to rpxnow page communicates the login information in 
another page graps the permission and come back to my application but still 
at same situation from where it starts. As the user doesn't get logged in. 


On Monday, April 9, 2012 7:55:49 PM UTC+5:30, Massimo Di Pierro wrote:
>
> How are you using it? are you using youapp/private/janrain.key?
>
> On Monday, 9 April 2012 03:47:25 UTC-5, Roma Asnani wrote:
>>
>> I am trying to add janrain to my application for open id but it gives 
>> error like 
>>
>> RPXNOW._base_cb(false, "Invalid Parameter: token_url must be an absolute 
>> URL");
>> that describes i have to write complete URL in my janrain key file but it 
>> still is not working. Can anyone help.
>>
>>

[web2py] Re: unable to login in web2py through janrain

2012-04-11 Thread Sanjeet Roy
Janrain Engage is a service that provides middleware authentication. You 
can register with Janrain , register a domain (the name 
of your app) and set of URLs you will be using, and they will provide you 
with an API key. 

On Tuesday, April 10, 2012 10:58:52 AM UTC+5:30, Sonu Srivastava wrote:
>
> for using multiple signin i am register with rpxnow.com and create app 
> and use the key in our web2py application bt i m unable to login...plz help 
> me...i use below code for it
>
> import os
> from gluon.contrib.login_methods.rpx_account import RPXAccount
> # we disable actions that will be provided by Janrain, not auth
> auth.settings.actions_disabled = 
> ['register','change_password','request_reset_password']
> # we read the key frm a file because we want to keep it private
> api_key 
> =open(os.path.join(request.folder,'private','janrain_api_key.txt'),'r').read().strip()
> # we connect auth to janrain
> auth.settings.login_form = RPXAccount(request, 
> api_key=api_key,domain='web2py',
> url = "http://localhost:8000/%s/default/user/login"; % 
> request.application)
>


Re: [web2py] Re: unable to login in web2py through janrain

2012-04-11 Thread Sonu Srivastava
Ya...i am already register with janrain and create a application and also
got API Key and i use that API key for my application...

following code i use...

import os
from gluon.contrib.login_methods.rpx_account import RPXAccount
auth.settings.actions_disabled =
['register','change_password','request_reset_password']
api_key
=open(os.path.join(request.folder,'private','janrain_api_key.txt'),'r').read().strip()
auth.settings.login_form = RPXAccount(request,
api_key=api_key,domain='web2py',
url = "http://localhost:8000/%s/default/user/login"; %
request.application)

i am using
localhost in domain whitelist in janrain

when i login from my application than it redirects to rpxnow with key but
again it shows my login page
*Thanks regards,*
*Sonu Kumar Srivastava*
*Trainee*
*8955199189*
*www.zero-group.com* 



On Wed, Apr 11, 2012 at 2:39 PM, Sanjeet Roy wrote:

> Janrain Engage is a service that provides middleware authentication. You
> can register with Janrain , register a domain (the
> name of your app) and set of URLs you will be using, and they will provide
> you with an API key.
>
> On Tuesday, April 10, 2012 10:58:52 AM UTC+5:30, Sonu Srivastava wrote:
>>
>> for using multiple signin i am register with rpxnow.com and create app
>> and use the key in our web2py application bt i m unable to login...plz help
>> me...i use below code for it
>>
>> import os
>> from gluon.contrib.login_methods.**rpx_account import RPXAccount
>> # we disable actions that will be provided by Janrain, not auth
>> auth.settings.actions_disabled = ['register','change_password',**
>> 'request_reset_password']
>> # we read the key frm a file because we want to keep it private
>> api_key =open(os.path.join(request.**folder,'private','janrain_api_**
>> key.txt'),'r').read().strip()
>> # we connect auth to janrain
>> auth.settings.login_form = RPXAccount(request, api_key=api_key,domain='**
>> web2py',
>> url = "http://localhost:8000/%s/**default/user/login"; %
>> request.application)
>>
>


[web2py] default value for upload Fields

2012-04-11 Thread Hassan Alnatour
Dear ALL,

how can i make a default image for a image upload field in db i tried this 
but its not working :

Field('Cover','upload',default="URL('static','images')/no-user-image.gif"),

any ideas ?


[web2py] Downloaded file size differs from the original file size.

2012-04-11 Thread Changju
Hi All,
 
I put a file on the static folder, let say 'testApp/static'. 
And I download the file on static folder, the downloaded file differs from 
the original file in size.
Original file size is 15,227,904 and 15,096,832 for downloaded file.
 
Windows Vista
Version 1.99.7 (2012-04-09 09:21:21) dev
 


[web2py] Re: Downloaded file size differs from the original file size.

2012-04-11 Thread Changju
I compared two files.
the downloaded file was missing from 0x0003 to 0x0004fff0 bytes only.

On Wednesday, April 11, 2012 6:56:22 PM UTC+9, Changju wrote:

> Hi All,
>  
> I put a file on the static folder, let say 'testApp/static'. 
> And I download the file on static folder, the downloaded file differs from 
> the original file in size.
> Original file size is 15,227,904 and 15,096,832 for downloaded file.
>  
> Windows Vista
> Version 1.99.7 (2012-04-09 09:21:21) dev
>  
>


[web2py] Re: unable to login in web2py through janrain

2012-04-11 Thread Sanjeet Roy
Hi Sonu,

Please read this again :-

*register a domain (the name of your app) and set of URLs you will be using*

than use the key and the domain name with this following code it will work 
like charm i allready tried.

from gluon.contrib.login_methods.rpx_account import RPXAccount
auth.settings.actions_disabled=['register','change_password','request_reset_password']
auth.settings.login_form = RPXAccount(request,
api_key='...',
domain='...',
url = "http://localhost:8000/%s/default/user/login"; % request.application)



On Tuesday, April 10, 2012 10:58:52 AM UTC+5:30, Sonu Srivastava wrote:
>
> for using multiple signin i am register with rpxnow.com and create app 
> and use the key in our web2py application bt i m unable to login...plz help 
> me...i use below code for it
>
> import os
> from gluon.contrib.login_methods.rpx_account import RPXAccount
> # we disable actions that will be provided by Janrain, not auth
> auth.settings.actions_disabled = 
> ['register','change_password','request_reset_password']
> # we read the key frm a file because we want to keep it private
> api_key 
> =open(os.path.join(request.folder,'private','janrain_api_key.txt'),'r').read().strip()
> # we connect auth to janrain
> auth.settings.login_form = RPXAccount(request, 
> api_key=api_key,domain='web2py',
> url = "http://localhost:8000/%s/default/user/login"; % 
> request.application)
>


[web2py] reference of table in auth user with drob down menu

2012-04-11 Thread BlueShadow
Hi I like to extend my auth_user tables to include the country and the sex 
of the user.
if I do so byauth.settings.extra_fields['auth_user']= [ 
Field('country', 'reference country'),
 Field('sex', 'reference sex')
]
I dont get a drob down menu like when I do it with normal db tables when I 
try to add requires=IS_IN_DB(db,'db.country') I get an error message for 
the db
Anyone knows what I did wrong?



Re: [web2py] wb2py with existing database

2012-04-11 Thread Manuele Pesenti

Hoping to get some interest...

http://www.web2pyslices.com/slice/show/1491/plugin-lookout

https://github.com/manuelep/plugin_lookout

some new feature added such as possibility to limit data access to some 
user groups and to import data from xls file.


I hope to receive some comment about other useful implementations and 
better coding solutions! ;)


Cheers

Manuele


[web2py] Re: reference of table in auth user with drob down menu

2012-04-11 Thread BlueShadow
for some reason it worked right after I saved it again and reloaded a 
couple times (I only removed a couple comments I didn't fiddle with the 
code. One doesn't need the requires=IS_IN_DB(db,'db.country') 
sry for the trouble.

On Wednesday, April 11, 2012 2:51:37 PM UTC+2, BlueShadow wrote:
>
> Hi I like to extend my auth_user tables to include the country and the sex 
> of the user.
> if I do so byauth.settings.extra_fields['auth_user']= [ 
> Field('country', 'reference country'),
>  Field('sex', 'reference sex')
> ]
> I dont get a drob down menu like when I do it with normal db tables when I 
> try to add requires=IS_IN_DB(db,'db.country') I get an error message for 
> the db
> Anyone knows what I did wrong?
>
>

Re: [web2py] Re: Design question. Opinions please

2012-04-11 Thread Cliff
Good point.

I also realized this morning that this solution doesn't work if the user 
just opens tab 2 without changing anything, then leaves.  There would still 
be unsubmitted work on tab 1.

On Wednesday, April 11, 2012 4:06:24 AM UTC-4, Johann Spies wrote:
>
> On 11 April 2012 02:40, Cliff  wrote:
>
>> I also just realized how to fix this.  All of the tab 2 and tab 3 
>> interactions get triggered when a field is changed.  But the Ajax call can 
>> also include the fields from the form on tab 1 and the server side script 
>> can update them as well.
>>
>>
>>
> So what if the customer changed his/her mind and although some information 
> has been entered  in tab 1 decides to abort the transaction.  If I 
> understand you correctly then the changes will be recorded anyhow?
>
> Regards
> Johann 
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>

[web2py] Re: unordered list and pagination

2012-04-11 Thread Massimo Di Pierro
fields=(db.Organization.name )

should be

fields=(db.Organization.name , ) # <<< 
the commma

or

fields=[db.Organization.name ]

On Wednesday, 11 April 2012 00:37:39 UTC-5, Annet wrote:
>
> Massimo,
>
> Sorry, I clicked the post button, before writing a reply. In the old 
> Google Groups I had the option to remove a post, it seems to no longer be 
> available.
>
> Anyway, line 56 is the first empty line at the end of addressbook.py
>
> When I create an empty controller and just put the following function in 
> it:
>
> # coding: utf8
>
> def index():
> query=(db.Organization.nodeID>2033)
> fields=(db.Organization.name)
> orderby=db.Organization.name
> 
> grid=SQLFORM.grid(query,fields=fields,orderby=orderby,sortable=False,create=False,deletable=False,editable=False,\
> searchable=False,paginate=12)
> return dict(grid=grid)
>
>
> I get this ticket when executing the function:
>
> Traceback (most recent call last):
>   File "/Library/Python/2.5/site-packages/web2py/gluon/restricted.py", line 
> 205, in restricted
> exec ccode in environment
>   File 
> "/Library/Python/2.5/site-packages/web2py/applications/bootstrap/controllers/mock.py"
>  , 
> line 11, in 
>   File "/Library/Python/2.5/site-packages/web2py/gluon/globals.py", line 173, 
> in 
> self._caller = lambda f: f()
>   File 
> "/Library/Python/2.5/site-packages/web2py/applications/bootstrap/controllers/mock.py"
>  , 
> line 8, in index
> searchable=False,paginate=12)
>   File "/Library/Python/2.5/site-packages/web2py/gluon/sqlhtml.py", line 
> 1577, in grid
> if field._tablename in tablenames]
> AttributeError: 'Expression' object has no attribute '_tablename'
>
>
> Kind regards,
>
> Annet
>
>
>

[web2py] Re: Cart handling

2012-04-11 Thread Massimo Di Pierro
This has a shopping cart and credit card processing:

https://github.com/mdipierro/web2py-appliances/tree/master/PosOnlineStore

On Wednesday, 11 April 2012 01:46:55 UTC-5, Khalil KHAMLICHI wrote:
>
> Hi, 
> I m starting work on a new project in which I have to deal with a shopping 
> cart, at first I was pretty confident as web2py can handle such project 
> quite well, but then yesterday while I was on youtube, I came across a 
> project called opencart (php) and it was just *perfect*.
> I was wondering, if I didnt go the from scratch way, what are my options 
> under web2py ? 
> Thanks in advance.
> kh
>


[web2py] Re: new web2py cheatsheet

2012-04-11 Thread rdodev
Excellent! Thx Massimo.

On Monday, April 9, 2012 4:44:22 PM UTC-4, Massimo Di Pierro wrote:
>
> http://dl.dropbox.com/u/18065445/Tmp/web2py_cheatsheet.pdf
>


Re: [web2py] Re: Scaling web2py

2012-04-11 Thread Bruce Wade
Ok so I have read the chapter I think the best option is postgres recursive
queries.

On Tue, Apr 10, 2012 at 10:39 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Yes AntiPattern cover 4 or 5 kind of tree representation, classify them
> depending of usage and gives pros and cons.
>
> I choose Closure table since it was one of the more complet for my case.
> But if parent node is changing frequently it's not the more effecient tree
> antipattern.
>
> Have look it is pretty instructive.
>
> Book contain little more explanation, but there is this slide :
>
>
> http://www.slideshare.net/billkarwin/practical-object-oriented-models-in-sql
>
> Richard
>
>
> On Tue, Apr 10, 2012 at 7:32 AM, stefaan  wrote:
>
>>
>>
>>
>> Well I know the major bottle neck in the site is the binary tree. I am
>>> still trying to figure out how to do this the best and most efficient.
>>>
>>
>> Maybe this could be useful:
>> http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html
>>
>>
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] auth.requires membership hide html

2012-04-11 Thread BlueShadow
Hi I like to hide a couple links on my page if users are not logged in and 
in the group of authors.
I tried the following
in the html page:
{{if auth.requires_membership('Author')==True: =A('new Article' , 
_href=URL(r=request,f='newArticle'))}}
but I only get syntax errors


[web2py] Cookbook recipe for nginx/uwsgi woes

2012-04-11 Thread Johann Spies
I get '*502 Bad Gateway' *errors with the following setup:

/etc/nginx/sites-available/web2py:
server {

lister  80;
server_name $hostname;
location  ~* /(\w+)/static/ {
root  /home/www-data/web2py/applications/;
}
location / {
uwsgi_pass  127.0.0.1:9001;
include uwsgi_params;
}
}

server {
listen  443;
server_name $hostname;
ssl on;
ssl_certificate /etc/nginx/ssl/web2py.crt;
ssl_certificate_key /etc/nginx/ssl/web2py.key;
location / {
uwsgi_pass  127.0.0.1:9001;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $SCHEME;
}
}


and /etc/uwsgi/apps-available/web2py.xml (This file is also in 
/home/www-data/web2py.py as the instructions in the book is not clear on 
where it's location saying at first it should be put in the web2py root and 
later that it should be linked from /etc/uwsgi/apps-available  to 
/etc/uwsgi/apps-enabled)


127.0.0.1:9001
/home/www-data/web2py/

wsgihandler



In /var/log/nginx/error.log I found this:

2012/04/11 15:36:19 [error] 25277#0: *5 upstream prematurely closed 
connection while reading response header from upstream, client: 
146.232.82.145, server: artikel, request: "GET /favicon.ico HTTP/1.1", 
upstream: "uwsgi://127.0.0.1:9001", host: "artikel"


and in /var/log/uwsgi/apps/web2py.log:

Wed Apr 11 15:25:37 2012 - *** Operational MODE: preforking ***
Wed Apr 11 15:25:37 2012 - mounting wsgihandler on /
Wed Apr 11 15:25:37 2012 - *** no app loaded. going in full dynamic mode ***
Wed Apr 11 15:25:37 2012 - *** uWSGI is running in multiple interpreter 
mode ***
Wed Apr 11 15:25:37 2012 - spawned uWSGI master process (pid: 25174)
Wed Apr 11 15:25:37 2012 - spawned uWSGI worker 1 (pid: 25180, cores: 1)
Wed Apr 11 15:25:37 2012 - spawned uWSGI worker 2 (pid: 25181, cores: 1)
Wed Apr 11 15:25:48 2012 - -- unavailable modifier requested: 0 --
Wed Apr 11 15:32:30 2012 - read(): Socket operation on non-socket [proto/
uwsgi.c line 40]
Wed Apr 11 15:32:30 2012 - error parsing request


What am I doing wrong?  If I telnet to localhost port 9001 the 
uwsgi-process seems to listen.

Regards. 

Johann


[web2py] Re: default value for upload Fields

2012-04-11 Thread villas
Maybe should be:
Field('Cover','upload',default=URL('static','images',args=['no-user-image.gif']),



Re: [web2py] Re: Scaling web2py

2012-04-11 Thread Richard Vézina
Recursion is slow because the union... But it may fit yours need better I
don't know.

Richard

On Wed, Apr 11, 2012 at 9:45 AM, Bruce Wade  wrote:

> Ok so I have read the chapter I think the best option is postgres
> recursive queries.
>
> On Tue, Apr 10, 2012 at 10:39 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Yes AntiPattern cover 4 or 5 kind of tree representation, classify them
>> depending of usage and gives pros and cons.
>>
>> I choose Closure table since it was one of the more complet for my case.
>> But if parent node is changing frequently it's not the more effecient tree
>> antipattern.
>>
>> Have look it is pretty instructive.
>>
>> Book contain little more explanation, but there is this slide :
>>
>>
>> http://www.slideshare.net/billkarwin/practical-object-oriented-models-in-sql
>>
>> Richard
>>
>>
>> On Tue, Apr 10, 2012 at 7:32 AM, stefaan  wrote:
>>
>>>
>>>
>>>
>>> Well I know the major bottle neck in the site is the binary tree. I am
 still trying to figure out how to do this the best and most efficient.

>>>
>>> Maybe this could be useful:
>>> http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html
>>>
>>>
>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


Re: [web2py] Re: default value for upload Fields

2012-04-11 Thread hasan alnator
No Villas , i tried it  , its not working ,  now as i know  , the value
that a browse button takes is a path and i tried to pass it a path but
still its not working



On Wed, Apr 11, 2012 at 4:57 PM, villas  wrote:

> Maybe should be:
>
> Field('Cover','upload',default=URL('static','images',args=['no-user-image.gif']),
>
>


Re: [web2py] Cookbook recipe for nginx/uwsgi woes

2012-04-11 Thread Bruno Rocha
Note that in some versions uwsgi files are located at /etc/*uswgi-python*
/apps-available/filename.xml

Which version os Linux and uwsgi are you using?

Here are a working example: https://gist.github.com/2359513


-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] Re: Scaling web2py

2012-04-11 Thread Bruce Wade
Yeah not sure have never used recursion at the database level. However it
seems to be the only option, none of the other options in that chapter fit
my needs.

On Wed, Apr 11, 2012 at 7:05 AM, Richard Vézina  wrote:

> Recursion is slow because the union... But it may fit yours need better I
> don't know.
>
> Richard
>
>
> On Wed, Apr 11, 2012 at 9:45 AM, Bruce Wade  wrote:
>
>> Ok so I have read the chapter I think the best option is postgres
>> recursive queries.
>>
>> On Tue, Apr 10, 2012 at 10:39 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Yes AntiPattern cover 4 or 5 kind of tree representation, classify them
>>> depending of usage and gives pros and cons.
>>>
>>> I choose Closure table since it was one of the more complet for my case.
>>> But if parent node is changing frequently it's not the more effecient tree
>>> antipattern.
>>>
>>> Have look it is pretty instructive.
>>>
>>> Book contain little more explanation, but there is this slide :
>>>
>>>
>>> http://www.slideshare.net/billkarwin/practical-object-oriented-models-in-sql
>>>
>>> Richard
>>>
>>>
>>> On Tue, Apr 10, 2012 at 7:32 AM, stefaan wrote:
>>>



 Well I know the major bottle neck in the site is the binary tree. I am
> still trying to figure out how to do this the best and most efficient.
>

 Maybe this could be useful:
 http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html


>>>
>>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Re: Scaling web2py

2012-04-11 Thread Richard Vézina
I made a lot of that last year... Sometimes it was driving me nuts, needing
to have the same columns for each table in the union... Good naming
convention helps to make thing clearer when you get back to the code...

Note, I would try to make it with web2py first if I were needing to write
those code again.

Richard

On Wed, Apr 11, 2012 at 10:09 AM, Bruce Wade  wrote:

> Yeah not sure have never used recursion at the database level. However it
> seems to be the only option, none of the other options in that chapter fit
> my needs.
>
>
> On Wed, Apr 11, 2012 at 7:05 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Recursion is slow because the union... But it may fit yours need better I
>> don't know.
>>
>> Richard
>>
>>
>> On Wed, Apr 11, 2012 at 9:45 AM, Bruce Wade  wrote:
>>
>>> Ok so I have read the chapter I think the best option is postgres
>>> recursive queries.
>>>
>>> On Tue, Apr 10, 2012 at 10:39 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Yes AntiPattern cover 4 or 5 kind of tree representation, classify them
 depending of usage and gives pros and cons.

 I choose Closure table since it was one of the more complet for my
 case. But if parent node is changing frequently it's not the more effecient
 tree antipattern.

 Have look it is pretty instructive.

 Book contain little more explanation, but there is this slide :


 http://www.slideshare.net/billkarwin/practical-object-oriented-models-in-sql

 Richard


 On Tue, Apr 10, 2012 at 7:32 AM, stefaan wrote:

>
>
>
> Well I know the major bottle neck in the site is the binary tree. I am
>> still trying to figure out how to do this the best and most efficient.
>>
>
> Maybe this could be useful:
> http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html
>
>


>>>
>>>
>>> --
>>> --
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


[web2py] Re: Cookbook recipe for nginx/uwsgi woes

2012-04-11 Thread Johann Spies

On Wednesday, 11 April 2012 15:54:46 UTC+2, Johann Spies wrote:
>
>
> lister  80;
>

That must be 

  listen 80;

 I have corrected it in the configuration file but that did not solve the 
problem.

Regards
Johann


Re: [web2py] auth.requires membership hide html

2012-04-11 Thread Richard Vézina
I think you need to make it with writable=False or readable=False, search
in the book.

You can do something like this at models level :

Field('fielname','fieltype',readable=lambda:
auth.requires_membership('Author'))

So if the lambda return False the field will not be readable in select or
in form.

Richard

On Wed, Apr 11, 2012 at 9:46 AM, BlueShadow  wrote:

> Hi I like to hide a couple links on my page if users are not logged in and
> in the group of authors.
> I tried the following
> in the html page:
> {{if auth.requires_membership('Author')==True: =A('new Article' ,
> _href=URL(r=request,f='newArticle'))}}
> but I only get syntax errors
>


Re: [web2py] Re: Scaling web2py

2012-04-11 Thread Bruce Wade
Yeah probably is I already have it with web2py but it is slow with 20,000
nodes takes around 5-10 seconds to load the results.

On Wed, Apr 11, 2012 at 7:29 AM, Richard Vézina  wrote:

> I made a lot of that last year... Sometimes it was driving me nuts,
> needing to have the same columns for each table in the union... Good naming
> convention helps to make thing clearer when you get back to the code...
>
> Note, I would try to make it with web2py first if I were needing to write
> those code again.
>
> Richard
>
>
> On Wed, Apr 11, 2012 at 10:09 AM, Bruce Wade  wrote:
>
>> Yeah not sure have never used recursion at the database level. However it
>> seems to be the only option, none of the other options in that chapter fit
>> my needs.
>>
>>
>> On Wed, Apr 11, 2012 at 7:05 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Recursion is slow because the union... But it may fit yours need better
>>> I don't know.
>>>
>>> Richard
>>>
>>>
>>> On Wed, Apr 11, 2012 at 9:45 AM, Bruce Wade wrote:
>>>
 Ok so I have read the chapter I think the best option is postgres
 recursive queries.

 On Tue, Apr 10, 2012 at 10:39 AM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> Yes AntiPattern cover 4 or 5 kind of tree representation, classify
> them depending of usage and gives pros and cons.
>
> I choose Closure table since it was one of the more complet for my
> case. But if parent node is changing frequently it's not the more 
> effecient
> tree antipattern.
>
> Have look it is pretty instructive.
>
> Book contain little more explanation, but there is this slide :
>
>
> http://www.slideshare.net/billkarwin/practical-object-oriented-models-in-sql
>
> Richard
>
>
> On Tue, Apr 10, 2012 at 7:32 AM, stefaan wrote:
>
>>
>>
>>
>> Well I know the major bottle neck in the site is the binary tree. I
>>> am still trying to figure out how to do this the best and most 
>>> efficient.
>>>
>>
>> Maybe this could be useful:
>> http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html
>>
>>
>
>


 --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/brucelwade
 http://www.wadecybertech.com
 http://www.fittraineronline.com - Fitness Personal Trainers Online
 http://www.warplydesigned.com


>>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Error in online purchase of web2py pdf 4th edition

2012-04-11 Thread netcode
Hello, 
Please i wanted the pdf of the web2py 4th edition. I already entered 
details of my credit card and I've submitted the details. I received a 
message from my bank saying that I've been debited but on the site, i get 
errors saying my card number was rejected. 

It would be greatly appreciated if this problem is resolved and if my 
e-book can be received urgently. 

Thank You 

Ottih Arinze


Re: [web2py] Re: Scaling web2py

2012-04-11 Thread Richard Vézina
Maybe need some code optimisation... Also I would look at the database
level and make sure you have index on the right columns.

Those links could helps :

http://www.python.org/doc/essays/list2str.html
http://wiki.python.org/moin/PythonSpeed/PerformanceTips#Loops


Richard

On Wed, Apr 11, 2012 at 10:41 AM, Bruce Wade  wrote:

> Yeah probably is I already have it with web2py but it is slow with 20,000
> nodes takes around 5-10 seconds to load the results.
>
>
> On Wed, Apr 11, 2012 at 7:29 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I made a lot of that last year... Sometimes it was driving me nuts,
>> needing to have the same columns for each table in the union... Good naming
>> convention helps to make thing clearer when you get back to the code...
>>
>> Note, I would try to make it with web2py first if I were needing to write
>> those code again.
>>
>> Richard
>>
>>
>> On Wed, Apr 11, 2012 at 10:09 AM, Bruce Wade wrote:
>>
>>> Yeah not sure have never used recursion at the database level. However
>>> it seems to be the only option, none of the other options in that chapter
>>> fit my needs.
>>>
>>>
>>> On Wed, Apr 11, 2012 at 7:05 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Recursion is slow because the union... But it may fit yours need better
 I don't know.

 Richard


 On Wed, Apr 11, 2012 at 9:45 AM, Bruce Wade wrote:

> Ok so I have read the chapter I think the best option is postgres
> recursive queries.
>
> On Tue, Apr 10, 2012 at 10:39 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Yes AntiPattern cover 4 or 5 kind of tree representation, classify
>> them depending of usage and gives pros and cons.
>>
>> I choose Closure table since it was one of the more complet for my
>> case. But if parent node is changing frequently it's not the more 
>> effecient
>> tree antipattern.
>>
>> Have look it is pretty instructive.
>>
>> Book contain little more explanation, but there is this slide :
>>
>>
>> http://www.slideshare.net/billkarwin/practical-object-oriented-models-in-sql
>>
>> Richard
>>
>>
>> On Tue, Apr 10, 2012 at 7:32 AM, stefaan wrote:
>>
>>>
>>>
>>>
>>> Well I know the major bottle neck in the site is the binary tree. I
 am still trying to figure out how to do this the best and most 
 efficient.

>>>
>>> Maybe this could be useful:
>>> http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html
>>>
>>>
>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>

>>>
>>>
>>> --
>>> --
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


Re: [web2py] Re: new web2py cheatsheet

2012-04-11 Thread Bruno Rocha
On Wed, Apr 11, 2012 at 10:37 AM, villas  wrote:

> >> form=SQLFORM.dictform(d)
>
> Is that something new?
>

Yes this is a upcoming feature, it is being discussed on developer list.

basically it can create forms to edit dictionaries and text files.

-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] Cookbook recipe for nginx/uwsgi woes

2012-04-11 Thread Johann Spies
On Wednesday, 11 April 2012 16:08:07 UTC+2, rochacbruno wrote:


Thanks for your reply

Note that in some versions uwsgi files are located at /etc/*uswgi-python*
> /apps-available/filename.xml
>
> Which version os Linux and uwsgi are you using?
>


Debian testing/sid with the uwsgi that come with Debian:  uwsgi  
1.1.2+dfsg-1  

In /etc/ there is only one uwsgi-directory and that is /etc/uwsgi installed 
by the uwsgi-package.



> Here are a working example: https://gist.github.com/2359513
>

I cannot see any serious differences between that configuration and mine 
except for the port,
 the naming of the host, the name of the directory in /etc/ .


Regards
Johann

On Wednesday, 11 April 2012 16:08:07 UTC+2, rochacbruno wrote:
>
> Note that in some versions uwsgi files are located at /etc/*uswgi-python*
> /apps-available/filename.xml
>
> Which version os Linux and uwsgi are you using?
>
> Here are a working example: https://gist.github.com/2359513
>
>
> -- 
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>

[web2py] error in loading web2py source code version in ubuntu 11.10

2012-04-11 Thread praveen krishna
Hii,
   I have downloaded the source code version of web2py from 
http://www.web2py.com/examples/default/download i have unzipped it and 
tried to run the web2py by using the comand  'python web2py.py' but it 
generating following error in terminal 
Traceback (most recent call last):
  File "web2py.py", line 16, in 
import gluon.widget
  File "/home/praveen/web2py/web2py/gluon/widget.py", line 23, in 
import main
  File "/home/praveen/web2py/web2py/gluon/main.py", line 66, in 
create_missing_folders()
  File "/home/praveen/web2py/web2py/gluon/admin.py", line 439, in 
create_missing_folders
os.mkdir(path)
OSError: [Errno 13] Permission denied: '/home/praveen/web2py/web2py/deposit'
  how to resolve it?



[web2py] Meteor web framework

2012-04-11 Thread Francisco Costa


http://www.meteor.com
Meteor is a set of new technologies for building top-quality webapps in a 
fraction of the time, whether you're an expert developer or just getting 
started. 

I think this is something worth checking out


Re: [web2py] error in loading web2py source code version in ubuntu 11.10

2012-04-11 Thread Richard Vézina
Maybe your python version is not fully compatible with web2py, since you
use the installed python version... You should check which version of
python is installed.

import sys
sys.version_info

I ran web2py under (2, 6, 5, 'final', 0) and Ubuntu server LTS with no
problem.


Richard

On Wed, Apr 11, 2012 at 11:06 AM, praveen krishna <
praveenchitne...@gmail.com> wrote:

> Hii,
>I have downloaded the source code version of web2py from
> http://www.web2py.com/examples/default/download i have unzipped it and
> tried to run the web2py by using the comand  'python web2py.py' but it
> generating following error in terminal
> Traceback (most recent call last):
>   File "web2py.py", line 16, in 
> import gluon.widget
>   File "/home/praveen/web2py/web2py/gluon/widget.py", line 23, in 
> import main
>   File "/home/praveen/web2py/web2py/gluon/main.py", line 66, in 
> create_missing_folders()
>   File "/home/praveen/web2py/web2py/gluon/admin.py", line 439, in
> create_missing_folders
> os.mkdir(path)
> OSError: [Errno 13] Permission denied:
> '/home/praveen/web2py/web2py/deposit'
>   how to resolve it?
>
>


Re: [web2py] Re: Cart handling

2012-04-11 Thread Khalil KHAMLICHI
Thanks Massimo.


Re: [web2py] error in loading web2py source code version in ubuntu 11.10

2012-04-11 Thread praveen krishna
I have python 2.7.2 in my system I think its not compatible how to make my
web2py compatible to my python.

On Wed, Apr 11, 2012 at 5:23 PM, Richard Vézina  wrote:

> Maybe your python version is not fully compatible with web2py, since you
> use the installed python version... You should check which version of
> python is installed.
>
> import sys
> sys.version_info
>
> I ran web2py under  (2, 6, 5, 'final', 0) and Ubuntu server LTS with no
> problem.
>
>
> Richard
>
> On Wed, Apr 11, 2012 at 11:06 AM, praveen krishna <
> praveenchitne...@gmail.com> wrote:
>
>> Hii,
>>I have downloaded the source code version of web2py from
>> http://www.web2py.com/examples/default/download i have unzipped it and
>> tried to run the web2py by using the comand  'python web2py.py' but it
>> generating following error in terminal
>> Traceback (most recent call last):
>>   File "web2py.py", line 16, in 
>> import gluon.widget
>>   File "/home/praveen/web2py/web2py/gluon/widget.py", line 23, in 
>> import main
>>   File "/home/praveen/web2py/web2py/gluon/main.py", line 66, in 
>> create_missing_folders()
>>   File "/home/praveen/web2py/web2py/gluon/admin.py", line 439, in
>> create_missing_folders
>> os.mkdir(path)
>> OSError: [Errno 13] Permission denied:
>> '/home/praveen/web2py/web2py/deposit'
>>   how to resolve it?
>>
>>
>


Re: [web2py] error in loading web2py source code version in ubuntu 11.10

2012-04-11 Thread Richard Vézina
Install a lower version of python with synaptic or new package manager and
use python2.X web2py ... (replace X by the python version you pick) to
start web2py.

Richard

On Wed, Apr 11, 2012 at 11:30 AM, praveen krishna <
praveenchitne...@gmail.com> wrote:

> I have python 2.7.2 in my system I think its not compatible how to make my
> web2py compatible to my python.
>
>
> On Wed, Apr 11, 2012 at 5:23 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Maybe your python version is not fully compatible with web2py, since you
>> use the installed python version... You should check which version of
>> python is installed.
>>
>> import sys
>> sys.version_info
>>
>> I ran web2py under  (2, 6, 5, 'final', 0) and Ubuntu server LTS with no
>> problem.
>>
>>
>> Richard
>>
>> On Wed, Apr 11, 2012 at 11:06 AM, praveen krishna <
>> praveenchitne...@gmail.com> wrote:
>>
>>> Hii,
>>>I have downloaded the source code version of web2py from
>>> http://www.web2py.com/examples/default/download i have unzipped it and
>>> tried to run the web2py by using the comand  'python web2py.py' but it
>>> generating following error in terminal
>>> Traceback (most recent call last):
>>>   File "web2py.py", line 16, in 
>>> import gluon.widget
>>>   File "/home/praveen/web2py/web2py/gluon/widget.py", line 23, in
>>> 
>>> import main
>>>   File "/home/praveen/web2py/web2py/gluon/main.py", line 66, in 
>>> create_missing_folders()
>>>   File "/home/praveen/web2py/web2py/gluon/admin.py", line 439, in
>>> create_missing_folders
>>> os.mkdir(path)
>>> OSError: [Errno 13] Permission denied:
>>> '/home/praveen/web2py/web2py/deposit'
>>>   how to resolve it?
>>>
>>>
>>
>


Re: [web2py] error in loading web2py source code version in ubuntu 11.10

2012-04-11 Thread Bruno Rocha
web2py works well with any Python 2.5+

You have permission problem.

Go to your terminal, access the location where web2y folder is and try.

$ sudo chown -R youruser:youruser web2py

or

run web2py with superuser

$ sudo python web2py.py



On Wed, Apr 11, 2012 at 12:30 PM, praveen krishna <
praveenchitne...@gmail.com> wrote:

> I have python 2.7.2 in my system I think its not compatible how to make my
> web2py compatible to my python.
>
>
> On Wed, Apr 11, 2012 at 5:23 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Maybe your python version is not fully compatible with web2py, since you
>> use the installed python version... You should check which version of
>> python is installed.
>>
>> import sys
>> sys.version_info
>>
>> I ran web2py under  (2, 6, 5, 'final', 0) and Ubuntu server LTS with no
>> problem.
>>
>>
>> Richard
>>
>> On Wed, Apr 11, 2012 at 11:06 AM, praveen krishna <
>> praveenchitne...@gmail.com> wrote:
>>
>>> Hii,
>>>I have downloaded the source code version of web2py from
>>> http://www.web2py.com/examples/default/download i have unzipped it and
>>> tried to run the web2py by using the comand  'python web2py.py' but it
>>> generating following error in terminal
>>> Traceback (most recent call last):
>>>   File "web2py.py", line 16, in 
>>> import gluon.widget
>>>   File "/home/praveen/web2py/web2py/gluon/widget.py", line 23, in
>>> 
>>> import main
>>>   File "/home/praveen/web2py/web2py/gluon/main.py", line 66, in 
>>> create_missing_folders()
>>>   File "/home/praveen/web2py/web2py/gluon/admin.py", line 439, in
>>> create_missing_folders
>>> os.mkdir(path)
>>> OSError: [Errno 13] Permission denied:
>>> '/home/praveen/web2py/web2py/deposit'
>>>   how to resolve it?
>>>
>>>
>>
>


-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] error in loading web2py source code version in ubuntu 11.10

2012-04-11 Thread Richard Vézina
Yes Bruno is right I should had seen that I get OSError: [Errno 13]
Permission denied just yesterday...

Did you install web2py with the script in contrib folder? If yes your user
name should be www-data.

Did it works with the built-in dev web server?

Richard

On Wed, Apr 11, 2012 at 11:38 AM, Bruno Rocha  wrote:

> web2py works well with any Python 2.5+
>
> You have permission problem.
>
> Go to your terminal, access the location where web2y folder is and try.
>
> $ sudo chown -R youruser:youruser web2py
>
> or
>
> run web2py with superuser
>
> $ sudo python web2py.py
>
>
>
>
> On Wed, Apr 11, 2012 at 12:30 PM, praveen krishna <
> praveenchitne...@gmail.com> wrote:
>
>> I have python 2.7.2 in my system I think its not compatible how to make
>> my web2py compatible to my python.
>>
>>
>> On Wed, Apr 11, 2012 at 5:23 PM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Maybe your python version is not fully compatible with web2py, since you
>>> use the installed python version... You should check which version of
>>> python is installed.
>>>
>>> import sys
>>> sys.version_info
>>>
>>> I ran web2py under  (2, 6, 5, 'final', 0) and Ubuntu server LTS with no
>>> problem.
>>>
>>>
>>> Richard
>>>
>>> On Wed, Apr 11, 2012 at 11:06 AM, praveen krishna <
>>> praveenchitne...@gmail.com> wrote:
>>>
 Hii,
I have downloaded the source code version of web2py from
 http://www.web2py.com/examples/default/download i have unzipped it and
 tried to run the web2py by using the comand  'python web2py.py' but it
 generating following error in terminal
 Traceback (most recent call last):
   File "web2py.py", line 16, in 
 import gluon.widget
   File "/home/praveen/web2py/web2py/gluon/widget.py", line 23, in
 
 import main
   File "/home/praveen/web2py/web2py/gluon/main.py", line 66, in 
 create_missing_folders()
   File "/home/praveen/web2py/web2py/gluon/admin.py", line 439, in
 create_missing_folders
 os.mkdir(path)
 OSError: [Errno 13] Permission denied:
 '/home/praveen/web2py/web2py/deposit'
   how to resolve it?


>>>
>>
>
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>


[web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-04-11 Thread Gour
On Tue, 7 Feb 2012 15:06:26 -0200
Bruno Rocha  wrote:

Hello,

> I want every one to be able to use it, customize it and deploys, sell
> support, sell as a service. But I want to keep it Open Source (I
> mean, I dont want someone to take the code and release a tool called
> "blablabla" which is not open source)

I've been away from web2py for some time still using Concrete5 CMS (PHP)
and today checked what's new in Django arena - there are few apps which
combine or have nice solutions for general CMS + blog + ecommerce like
Mezzanine, Django-CMS, FeinCMS...

Otoh, I'm aware that it is just question of time when we'd have to move
from PHP to (probably) Python, and considering we prefer web2py project
over Django, we wonder whether Movuca is becoming THE Web2py CMS
platform and whether it provides blog & ecommerce solution along with
general CMS part?


I know that Massimo was talking about web2py CMS priority after 2.0
release, but it was long ago and there is still no 2.0...


Sincerely,
Gour


-- 
As all surrender unto Me, I reward them accordingly. Everyone 
follows My path in all respects, O son of Prthā.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


Re: [web2py] Meteor web framework

2012-04-11 Thread Richard Vézina
The site is pretty unstable, it keeps reloading the page all the time.

Richard

On Wed, Apr 11, 2012 at 11:11 AM, Francisco Costa
wrote:

> http://www.meteor.com
> Meteor is a set of new technologies for building top-quality webapps in a
> fraction of the time, whether you're an expert developer or just getting
> started.
>
> I think this is something worth checking out
>


Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-04-11 Thread Bruno Rocha
Movu.ca is a general purpose CMS with focus on social network features (as
likes, shares, users and connections...)

By now Movu.ca is in Alpha release, there are a lot of work to be done and
some areas to improve, but now it is a nice base to start any development
which needs social+CMS features.

Examples:

You can build e-commerce apps:
http://movu.ca/demo/article/show/16/web2py-shirt

You can build cook recipe website:
http://movu.ca/demo/article/show/14/avocado-tomato-chirashi-sushi

And you can have a general purpose network as www.web2pyslices.com

The only great feature by now is the ability to extend the content types by
the way movu.ca datamodels are developed:
http://movu.ca/demo/article/show/1/how-to-create-content-types-in-movuca-cms

But it needs more! a playable admin interface, an install process, more
themes!

Only needs more contributors!


On Wed, Apr 11, 2012 at 1:02 PM, Gour  wrote:

> On Tue, 7 Feb 2012 15:06:26 -0200
> Bruno Rocha  wrote:
>
> Hello,
>
> > I want every one to be able to use it, customize it and deploys, sell
> > support, sell as a service. But I want to keep it Open Source (I
> > mean, I dont want someone to take the code and release a tool called
> > "blablabla" which is not open source)
>
> I've been away from web2py for some time still using Concrete5 CMS (PHP)
> and today checked what's new in Django arena - there are few apps which
> combine or have nice solutions for general CMS + blog + ecommerce like
> Mezzanine, Django-CMS, FeinCMS...
>
> Otoh, I'm aware that it is just question of time when we'd have to move
> from PHP to (probably) Python, and considering we prefer web2py project
> over Django, we wonder whether Movuca is becoming THE Web2py CMS
> platform and whether it provides blog & ecommerce solution along with
> general CMS part?
>
>
> I know that Massimo was talking about web2py CMS priority after 2.0
> release, but it was long ago and there is still no 2.0...
>
>
> Sincerely,
> Gour
>
>
> --
> As all surrender unto Me, I reward them accordingly. Everyone
> follows My path in all respects, O son of Prthā.
>
> http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
>



-- 

Bruno Rocha
[http://rochacbruno.com.br]


Re: [web2py] Re: Cart handling

2012-04-11 Thread pbreit
There are a lot of pre-made shopping cart solutions, most of them in PHP. 
If you don't want to build your own, then certainly consider an existing 
one (like OpenCart, Magento, CubeCart, ZenCart, etc). I would stay away 
from PosOnlineStore.
>
>

[web2py] Re: auth.requires membership hide html

2012-04-11 Thread Anthony
On Wednesday, April 11, 2012 9:46:21 AM UTC-4, BlueShadow wrote:
>
> Hi I like to hide a couple links on my page if users are not logged in and 
> in the group of authors.
> I tried the following
> in the html page:
> {{if auth.requires_membership('Author')==True: =A('new Article' , 
> _href=URL(r=request,f='newArticle'))}}
> but I only get syntax errors
>

auth.requires_membership() is a function decorator -- you need to use 
auth.has_membership(). Also, move the link to the next line and add a pass 
statement at the end:

{{if auth.has_membership('Author'):}}
{{=A('new Article', _href=URL(r=request, f='newArticle'))}}
{{pass}}

Note, that will only keep the link out of the page -- you still need to 
protect the newArticle() function with the auth.requires_membership() 
decorator.

Anthony


Re: [web2py] error in loading web2py source code version in ubuntu 11.10

2012-04-11 Thread praveen krishna
yes richard i have installed the source version and thanks Burno the
command  sudo python web2py.py is working to run web2py

On Wed, Apr 11, 2012 at 5:53 PM, Richard Vézina  wrote:

> Yes Bruno is right I should had seen that I get OSError: [Errno 13]
> Permission denied just yesterday...
>
> Did you install web2py with the script in contrib folder? If yes your user
> name should be www-data.
>
> Did it works with the built-in dev web server?
>
> Richard
>
>
> On Wed, Apr 11, 2012 at 11:38 AM, Bruno Rocha wrote:
>
>> web2py works well with any Python 2.5+
>>
>> You have permission problem.
>>
>> Go to your terminal, access the location where web2y folder is and try.
>>
>> $ sudo chown -R youruser:youruser web2py
>>
>> or
>>
>> run web2py with superuser
>>
>> $ sudo python web2py.py
>>
>>
>>
>>
>> On Wed, Apr 11, 2012 at 12:30 PM, praveen krishna <
>> praveenchitne...@gmail.com> wrote:
>>
>>> I have python 2.7.2 in my system I think its not compatible how to make
>>> my web2py compatible to my python.
>>>
>>>
>>> On Wed, Apr 11, 2012 at 5:23 PM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Maybe your python version is not fully compatible with web2py, since
 you use the installed python version... You should check which version of
 python is installed.

 import sys
 sys.version_info

 I ran web2py under  (2, 6, 5, 'final', 0) and Ubuntu server LTS with no
 problem.


 Richard

 On Wed, Apr 11, 2012 at 11:06 AM, praveen krishna <
 praveenchitne...@gmail.com> wrote:

> Hii,
>I have downloaded the source code version of web2py from
> http://www.web2py.com/examples/default/download i have unzipped it
> and tried to run the web2py by using the comand  'python web2py.py' but it
> generating following error in terminal
> Traceback (most recent call last):
>   File "web2py.py", line 16, in 
> import gluon.widget
>   File "/home/praveen/web2py/web2py/gluon/widget.py", line 23, in
> 
> import main
>   File "/home/praveen/web2py/web2py/gluon/main.py", line 66, in
> 
> create_missing_folders()
>   File "/home/praveen/web2py/web2py/gluon/admin.py", line 439, in
> create_missing_folders
> os.mkdir(path)
> OSError: [Errno 13] Permission denied:
> '/home/praveen/web2py/web2py/deposit'
>   how to resolve it?
>
>

>>>
>>
>>
>> --
>>
>> Bruno Rocha
>> [http://rochacbruno.com.br]
>>
>>
>


Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-04-11 Thread Gour
On Wed, 11 Apr 2012 13:09:17 -0300
Bruno Rocha  wrote:

> Movu.ca is a general purpose CMS with focus on social network
> features (as likes, shares, users and connections...)

We just need general-purpose CMS without neeed for socila network stuff.

> By now Movu.ca is in Alpha release, there are a lot of work to be
> done and some areas to improve, but now it is a nice base to start
> any development which needs social+CMS features.

Nice.

> You can build e-commerce apps:
> http://movu.ca/demo/article/show/16/web2py-shirt

There is some cart app available to be used?

We do not have big shop 'cause we 'sell' only services (counselling,
homeopathy treatments etc.)

> And you can have a general purpose network as www.web2pyslices.com

Ohh, didn't know it is powered now by Movu.ca.

What about general blog engine with 'standard' features?

> The only great feature by now is the ability to extend the content
> types by the way movu.ca datamodels are developed:
> http://movu.ca/demo/article/show/1/how-to-create-content-types-in-movuca-cms

That's great feature and usign COncrete5, we expect to have many
'blocks' available. :-)

> But it needs more! a playable admin interface, an install process,
> more themes!

/me nods

> Only needs more contributors!

At the moment, I'm in the league of those which can try to use ready
components and put them together with minimal coding/tweaking.

Hopefully, more people will recognize that web2py needs stable
CMS+blog+ecommerce+social_network+.. platform.


Sincerely,
Gour


-- 
One who is not disturbed in mind even amidst the threefold 
miseries or elated when there is happiness, and who is free 
from attachment, fear and anger, is called a sage of steady mind.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


[web2py] Re: Cookbook recipe for nginx/uwsgi woes

2012-04-11 Thread pbreit
Looks like it is having trouble with a file in /static. This is how I serve 
/static:

location /static {
root /opt/web2py/applications/myapp/;
}

You may just need to add the appname to:
root  /home/www-data/web2py/applications/

Also, I don't know if you need that extra stuff on the location line.


[web2py] Re: default value for upload Fields

2012-04-11 Thread Anthony


On Wednesday, April 11, 2012 5:15:51 AM UTC-4, Hassan Alnatour wrote:
>
> Dear ALL,
>
> how can i make a default image for a image upload field in db i tried this 
> but its not working :
>
> Field('Cover','upload',default="URL('static','images')/no-user-image.gif"),
>

I haven't tried it, but maybe:

import os
db.define_table(...,
Field('Cover', 'upload',
  default = lambda: open(os.path.join(request.folder, 'static', 
'images',
 'no-user-image.gif'), 'rb')),
...)

Anthony


[web2py] Add conditional sub-menu

2012-04-11 Thread Omi Chiba
The following menu works. It's add "Admin" menu next to "Price List" if the 
user has role "admin". Now, I want to add the "Admin" menu as sub-menu of 
"Price List" where it's right after the "Cut Charge Tables". How can I do 
this ?

response.menu = [('Home', False, URL('home','default','index'), []),
(SPAN('Price List',_style='color:yellow'), True, 
URL('pricelist','default','index'), 
[('Guideline',  False,  URL('pricelist','default','guideline')),
 ('Multiplier Tables',  False, 
 URL('pricelist','default','multitable')),
 ('Cut Charge Tables',  False,  URL('pricelist','default','cuttable')),
])]

if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
response.menu += [('Admin',  False,  URL('admin')), ]


Re: [web2py] Re: creating a shopping cart using session

2012-04-11 Thread pbreit
I think that should work but I haven't tried it.

What happens if you delete the first line "session.cart_items=..."? That's 
going to keep overwriting cart_items each time the controller is called.

You might have to ensure that cart_items is a list:

items = session.cart_items
if request.vars:
if not session.cart_items:
session.cart_items = []
session.cart_items.append({'id':request.vars.id 
,'qty':request.vars.qyt})

The other thing I'm wondering is if you might need to re-write the list 
each time:

items = session.cart_items or []  
if request.vars:
items.append({'id':request.vars.id ,'qty':request.vars.qyt})
session.cart_items = items



[web2py] Re: Error in online purchase of web2py pdf 4th edition

2012-04-11 Thread Massimo Di Pierro
I emailed you personally about this.

On Wednesday, 11 April 2012 09:44:56 UTC-5, netcode wrote:
>
> Hello, 
> Please i wanted the pdf of the web2py 4th edition. I already entered 
> details of my credit card and I've submitted the details. I received a 
> message from my bank saying that I've been debited but on the site, i get 
> errors saying my card number was rejected. 
>
> It would be greatly appreciated if this problem is resolved and if my 
> e-book can be received urgently. 
>
> Thank You 
>
> Ottih Arinze
>


Re: [web2py] Add conditional sub-menu

2012-04-11 Thread Bruno Rocha
response.menu = [('Home', False, URL('home','default','index'), []),
(SPAN('Price List',_style='color:yellow'), True,
URL('pricelist','default','index'),
[('Guideline',  False,  URL('pricelist','default','guideline')),
 ('Multiplier Tables',  False,
 URL('pricelist','default','multitable')),
 ('Cut Charge Tables',  False,  URL('pricelist','default','cuttable')),
*('Admin',  False,  URL('admin')) if (auth.user_id != None) and
((auth.has_membership(role = 'admin'))) else None*
])]


or

if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
response.menu[1][3] += [('Admin',  False,  URL('admin')), ]


On Wed, Apr 11, 2012 at 1:24 PM, Omi Chiba  wrote:

> response.menu = [('Home', False, URL('home','default','index'), []),
> (SPAN('Price List',_style='color:yellow'), True,
> URL('pricelist','default','index'),
> [('Guideline',  False,  URL('pricelist','default','guideline')),
>  ('Multiplier Tables',  False,
>  URL('pricelist','default','multitable')),
>  ('Cut Charge Tables',  False,  URL('pricelist','default','cuttable')),
> ])]
>



-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Re: new web2py cheatsheet

2012-04-11 Thread Massimo Di Pierro
Try this (requires trunk)

if not session.d: session.d = {'name':'anonymous','age':99,'sports':[]}

def index():
 form=SQLFORM.dictform(d).process()
 if form.accepted: response.flash = 'session.d was updated'
 return locals()
  


On Wednesday, 11 April 2012 08:37:07 UTC-5, villas wrote:
>
> >> form=SQLFORM.dictform(d)
>
> Is that something new?
>


Re: [web2py] Re: Cart handling

2012-04-11 Thread Massimo Di Pierro
I agree posonlinestore does not compare but the shopping chart logic in it 
is fine. It was built as an example not as a fullly developed estore 
application.

On Wednesday, 11 April 2012 11:15:28 UTC-5, pbreit wrote:
>
> There are a lot of pre-made shopping cart solutions, most of them in PHP. 
> If you don't want to build your own, then certainly consider an existing 
> one (like OpenCart, Magento, CubeCart, ZenCart, etc). I would stay away 
> from PosOnlineStore.
>>
>>

[web2py] Re: default value for upload Fields

2012-04-11 Thread Massimo Di Pierro
This comes up once in a while. I will try to make it easy. Anyway:

The problem is if you need a default image, perhaps you do not want to copy 
it for every record the needs it.
The proper way would be to upload it once and the set the default to the 
value of the upload field for that record.

db.define_table('mytable', Field('Cover', 'upload', default='xxx'), ...)

where xxx you would get from running

web2py.py -S yourapp -M -N
>>> import os
>>> print db.mytbale.Cover.store(open(os.path.join(request.folder, 'static',
 'images','no-user-image.gif'),'rb'))

Massimo



On Wednesday, 11 April 2012 11:23:49 UTC-5, Anthony wrote:
>
>
>
> On Wednesday, April 11, 2012 5:15:51 AM UTC-4, Hassan Alnatour wrote:
>>
>> Dear ALL,
>>
>> how can i make a default image for a image upload field in db i tried 
>> this but its not working :
>>
>>
>> Field('Cover','upload',default="URL('static','images')/no-user-image.gif"),
>>
>
> I haven't tried it, but maybe:
>
> import os
> db.define_table(...,
> Field('Cover', 'upload',
>   default = lambda: open(os.path.join(request.folder, 'static', 
> 'images',
>  'no-user-image.gif'), 'rb')),
> ...)
>
> Anthony
>


[web2py] Re: new web2py cheatsheet

2012-04-11 Thread Ross Peoples
This new cheat sheet is great! I saw the one page version, but I agree 
there is too much information to fit on to one page. I'm glad a second page 
was added.

On Monday, April 9, 2012 4:44:22 PM UTC-4, Massimo Di Pierro wrote:
>
> http://dl.dropbox.com/u/18065445/Tmp/web2py_cheatsheet.pdf
>


[web2py] web2py: encrypt uploaded files

2012-04-11 Thread naveed
I need to encrypt uploaded files in web2py (for a HIPAA compliant 
application) preferably with AES. How can I accomplish this?


Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-04-11 Thread Gour
On Wed, 11 Apr 2012 13:09:17 -0300
Bruno Rocha  wrote:

> Movu.ca is a general purpose CMS with focus on social network
> features (as likes, shares, users and connections...)

Tried to install according to:
https://github.com/rochacbruno/Movuca#readme but got error ticket: 

 'NoneType' object has no attribute
'uri'

Traceback (most recent call last):
  File "/home/gour/repos/external/web2py/gluon/restricted.py", line
205, in restricted exec ccode in environment
  File
"/home/gour/repos/external/web2py/applications/demo/controllers/home.py",
line 33, in  File
"/home/gour/repos/external/web2py/gluon/globals.py", line 175, in
 self._caller = lambda f: f() File
"/home/gour/repos/external/web2py/applications/demo/controllers/home.py",
line 17, in index home = Home(['featured', 'featured_members', 'ads'])
File "applications/demo/modules/handlers/base.py", line 30, in __init__
self.start() File "applications/demo/modules/handlers/home.py", line
11, in start self.db = DataBase([User, ContentType, Category, Article,
Ads]) File "applications/demo/modules/movuca.py", line 31, in __init__
DAL.__init__(self, self.config.db.uri, AttributeError: 'NoneType'
object has no attribute 'uri'


Sincerely,
Gour

-- 
O best of the Kuru dynasty, without sacrifice one can never 
live happily on this planet or in this life: what then of the next?

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


[web2py] Re: web2py: encrypt uploaded files

2012-04-11 Thread Massimo Di Pierro
What are the specs? Can you store them in an encrypted file system? can you 
encrypt them with the same password? Should every file be encrypted with a 
different password? Where should the passwords be stored?

On Wednesday, 11 April 2012 11:54:24 UTC-5, naveed wrote:
>
> I need to encrypt uploaded files in web2py (for a HIPAA compliant 
> application) preferably with AES. How can I accomplish this?
>


Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-04-11 Thread Bruno Rocha
have you done it first?

- http://localhost:8000/appname/setup/install

??

It is needed to populate the config db



On Wed, Apr 11, 2012 at 2:07 PM, Gour  wrote:

> On Wed, 11 Apr 2012 13:09:17 -0300
> Bruno Rocha  wrote:
>
> > Movu.ca is a general purpose CMS with focus on social network
> > features (as likes, shares, users and connections...)
>
> Tried to install according to:
> https://github.com/rochacbruno/Movuca#readme but got error ticket:
>
>  'NoneType' object has no attribute
> 'uri'
>
> Traceback (most recent call last):
>  File "/home/gour/repos/external/web2py/gluon/restricted.py", line
> 205, in restricted exec ccode in environment
>  File
> "/home/gour/repos/external/web2py/applications/demo/controllers/home.py",
> line 33, in  File
> "/home/gour/repos/external/web2py/gluon/globals.py", line 175, in
>  self._caller = lambda f: f() File
> "/home/gour/repos/external/web2py/applications/demo/controllers/home.py",
> line 17, in index home = Home(['featured', 'featured_members', 'ads'])
> File "applications/demo/modules/handlers/base.py", line 30, in __init__
> self.start() File "applications/demo/modules/handlers/home.py", line
> 11, in start self.db = DataBase([User, ContentType, Category, Article,
> Ads]) File "applications/demo/modules/movuca.py", line 31, in __init__
> DAL.__init__(self, self.config.db.uri, AttributeError: 'NoneType'
> object has no attribute 'uri'
>
>
> Sincerely,
> Gour
>
> --
> O best of the Kuru dynasty, without sacrifice one can never
> live happily on this planet or in this life: what then of the next?
>
> http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
>



-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Re: Cart handling

2012-04-11 Thread Gour
On Wed, 11 Apr 2012 09:15:28 -0700 (PDT)
pbreit  wrote:

> There are a lot of pre-made shopping cart solutions, most of them in
> PHP. If you don't want to build your own, then certainly consider an
> existing one (like OpenCart, Magento, CubeCart, ZenCart, etc). 

We use Concrete5's own ecommerce and it would be nice to have something
smaller/lighter available for web2py considering that most of the
above-mentioned ones are mostly bloated and/or overkil for simple(r)
needs.


Sincerely,
Gour

-- 
Many, many births both you and I have passed. I can remember 
all of them, but you cannot, O subduer of the enemy!

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-04-11 Thread Gour
On Wed, 11 Apr 2012 14:15:32 -0300
Bruno Rocha  wrote:

> have you done it first?

Opps, forgot it. :-(

Thank you...it works now. ;)


Sincerely,
Gour


-- 
Never was there a time when I did not exist, 
nor you, nor all these kings; nor in the future 
shall any of us cease to be.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


Re: [web2py] Re: web2py: encrypt uploaded files

2012-04-11 Thread Naveed Ahmed
Thanks Massimo for getting back. I can’t use an encrypted file system as when 
the file system is mounted, it’s totally open. Every file can be encrypted with 
the same master password. I’m thinking of storing this master password which is 
itself encrypted using the user’s password (or it’s hash) in the auth_user 
table.

On a related note, I am planning to encrypt some columns of other tables using 
the same master password. Your thoughts on this approach?


From: Massimo Di Pierro 
Sent: Wednesday, April 11, 2012 12.13
To: web2py@googlegroups.com 
Subject: [web2py] Re: web2py: encrypt uploaded files

What are the specs? Can you store them in an encrypted file system? can you 
encrypt them with the same password? Should every file be encrypted with a 
different password? Where should the passwords be stored?

On Wednesday, 11 April 2012 11:54:24 UTC-5, naveed wrote: 
  I need to encrypt uploaded files in web2py (for a HIPAA compliant 
application) preferably with AES. How can I accomplish this?


Re: [web2py] Meteor web framework

2012-04-11 Thread mikech
Looks very interesting!

On Wednesday, April 11, 2012 9:09:04 AM UTC-7, Richard wrote:
>
> The site is pretty unstable, it keeps reloading the page all the time.
>
> Richard
>
> On Wed, Apr 11, 2012 at 11:11 AM, Francisco Costa  wrote:
>
>> http://www.meteor.com
>> Meteor is a set of new technologies for building top-quality webapps in a 
>> fraction of the time, whether you're an expert developer or just getting 
>> started. 
>>
>> I think this is something worth checking out
>>
>
>

[web2py] Re: new web2py cheatsheet

2012-04-11 Thread villas
It looks very interesting and I will try it.   

I see Bruno says that it would also edit text files.  I am sure that could 
be very useful.  In the past,  I often made use of INI files and the 
Windows registry (although maybe that wasn't always such good practice!).

And thanks for this Cheatsheet, it is a great way to 'jog the memory'.

Regards, David


On Wednesday, 11 April 2012 17:37:20 UTC+1, Massimo Di Pierro wrote:
>
> Try this (requires trunk)
>
> if not session.d: session.d = {'name':'anonymous','age':99,'sports':[]}
>
> def index():
>  form=SQLFORM.dictform(d).process()
>  if form.accepted: response.flash = 'session.d was updated'
>  return locals()
>   
>
>
> On Wednesday, 11 April 2012 08:37:07 UTC-5, villas wrote:
>>
>> >> form=SQLFORM.dictform(d)
>>
>> Is that something new?
>>
>

Re: [web2py] Meteor web framework

2012-04-11 Thread Nicolas Palumbo
Looks good!

On Wed, Apr 11, 2012 at 2:35 PM, mikech  wrote:
> Looks very interesting!
>
>
> On Wednesday, April 11, 2012 9:09:04 AM UTC-7, Richard wrote:
>>
>> The site is pretty unstable, it keeps reloading the page all the time.
>>
>> Richard
>>
>> On Wed, Apr 11, 2012 at 11:11 AM, Francisco Costa  wrote:
>>
>>> http://www.meteor.com
>>> Meteor is a set of new technologies for building top-quality webapps in a
>>> fraction of the time, whether you're an expert developer or just getting
>>> started.
>>>
>>> I think this is something worth checking out
>>
>>
>


Re: [web2py] Re: web2py: encrypt uploaded files

2012-04-11 Thread Massimo Di Pierro
Perhaps this can be useful:
http://stackoverflow.com/questions/6309958/encrypting-a-file-with-rsa-in-python
(look at code in first answer)

On Wednesday, 11 April 2012 12:35:05 UTC-5, naveed wrote:
>
>   Thanks Massimo for getting back. I can’t use an encrypted file system 
> as when the file system is mounted, it’s totally open. Every file can be 
> encrypted with the same master password. I’m thinking of storing this 
> master password which is itself encrypted using the user’s password (or 
> it’s hash) in the auth_user table.
>  
> On a related note, I am planning to encrypt some columns of other tables 
> using the same master password. Your thoughts on this approach?
>  
>   
>  *From:* Massimo Di Pierro  
> *Sent:* Wednesday, April 11, 2012 12.13
> *To:* web2py@googlegroups.com 
> *Subject:* [web2py] Re: web2py: encrypt uploaded files
>  
> What are the specs? Can you store them in an encrypted file system? can 
> you encrypt them with the same password? Should every file be encrypted 
> with a different password? Where should the passwords be stored?
>
> On Wednesday, 11 April 2012 11:54:24 UTC-5, naveed wrote: 
>>
>> I need to encrypt uploaded files in web2py (for a HIPAA compliant 
>> application) preferably with AES. How can I accomplish this?
>>
>

[web2py] College Park, Maryland

2012-04-11 Thread Massimo Di Pierro
April 26-28 I will be in College Park, Maryland. I will be free in the 
evening. Anybody around there up for a beer?

Massimo


Re: [web2py] Add conditional sub-menu

2012-04-11 Thread Omi Chiba
Thank Bruno, but both shows some errors.

*1st one*

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 205, in restricted
exec ccode in environment
  File "C:\web2py\applications\home\views\default/index.html", line 64, in 

  File "C:\web2py\gluon\globals.py", line 182, in write
self.body.write(xmlescape(data))
  File "C:\web2py\gluon\html.py", line 114, in xmlescape
return data.xml()
  File "C:\web2py\gluon\html.py", line 2146, in xml
return self.serialize(self.data, 0).xml()
  File "C:\web2py\gluon\html.py", line 2121, in serialize
li.append(self.serialize(item[3], level+1))
  File "C:\web2py\gluon\html.py", line 2109, in serialize
(name, active, link) = item[:3]
TypeError: 'NoneType' object is not subscriptable


*2nd one*
*
*
Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 205, in restricted
exec ccode in environment
  File "C:/web2py/applications/home/models/menu.py", line 33, in 
response.menu[1][3] += [('Admin',  False,  URL('admin'))]
TypeError: 'tuple' object does not support item assignment

On Wednesday, April 11, 2012 11:36:33 AM UTC-5, rochacbruno wrote:
>
> response.menu = [('Home', False, URL('home','default','index'), []),
> (SPAN('Price List',_style='color:yellow'), True, 
> URL('pricelist','default','index'), 
> [('Guideline',  False,  URL('pricelist','default','guideline')),
>  ('Multiplier Tables',  False, 
>  URL('pricelist','default','multitable')),
>  ('Cut Charge Tables',  False,  URL('pricelist','default','cuttable')),
> *('Admin',  False,  URL('admin')) if (auth.user_id != None) and 
> ((auth.has_membership(role = 'admin'))) else None*
> ])]
>
>
> or
>
> if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
> response.menu[1][3] += [('Admin',  False,  URL('admin')), ]
>
>
> On Wed, Apr 11, 2012 at 1:24 PM, Omi Chiba  wrote:
>
>> response.menu = [('Home', False, URL('home','default','index'), []),
>> (SPAN('Price List',_style='color:yellow'), True, 
>> URL('pricelist','default','index'), 
>> [('Guideline',  False,  URL('pricelist','default','guideline')),
>>  ('Multiplier Tables',  False, 
>>  URL('pricelist','default','multitable')),
>>  ('Cut Charge Tables',  False, 
>>  URL('pricelist','default','cuttable')),
>> ])]
>>
>
>
>
> -- 
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>

Re: [web2py] Re: Scaling web2py

2012-04-11 Thread villas
I've just been working with a tree myself.  Database recursion (CTE) seems 
very effective and is now supported by most of the larger DBs (although 
sadly not Sqlite yet,  I don't think).  
This is the reference link for Postgres and a SQL query I wrote for 
Firebird,  
I thought it might vaguely help if you are heading in that direction:

http://old.storytotell.org/blog/2009/08/11/postgresql84-recursive-queries.html
sql = """
WITH RECURSIVE breadcrumb(id, descr, parent_id) AS (
  SELECT id, descr, parent_id FROM area a WHERE id = %s
  UNION ALL
SELECT a.id, a.descr, a.parent_id FROM area a, breadcrumb
WHERE breadcrumb.parent_id = a.id)
SELECT * FROM breadcrumb;
""" % id
rows = db.executesql(sql,as_dict=True)

However,  I also like the method of saving paths in a field (I believe the 
method is called "Materialized Path").  It seems simple and versatile and I 
already decided to try it next time I need a simple tree and of course this 
would work fine on Sqlite too.  

Best wishes,
David 




On Wednesday, 11 April 2012 15:41:05 UTC+1, Detectedstealth wrote:
>
> Yeah probably is I already have it with web2py but it is slow with 20,000 
> nodes takes around 5-10 seconds to load the results.
>
> On Wed, Apr 11, 2012 at 7:29 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> I made a lot of that last year... Sometimes it was driving me nuts, 
>> needing to have the same columns for each table in the union... Good naming 
>> convention helps to make thing clearer when you get back to the code...
>>
>> Note, I would try to make it with web2py first if I were needing to write 
>> those code again.
>>
>> Richard
>>
>>
>> On Wed, Apr 11, 2012 at 10:09 AM, Bruce Wade wrote:
>>
>>> Yeah not sure have never used recursion at the database level. However 
>>> it seems to be the only option, none of the other options in that chapter 
>>> fit my needs.
>>>
>>>
>>> On Wed, Apr 11, 2012 at 7:05 AM, Richard Vézina <
>>> ml.richard.vez...@gmail.com> wrote:
>>>
 Recursion is slow because the union... But it may fit yours need better 
 I don't know. 

 Richard


 On Wed, Apr 11, 2012 at 9:45 AM, Bruce Wade wrote:

> Ok so I have read the chapter I think the best option is postgres 
> recursive queries. 
>
> On Tue, Apr 10, 2012 at 10:39 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Yes AntiPattern cover 4 or 5 kind of tree representation, classify 
>> them depending of usage and gives pros and cons.
>>
>> I choose Closure table since it was one of the more complet for my 
>> case. But if parent node is changing frequently it's not the more 
>> effecient 
>> tree antipattern.
>>
>> Have look it is pretty instructive.
>>
>> Book contain little more explanation, but there is this slide :
>>
>>
>> http://www.slideshare.net/billkarwin/practical-object-oriented-models-in-sql
>>  
>> Richard
>>
>>
>> On Tue, Apr 10, 2012 at 7:32 AM, stefaan wrote:
>>
>>>
>>>
>>>
>>> Well I know the major bottle neck in the site is the binary tree. I 
 am still trying to figure out how to do this the best and most 
 efficient.

>>>
>>> Maybe this could be useful: 
>>> http://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html
>>>  
>>>
>>
>>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>

>>>
>>>
>>> -- 
>>> -- 
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>
>>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>

[web2py] issue tracker application CSC438

2012-04-11 Thread Derek
I downloaded the "issue tracker" since I have a need to track issues in 
software that I write.
it seems usable, though when I go to app admin, and go to database 
administration, those queries don't seem to automatically populate. I don't 
know what's up with that.
Also, when creating a new project, you have to assign a manager, and it 
goes by ID number instead of by the person's name. How do you change that 
so it uses the person's name?
I also noticed that the 'super project' goes by ID number as well. How 
would I go about using the project name?

Referring to the project here:
https://github.com/mdipierro/web2py-appliances/tree/master/IssueTracker 

Thanks!


[web2py] Re: issue tracker application CSC438

2012-04-11 Thread Derek
Looks like there are more issues in that issue tracker - trying to add an 
issue I get a ticket.
 global name 'ccitem' is not defined
Traceback (most recent call last):
  File "C:\Temp\web2py\gluon\restricted.py", line 205, in restricted
exec ccode in environment
  File "C:/Temp/web2py/applications/issues/controllers/default.py", line 
193, in 
  File "C:\Temp\web2py\gluon\globals.py", line 173, in 
self._caller = lambda f: f()
  File "C:/Temp/web2py/applications/issues/controllers/default.py", line 
79, in issues
oncreate=lambda form:do_mail([db.issue(form.vars.id)]))
  File "C:\Temp\web2py\gluon\sqlhtml.py", line 1568, in grid
formname=formname)
  File "C:\Temp\web2py\gluon\html.py", line 1994, in process
self.validate(**kwargs)
  File "C:\Temp\web2py\gluon\html.py", line 1948, in validate
onsuccess(self)
  File "C:/Temp/web2py/applications/issues/controllers/default.py", line 
79, in 
oncreate=lambda form:do_mail([db.issue(form.vars.id)]))
  File "C:/Temp/web2py/applications/issues/models/db_tracker.py", line 95, 
in do_mail
email_no +=[x.strip() for x in ccitem.cc if x.strip()]
NameError: global name 'ccitem' is not defined


On Wednesday, April 11, 2012 12:08:01 PM UTC-7, Derek wrote:
>
> I downloaded the "issue tracker" since I have a need to track issues in 
> software that I write.
> it seems usable, though when I go to app admin, and go to database 
> administration, those queries don't seem to automatically populate. I don't 
> know what's up with that.
> Also, when creating a new project, you have to assign a manager, and it 
> goes by ID number instead of by the person's name. How do you change that 
> so it uses the person's name?
> I also noticed that the 'super project' goes by ID number as well. How 
> would I go about using the project name?
>
> Referring to the project here:
> https://github.com/mdipierro/web2py-appliances/tree/master/IssueTracker 
>
> Thanks!
>


Re: [web2py] Re: Scaling web2py

2012-04-11 Thread Bruce Wade
Thanks that will be helpful, I liked the idea of paths also. However if you
have 200,000 + nodes in a tree the paths might be coming hard to work with.

On Wed, Apr 11, 2012 at 11:58 AM, villas  wrote:

> I've just been working with a tree myself.  Database recursion (CTE) seems
> very effective and is now supported by most of the larger DBs (although
> sadly not Sqlite yet,  I don't think).
> This is the reference link for Postgres and a SQL query I wrote for
> Firebird,
> I thought it might vaguely help if you are heading in that direction:
>
>
> http://old.storytotell.org/blog/2009/08/11/postgresql84-recursive-queries.html
> sql = """
> WITH RECURSIVE breadcrumb(id, descr, parent_id) AS (
>   SELECT id, descr, parent_id FROM area a WHERE id = %s
>   UNION ALL
> SELECT a.id, a.descr, a.parent_id FROM area a, breadcrumb
> WHERE breadcrumb.parent_id = a.id)
> SELECT * FROM breadcrumb;
> """ % id
> rows = db.executesql(sql,as_dict=True)
>
> However,  I also like the method of saving paths in a field (I believe the
> method is called "Materialized Path").  It seems simple and versatile and I
> already decided to try it next time I need a simple tree and of course this
> would work fine on Sqlite too.
>
> Best wishes,
> David
>
>
>
>
> On Wednesday, 11 April 2012 15:41:05 UTC+1, Detectedstealth wrote:
>>
>> Yeah probably is I already have it with web2py but it is slow with 20,000
>> nodes takes around 5-10 seconds to load the results.
>>
>> On Wed, Apr 11, 2012 at 7:29 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> I made a lot of that last year... Sometimes it was driving me nuts,
>>> needing to have the same columns for each table in the union... Good naming
>>> convention helps to make thing clearer when you get back to the code...
>>>
>>> Note, I would try to make it with web2py first if I were needing to
>>> write those code again.
>>>
>>> Richard
>>>
>>>
>>> On Wed, Apr 11, 2012 at 10:09 AM, Bruce Wade wrote:
>>>
 Yeah not sure have never used recursion at the database level. However
 it seems to be the only option, none of the other options in that chapter
 fit my needs.


 On Wed, Apr 11, 2012 at 7:05 AM, Richard Vézina <
 ml.richard.vez...@gmail.com> wrote:

> Recursion is slow because the union... But it may fit yours need
> better I don't know.
>
> Richard
>
>
> On Wed, Apr 11, 2012 at 9:45 AM, Bruce Wade wrote:
>
>> Ok so I have read the chapter I think the best option is postgres
>> recursive queries.
>>
>> On Tue, Apr 10, 2012 at 10:39 AM, Richard Vézina <
>> ml.richard.vez...@gmail.com> wrote:
>>
>>> Yes AntiPattern cover 4 or 5 kind of tree representation, classify
>>> them depending of usage and gives pros and cons.
>>>
>>> I choose Closure table since it was one of the more complet for my
>>> case. But if parent node is changing frequently it's not the more 
>>> effecient
>>> tree antipattern.
>>>
>>> Have look it is pretty instructive.
>>>
>>> Book contain little more explanation, but there is this slide :
>>>
>>> http://www.slideshare.net/**billkarwin/practical-object-**
>>> oriented-models-in-sql
>>>
>>> Richard
>>>
>>>
>>> On Tue, Apr 10, 2012 at 7:32 AM, stefaan wrote:
>>>



 Well I know the major bottle neck in the site is the binary tree. I
> am still trying to figure out how to do this the best and most 
> efficient.
>

 Maybe this could be useful: http://dirtsimple.org/**
 2010/11/simplest-way-to-do-**tree-based-queries.html


>>>
>>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/**brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.**com - 
>> Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>
>


 --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/**brucelwade
 http://www.wadecybertech.com
 http://www.fittraineronline.**com  -
 Fitness Personal Trainers Online
 http://www.warplydesigned.com


>>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/**brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.**com  -
>> Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>


-- 
-- 
Regards,
Bruce Wade

Re: [web2py] Re: issue tracker application CSC438

2012-04-11 Thread Richard Vézina
For the id I think there is missing represent here and there... I would use
it in near future also, but I didn't get time to improve it...

I will do, when I find time.

Richard

On Wed, Apr 11, 2012 at 3:09 PM, Derek  wrote:

> Looks like there are more issues in that issue tracker - trying to add an
> issue I get a ticket.
>  global name 'ccitem' is not defined
> Traceback (most recent call last):
>   File "C:\Temp\web2py\gluon\restricted.py", line 205, in restricted
> exec ccode in environment
>   File "C:/Temp/web2py/applications/issues/controllers/default.py", line
> 193, in 
>   File "C:\Temp\web2py\gluon\globals.py", line 173, in 
> self._caller = lambda f: f()
>   File "C:/Temp/web2py/applications/issues/controllers/default.py", line
> 79, in issues
> oncreate=lambda form:do_mail([db.issue(form.vars.id)]))
>   File "C:\Temp\web2py\gluon\sqlhtml.py", line 1568, in grid
> formname=formname)
>   File "C:\Temp\web2py\gluon\html.py", line 1994, in process
> self.validate(**kwargs)
>   File "C:\Temp\web2py\gluon\html.py", line 1948, in validate
> onsuccess(self)
>   File "C:/Temp/web2py/applications/issues/controllers/default.py", line
> 79, in 
> oncreate=lambda form:do_mail([db.issue(form.vars.id)]))
>   File "C:/Temp/web2py/applications/issues/models/db_tracker.py", line 95,
> in do_mail
> email_no +=[x.strip() for x in ccitem.cc if x.strip()]
> NameError: global name 'ccitem' is not defined
>
>
> On Wednesday, April 11, 2012 12:08:01 PM UTC-7, Derek wrote:
>>
>> I downloaded the "issue tracker" since I have a need to track issues in
>> software that I write.
>> it seems usable, though when I go to app admin, and go to database
>> administration, those queries don't seem to automatically populate. I don't
>> know what's up with that.
>> Also, when creating a new project, you have to assign a manager, and it
>> goes by ID number instead of by the person's name. How do you change that
>> so it uses the person's name?
>> I also noticed that the 'super project' goes by ID number as well. How
>> would I go about using the project name?
>>
>> Referring to the project here:
>> https://github.com/mdipierro/**web2py-appliances/tree/master/**
>> IssueTracker
>>
>>
>> Thanks!
>>
>


[web2py] Re: Meteor web framework

2012-04-11 Thread Derek
It seems to be the antithesis of web2py - it's made without any 
considerations into security - those come after the basic functionality. If 
you are interested in meteor, I suggest you have a look 
at http://www.wakanda.org/
It's more mature, and a lot better documented.

On Wednesday, April 11, 2012 8:11:38 AM UTC-7, Francisco Costa wrote:
>
> http://www.meteor.com
> Meteor is a set of new technologies for building top-quality webapps in a 
> fraction of the time, whether you're an expert developer or just getting 
> started. 
>
> I think this is something worth checking out
>


Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-04-11 Thread pbreit
Yeah, something simple like Tumblr would be nice.


On Wednesday, April 11, 2012 9:22:33 AM UTC-7, Gour wrote: 
>
> We just need general-purpose CMS without neeed for socila network stuff.
>
>
>

Re: [web2py] Re: [w2py-dev] Re: Movuca - Social CMS beta 0.1

2012-04-11 Thread Bruno Rocha
On Wed, Apr 11, 2012 at 4:56 PM, pbreit  wrote:

> Yeah, something simple like Tumblr would be nice.


tumblr has a lot of social networking features



-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Add a Add To Cart button in SQLFORM.grid

2012-04-11 Thread greenpoise
Based on the online example, POS Online Store, I want to add a button to 
add to cart in the SQLFORM.grid. So if my grid goes like this:

def store():
fields = [db.product.name,db.product.product_code,db.product.
productcategory,db.product.description,db.product.price]
orderby =db.product.name


links = [lambda row: A('+',_href=URL("default","cart",args=[row.id]))]
powerusers = auth.has_membership('managers')

grid=SQLFORM.grid(db.product,fields=fields,orderby=orderby,deletable=
powerusers,editable=powerusers,paginate=10,links=links)
return dict(grid=grid)

Where and how can I add a button to the grid that would add the product to 
the shopping cart??? the shopping cart is basically the same as Massimo's 
POS Online Store example.

Links this way works but its not adding anything, it is just a link to 
another page, I want to add the product to the cart.



Thanks


[web2py] Mimicking HTML5 pattern attribute for inputs

2012-04-11 Thread RKS
I'm looking to validate all of my forms with HTML5 and the pattern 
attribute, but as always, nothing is perfect on the internet and I still 
need a backup to catch those users who do not use HTML5 friendly browsers.

I'm having trouble finding exact representations of the regular expressions 
in the handbook so if you know, I'd appreciate some help. I have written 
the code in two ways, the HTML way and the HTML helper way (see below) and 
the HTML5 works and validates in modern browsers except IE as expected but 
I can't translate them to python.

An example, you will see below, is the expression 
pattern="[A-F0-9]{11}|[A-F0-9]{14}"
This effectively forces an input to only contain uppercase letters of A-F 
and numbers 0-9. It also ensures the length is exactly 11 characters or 14. 
So how would I use this in web2py? IS_LENGTH seems to accept only a range 
from my tests and so far I've only found IS_ALPHANUMERIC to control what 
characters are accepted.

Please seem the form below:

HTML:


MSIE/ESN *


Zip Code *






   * denotes a required field.




HTML Helpers:

form=FORM(LABEL('MEID/ESN 
',(SPAN('*'))),INPUT(_name='meid',_pattern="[A-F0-9]{11}|[A-F0-9]{14}",_placeholder='MEID/ESN',_required='required',_title="The
 
MEID/ESN number only contains 11 or 13 characters, the letters A-F, and the 
numbers 0-9.",requires=[IS_LENGTH(11|14),IS_NOT_EMPTY()], 
_onblur="this.checkValidity();"),BR(),LABEL('ZIP CODE 
',(SPAN('*'))),INPUT(_name='zip',_type='number',_pattern="[0-9]{5}",_placeholder='Zip
 
Code',_required='required',_title="We only required the five character zip 
code.",requires=IS_NOT_EMPTY()),BR(),BR(),BR(),BR(),INPUT(_type='button',_name='cancel',_value='Cancel',_onclick="history.go(-1);return
 
true;"),INPUT(_type='submit',_name='submit',_value='Activate'),_method='post',_id='activate_form')
if form.accepts(request,session):
response.flash = 'Form accepted'
 #   redirect(URL('next'))
elif form.errors:
response.flash = 'Form has errors'
return dict(form=form)



Thanks.


[web2py] Re: [OT] Re: Spatial / GIS support in DAL

2012-04-11 Thread Tim Michelsen



Wow, old URL!

Where's your current roadmap?

Maybe I go and pickup something.



[web2py] Re: process args

2012-04-11 Thread Derek
Correct. You'd need to url encode those characters...
http://docs.python.org/library/urllib.html#urllib.urlencode 
and then use the 'unquote' to get back the original characters.


On Monday, April 9, 2012 8:29:43 PM UTC-7, pbreit wrote:
>
> I don't think you can have those characters in a URL. And URL's should not 
> have spaces.
>
> In the view, it usually looks like this: 
> In this URL: http://mysite.com/app/controller/function/25-test
> str(request.args(0)).split('-')[0] should get '25' as you expect.
>
>
>

Re: [web2py] Re: Cookbook recipe for nginx/uwsgi woes

2012-04-11 Thread Michele Comitini
To handle static request using "alias" instead of "root" with regexp
should work better


  set $web2pyroot 


location ~ ^/(.*)/static/(.*) {
 alias $web2pyroot/applications/$1/static/$2;
}

mic


Il 11 aprile 2012 18:23, pbreit  ha scritto:
> Looks like it is having trouble with a file in /static. This is how I serve
> /static:
>
>         location /static {
>             root /opt/web2py/applications/myapp/;
>         }
>
> You may just need to add the appname to:
> root  /home/www-data/web2py/applications/
>
> Also, I don't know if you need that extra stuff on the location line.


[web2py] Browser back button: Reloading database results

2012-04-11 Thread DJ
Hello W2People,

This may be a simple setting that I am unaware of - how does one retain the 
database search results when you click the Back Button on the browser 
without having to refresh the page and confirming?

Thank you,
Sebastian


[web2py] Re: Browser back button: Reloading database results

2012-04-11 Thread Derek
Cache the results?

On Wednesday, April 11, 2012 2:07:50 PM UTC-7, DJ wrote:
>
> Hello W2People,
>
> This may be a simple setting that I am unaware of - how does one retain 
> the database search results when you click the Back Button on the browser 
> without having to refresh the page and confirming?
>
> Thank you,
> Sebastian
>


[web2py] Re: Add a Add To Cart button in SQLFORM.grid

2012-04-11 Thread greenpoise
Nevermind, got it to work like this:


links = [lambda row: A('+',callback=URL('cart_callback',vars=dict(id=row.id,
action='add')))]





On Wednesday, 11 April 2012 13:06:49 UTC-7, greenpoise wrote:
>
> Based on the online example, POS Online Store, I want to add a button to 
> add to cart in the SQLFORM.grid. So if my grid goes like this:
>
> def store():
> fields = [db.product.name,db.product.product_code,db.product.
> productcategory,db.product.description,db.product.price]
> orderby =db.product.name
> 
>
> links = [lambda row: A('+',_href=URL("default","cart",args=[row.id]))]
> powerusers = auth.has_membership('managers')
> 
> grid=SQLFORM.grid(db.product,fields=fields,orderby=orderby,deletable=
> powerusers,editable=powerusers,paginate=10,links=links)
> return dict(grid=grid)
>
> Where and how can I add a button to the grid that would add the product to 
> the shopping cart??? the shopping cart is basically the same as Massimo's 
> POS Online Store example.
>
> Links this way works but its not adding anything, it is just a link to 
> another page, I want to add the product to the cart.
>
>
>
> Thanks
>


[web2py] Re: Browser back button: Reloading database results

2012-04-11 Thread Derek
Although one does wonder if Web2Py shouldn't default to the 
Post/Redirect/Get design pattern...
http://en.wikipedia.org/wiki/Post/Redirect/Get 

On Wednesday, April 11, 2012 2:29:46 PM UTC-7, Derek wrote:
>
> Cache the results?
>
> On Wednesday, April 11, 2012 2:07:50 PM UTC-7, DJ wrote:
>>
>> Hello W2People,
>>
>> This may be a simple setting that I am unaware of - how does one retain 
>> the database search results when you click the Back Button on the browser 
>> without having to refresh the page and confirming?
>>
>> Thank you,
>> Sebastian
>>
>

Re: [web2py] Re: Browser back button: Reloading database results

2012-04-11 Thread Sebastian Jayaraj
Caching saves the results on the server side and makes return access to db
select faster but not on the client browser.

On Wed, Apr 11, 2012 at 5:34 PM, Derek  wrote:

> Although one does wonder if Web2Py shouldn't default to the
> Post/Redirect/Get design pattern...
> http://en.wikipedia.org/wiki/Post/Redirect/Get
>
>
> On Wednesday, April 11, 2012 2:29:46 PM UTC-7, Derek wrote:
>>
>> Cache the results?
>>
>> On Wednesday, April 11, 2012 2:07:50 PM UTC-7, DJ wrote:
>>>
>>> Hello W2People,
>>>
>>> This may be a simple setting that I am unaware of - how does one retain
>>> the database search results when you click the Back Button on the browser
>>> without having to refresh the page and confirming?
>>>
>>> Thank you,
>>> Sebastian
>>>
>>


[web2py] Can't rebuild database files

2012-04-11 Thread Yarin
I corrupted my web2py -myql mapping and am trying to rebuild the web2py 
database files from scratch. 

Starting point: 

   - The mysql database tables already exist. Some tables were working 
   correctly under the old mapping, and some were never mapped.
   - I've already deleted everything from the databases folder.
   - I've already cleared everything from the db.py file except the 
   original code (auth tables, etc.)

Plan:


   - Set migrate=False, fake_migrate_all=True at the DAL connection level: 
   db = DAL('mysql://root:root@localhost/mydb', migrate=False,fake_migrate_all
   =True)
   - Re-add each table into the db.py file one by one, starting with a 
   fake_migrate and then going to real migrate into all the tables were 
   working.

Problem:


   - I can't get any table files generated for anything, even the auth 
   files. Setting fake_migrate_all=True doesn't generate any files, and 
   setting migrate=True gives me an error that the tables already exist. 


How do I get the table files to generate?











  1   2   >