[web2py] question about processing db entries in chunks

2012-04-11 Thread weheh
I need to limit my processing of db entries to chunks of, let's say, 100. 
So I want to first get the data:

data = db(db.mytable.flag == False).select(limitby=(0,100))

for d in data:
# do something

Then I want to set mytable.flag to True after the above loop is done, but 
only for the same 100 entries I've just retrieved.

BUT, while this is going on, someone else may be adding new entries with 
mytable.flag=False to the table. 

So without iterating one-by-one on "data", is there a one-liner to update 
mytable.flag to True for the 100 entries I already retrieved?


[web2py] Query or Expression for excluding certain values from DAL selection on GAE

2012-04-11 Thread Sathvik Ponangi
>From http://stackoverflow.com/q/10117143/937891

I'm trying to exclude posts which have a tag named meta from my selection, 
by:

meta_id = db(db.tags.name == "meta").select().first().id
not_meta = ~db.posts.tags.contains(meta_id)
posts=db(db.posts).select(not_meta)

But those posts still show up in my selection.

What is the right way to write that expression?

My tables look like:

db.define_table('tags',
db.Field('name', 'string'),
db.Field('desc', 'text', default="")
)

db.define_table('posts', 
db.Field('title', 'string'),
db.Field('message', 'text'),
db.Field('tags', 'list:reference tags'),
db.Field('time', 'datetime', default=datetime.utcnow())
)

*UPDATE:*

I just tried posts=db(not_meta).select() as suggested by @Anthony, but it 
gives me a Ticket with the following Traceback:

Traceback (most recent call last):
  File "E:\Programming\Python\web2py\gluon\restricted.py", line 205, in 
restricted
exec ccode in environment
  File 
"E:/Programming/Python/web2py/applications/vote_up/controllers/default.py", 
line 391, in 
  File "E:\Programming\Python\web2py\gluon\globals.py", line 173, in 
self._caller = lambda f: f()
  File 
"E:/Programming/Python/web2py/applications/vote_up/controllers/default.py", 
line 8, in index
posts=db(not_meta).select()#orderby=settings.sel.posts, limitby=(0, 
settings.delta)
  File "E:\Programming\Python\web2py\gluon\dal.py", line 7578, in select
return adapter.select(self.query,fields,attributes)
  File "E:\Programming\Python\web2py\gluon\dal.py", line 3752, in select
(items, tablename, fields) = self.select_raw(query,fields,attributes)
  File "E:\Programming\Python\web2py\gluon\dal.py", line 3709, in select_raw
filters = self.expand(query)
  File "E:\Programming\Python\web2py\gluon\dal.py", line 3589, in expand
return expression.op(expression.first)
  File "E:\Programming\Python\web2py\gluon\dal.py", line 3678, in NOT
raise SyntaxError, "Not suported %s" % first.op.__name__
SyntaxError: Not suported CONTAINS



[web2py] ImportError: cannot import name PickleableStorage after upgrading to 1.99.7

2012-04-11 Thread David Zejda
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

After upgrade to 1.99.7. I started receiving this error:

Traceback (most recent call last):
  File "/opt/web2py/gluon/restricted.py", line 194, in restricted
in code it raises a RestrictedError containing the traceback. layer is
  File "/opt/web2py/applications/trom/compiled/models/menu.py", line 3,
in 
  File "/opt/web2py/gluon/custom_import.py", line 294, in __call__
#except Exception, e:
  File "/opt/web2py/gluon/custom_import.py", line 78, in __call__
level)
  File "/opt/web2py/gluon/tools.py", line 28, in 
from storage import Storage, PickleableStorage, StorageList,
Settings, Messages
ImportError: cannot import name PickleableStorage

The error disappeared when I removed PickleableStorage from import in tools.

D.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+GdpQACgkQ3oCkkciamVGuJwCffvSARB7XLeCvNdFqWr5tz/Ag
19IAoINWjF4MNIEVBpRU8+8xsMXEAR+c
=jk/I
-END PGP SIGNATURE-


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

2012-04-11 Thread Bruce Wade
I am having the exact same problem with uwsgi

2012/04/12 06:16:49 [error] 9428#0: *1 upstream prematurely closed
connection while reading response header from upstream, client:
108.172.101.4, server: 50.18.67.206, request: "GET / HTTP/1.1", upstream:
"uwsgi://127.0.0.1:9001", host: "50.18.67.206"

I tested and I can get to my static files using nginx without a problem so
I know that isn't the issue.

Thinking maybe sticking with apache is a better more stable solution?

On Wed, Apr 11, 2012 at 2:05 PM, Michele Comitini <
michele.comit...@gmail.com> wrote:

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



-- 
-- 
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] Adding a copy option to a SQLFORM.grid

2012-04-11 Thread Mike Veltman
Well I would like to have besides edit delete etc in my SQLFORM.grid 
also a copy option that copies the record and then gives me the edit so 
I can modify it.


Anyone a idea how to do that ?

Mike


[web2py] Browser back button: Reloading database results

2012-04-11 Thread pbreit
This article is sort of old but might help: http://www.mnot.net/cache_docs/


[web2py] Well So long to Google App_Engine

2012-04-11 Thread pbreit
Maybe too late for you but for anyone else trying to scale up, Cloudflare 
provides free CDN and a bunch more security and performance features, almost 
all free.


[web2py] Re: Add conditional sub-menu

2012-04-11 Thread Cliff
I have something like this working:

sub_menu = []
if (auth.user_id != None) and ((auth.has_membership(role = 'admin'))):
sub_menu = [('Admin',  False,  URL('admin')), ]
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')),
 (sub_menu),
])]

On Wednesday, April 11, 2012 12:24:29 PM UTC-4, Omi Chiba wrote:
>
> 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')), ]
>


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

2012-04-11 Thread Simon Ashley


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

Not sure why, any ideas?





# List of Plant

``

name: jqgrid

table: plant

fields: Code,Description,SMU,Date

col_width: 80

width: 700

height: 300

``:widget

# New Plant

``

name: create

table: plant

``:widget








Traceback (most recent call last):

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

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

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

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

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

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

*KeyError: 'plant'*




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



[web2py] Well So long to Google App_Engine

2012-04-11 Thread chawk
I am going to be moving my application off of the Google App Engine cloud.  
I liked some of the things that app engine did for www.noobmusic.com, but 
it 
is clear that I will end up spending an ass load of money trying to host a 
resource hog like noobmusic.com.   I plan to put it on a dedicated 
Linux server through iweb with 10 tb of traffic and 500 gig of hard disk 
space.   The transition is planned for this weekend.  I am glad I did not 
get to deeply involved in app engine before deciding to move.My data 
models will need to be switched around, as I plan to use MySQL. 
Does anybody have an advice or heads up warnings with moving to a Linux 
server?  This will be a new experience for me. 

I don't know about anybody else, but the warnings about using app engine 
were pretty clear and not well heeded by me. Just like everybody said
you lock yourself into their bull crap.   they have so many gotchas in 
their billing it is unbelievable.  


[web2py] Re: How to add an input field in SQLFORM.grid??

2012-04-11 Thread greenpoise
Gotcha!   Will try thanks

On Wednesday, 11 April 2012 18:34:16 UTC-7, Massimo Di Pierro wrote:
>
> yes and not and what I said needs clarification.
>
> grid = SQLFORM.grid(create=False,update=False) is not a form. If 
> create=True or update=True then it contains a form when you are creating or 
> updating a record. you must avoind a form within a form and you can do so 
> in the view:
>
> {{if grid.create_form or grid.update_form:}}
> {{=grid}} it is a form
> {{else:}}
> {{=grid}} it is not a form but you can embed it in one  type='submit'/>
> {{pass}}
>
>
> On Wednesday, 11 April 2012 20:23:08 UTC-5, greenpoise wrote:
>>
>> A bit confused..I thought SQLFORM.grid was itself a form? Also, can I add 
>> more than one link per grid? Reading from the book, it creates a column so 
>> technically sounds as if I could???
>>
>> On Wednesday, 11 April 2012 16:27:17 UTC-7, Massimo Di Pierro wrote:
>>>
>>> You can put the grid in a form and you add 
>>>
>>> SQLFORM.grid(..., link=[lambda row: INTPUT(...)])
>>>
>>> On Wednesday, 11 April 2012 17:07:58 UTC-5, greenpoise wrote:

 Is this possible?? I have a products table that shows all the products. 
 I also created an add to cart button in it problem is if I want to add 100 
 items I would have to press the button 100 times.  Is there a way to add a 
 quantity text field???


 Thanks

 Dan

>>>
>> On Wednesday, 11 April 2012 16:27:17 UTC-7, Massimo Di Pierro wrote:
>>>
>>> You can put the grid in a form and you add 
>>>
>>> SQLFORM.grid(..., link=[lambda row: INTPUT(...)])
>>>
>>> On Wednesday, 11 April 2012 17:07:58 UTC-5, greenpoise wrote:

 Is this possible?? I have a products table that shows all the products. 
 I also created an add to cart button in it problem is if I want to add 100 
 items I would have to press the button 100 times.  Is there a way to add a 
 quantity text field???


 Thanks

 Dan

>>>
On Wednesday, 11 April 2012 18:34:16 UTC-7, Massimo Di Pierro wrote:
>
> yes and not and what I said needs clarification.
>
> grid = SQLFORM.grid(create=False,update=False) is not a form. If 
> create=True or update=True then it contains a form when you are creating or 
> updating a record. you must avoind a form within a form and you can do so 
> in the view:
>
> {{if grid.create_form or grid.update_form:}}
> {{=grid}} it is a form
> {{else:}}
> {{=grid}} it is not a form but you can embed it in one  type='submit'/>
> {{pass}}
>
>
> On Wednesday, 11 April 2012 20:23:08 UTC-5, greenpoise wrote:
>>
>> A bit confused..I thought SQLFORM.grid was itself a form? Also, can I add 
>> more than one link per grid? Reading from the book, it creates a column so 
>> technically sounds as if I could???
>>
>> On Wednesday, 11 April 2012 16:27:17 UTC-7, Massimo Di Pierro wrote:
>>>
>>> You can put the grid in a form and you add 
>>>
>>> SQLFORM.grid(..., link=[lambda row: INTPUT(...)])
>>>
>>> On Wednesday, 11 April 2012 17:07:58 UTC-5, greenpoise wrote:

 Is this possible?? I have a products table that shows all the products. 
 I also created an add to cart button in it problem is if I want to add 100 
 items I would have to press the button 100 times.  Is there a way to add a 
 quantity text field???


 Thanks

 Dan

>>>
>> On Wednesday, 11 April 2012 16:27:17 UTC-7, Massimo Di Pierro wrote:
>>>
>>> You can put the grid in a form and you add 
>>>
>>> SQLFORM.grid(..., link=[lambda row: INTPUT(...)])
>>>
>>> On Wednesday, 11 April 2012 17:07:58 UTC-5, greenpoise wrote:

 Is this possible?? I have a products table that shows all the products. 
 I also created an add to cart button in it problem is if I want to add 100 
 items I would have to press the button 100 times.  Is there a way to add a 
 quantity text field???


 Thanks

 Dan

>>>

[web2py] Re: How to add an input field in SQLFORM.grid??

2012-04-11 Thread Massimo Di Pierro
yes and not and what I said needs clarification.

grid = SQLFORM.grid(create=False,update=False) is not a form. If 
create=True or update=True then it contains a form when you are creating or 
updating a record. you must avoind a form within a form and you can do so 
in the view:

{{if grid.create_form or grid.update_form:}}
{{=grid}} it is a form
{{else:}}
{{=grid}} it is not a form but you can embed it in one 
{{pass}}


On Wednesday, 11 April 2012 20:23:08 UTC-5, greenpoise wrote:
>
> A bit confused..I thought SQLFORM.grid was itself a form? Also, can I add 
> more than one link per grid? Reading from the book, it creates a column so 
> technically sounds as if I could???
>
> On Wednesday, 11 April 2012 16:27:17 UTC-7, Massimo Di Pierro wrote:
>>
>> You can put the grid in a form and you add 
>>
>> SQLFORM.grid(..., link=[lambda row: INTPUT(...)])
>>
>> On Wednesday, 11 April 2012 17:07:58 UTC-5, greenpoise wrote:
>>>
>>> Is this possible?? I have a products table that shows all the products. 
>>> I also created an add to cart button in it problem is if I want to add 100 
>>> items I would have to press the button 100 times.  Is there a way to add a 
>>> quantity text field???
>>>
>>>
>>> Thanks
>>>
>>> Dan
>>>
>>
> On Wednesday, 11 April 2012 16:27:17 UTC-7, Massimo Di Pierro wrote:
>>
>> You can put the grid in a form and you add 
>>
>> SQLFORM.grid(..., link=[lambda row: INTPUT(...)])
>>
>> On Wednesday, 11 April 2012 17:07:58 UTC-5, greenpoise wrote:
>>>
>>> Is this possible?? I have a products table that shows all the products. 
>>> I also created an add to cart button in it problem is if I want to add 100 
>>> items I would have to press the button 100 times.  Is there a way to add a 
>>> quantity text field???
>>>
>>>
>>> Thanks
>>>
>>> Dan
>>>
>>

[web2py] Re: How to add an input field in SQLFORM.grid??

2012-04-11 Thread greenpoise
A bit confused..I thought SQLFORM.grid was itself a form? Also, can I add 
more than one link per grid? Reading from the book, it creates a column so 
technically sounds as if I could???

On Wednesday, 11 April 2012 16:27:17 UTC-7, Massimo Di Pierro wrote:
>
> You can put the grid in a form and you add 
>
> SQLFORM.grid(..., link=[lambda row: INTPUT(...)])
>
> On Wednesday, 11 April 2012 17:07:58 UTC-5, greenpoise wrote:
>>
>> Is this possible?? I have a products table that shows all the products. I 
>> also created an add to cart button in it problem is if I want to add 100 
>> items I would have to press the button 100 times.  Is there a way to add a 
>> quantity text field???
>>
>>
>> Thanks
>>
>> Dan
>>
>
On Wednesday, 11 April 2012 16:27:17 UTC-7, Massimo Di Pierro wrote:
>
> You can put the grid in a form and you add 
>
> SQLFORM.grid(..., link=[lambda row: INTPUT(...)])
>
> On Wednesday, 11 April 2012 17:07:58 UTC-5, greenpoise wrote:
>>
>> Is this possible?? I have a products table that shows all the products. I 
>> also created an add to cart button in it problem is if I want to add 100 
>> items I would have to press the button 100 times.  Is there a way to add a 
>> quantity text field???
>>
>>
>> Thanks
>>
>> Dan
>>
>

[web2py] Re: Can't rebuild database files

2012-04-11 Thread Massimo Di Pierro
I suspect the online docs is incorrect and fake_migrate does not work 
without migrate. I need to double check.

Massimo

On Wednesday, 11 April 2012 19:40:17 UTC-5, Yarin wrote:
>
> Massimo, this worked and I was able to get everything restored- thanks. 
> However I could use an explanation. Setting both migrate *and*fake_migrate to 
> True is not something prescribed in the documentation nor 
> is it intuitive- how/why does this work?
>
> On Wednesday, April 11, 2012 7:25:21 PM UTC-4, Massimo Di Pierro wrote:
>>
>> Can you true setting both migrate=True, fake_migrate_all=True? then call 
>> appadmin. What happens?
>>
>> On Wednesday, 11 April 2012 17:05:14 UTC-5, Yarin wrote:
>>>
>>> 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?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>

[web2py] Re: Can't rebuild database files

2012-04-11 Thread Yarin
Massimo, this worked and I was able to get everything restored- thanks. 
However I could use an explanation. Setting both migrate *and* fake_migrate 
to True is not something prescribed in the documentation nor is it 
intuitive- how/why does this work?

On Wednesday, April 11, 2012 7:25:21 PM UTC-4, Massimo Di Pierro wrote:
>
> Can you true setting both migrate=True, fake_migrate_all=True? then call 
> appadmin. What happens?
>
> On Wednesday, 11 April 2012 17:05:14 UTC-5, Yarin wrote:
>>
>> 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?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

[web2py] Re: How to add an input field in SQLFORM.grid??

2012-04-11 Thread Massimo Di Pierro
You can put the grid in a form and you add 

SQLFORM.grid(..., link=[lambda row: INTPUT(...)])

On Wednesday, 11 April 2012 17:07:58 UTC-5, greenpoise wrote:
>
> Is this possible?? I have a products table that shows all the products. I 
> also created an add to cart button in it problem is if I want to add 100 
> items I would have to press the button 100 times.  Is there a way to add a 
> quantity text field???
>
>
> Thanks
>
> Dan
>


[web2py] Re: Can't rebuild database files

2012-04-11 Thread Massimo Di Pierro
Can you true setting both migrate=True, fake_migrate_all=True? then call 
appadmin. What happens?

On Wednesday, 11 April 2012 17:05:14 UTC-5, Yarin wrote:
>
> 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?
>
>
>
>
>
>
>
>
>
>

[web2py] Re: Mimicking HTML5 pattern attribute for inputs

2012-04-11 Thread Anthony


For server-side pattern validation, you can use the IS_MATCH() validator. 
For example:

IS_MATCH('[A-F0-9]{11}|[A-F0-9]{14}', strict=True)

That will match from the beginning of the string, and setting strict=True also 
requires matching the end of the string (equivalent to adding a "$" to the 
end of the regular expression). If you don't want to match the beginning of 
the string but instead search for the pattern anywhere in the string, you 
can setsearch=True.
Anthony

On Wednesday, April 11, 2012 6:16:52 PM UTC-4, Anthony wrote:
>
> If you want to stick with client side validation, you might also consider 
> a Javascript polyfill library like Webshims Lib (
> http://afarkas.github.com/webshim/demos/), which lets you use HTML5 
> features in older browsers. Also note that although client-side validation 
> improves the user experience, it does not protect against malicious 
> attacks, so you may still want some server-side validation in addition.
>
> Anthony
>
> On Wednesday, April 11, 2012 4:21:35 PM UTC-4, RKS wrote:
>>
>> 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 *
>> > placeholder="MEID/ESN" required />
>> 
>> Zip Code *
>> 
>> 
>> 
>> 
>> > onClick="history.go(-1);return true;" />
>> 
>>* 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: Meteor web framework

2012-04-11 Thread Anthony

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

Not sure this is working quite the same as Meteor (i.e., real-time data 
binding via comet/websockets). It also requires a commercial license 
(except for the client framework, which is GPL, like Meteor).

Anthony


[web2py] Re: Mimicking HTML5 pattern attribute for inputs

2012-04-11 Thread Anthony
If you want to stick with client side validation, you might also consider a 
Javascript polyfill library like Webshims Lib (
http://afarkas.github.com/webshim/demos/), which lets you use HTML5 
features in older browsers. Also note that although client-side validation 
improves the user experience, it does not protect against malicious 
attacks, so you may still want some server-side validation in addition.

Anthony

On Wednesday, April 11, 2012 4:21:35 PM UTC-4, RKS wrote:
>
> 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 *
>  placeholder="MEID/ESN" required />
> 
> Zip Code *
> 
> 
> 
> 
>  onClick="history.go(-1);return true;" />
> 
>* 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] How to add an input field in SQLFORM.grid??

2012-04-11 Thread greenpoise
Is this possible?? I have a products table that shows all the products. I 
also created an add to cart button in it problem is if I want to add 100 
items I would have to press the button 100 times.  Is there a way to add a 
quantity text field???


Thanks

Dan


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

2012-04-11 Thread Anthony

>
> Although one does wonder if Web2Py shouldn't default to the 
> Post/Redirect/Get design pattern...
> http://en.wikipedia.org/wiki/Post/Redirect/Get
>

As long as you pass the session to form.process() (which is done by 
default), the form will include a single use _formkey, which prevents both 
double form submission and CSRF attacks. As for redirect, that is easily 
doable and a common pattern in web2py, but up to the developer -- though 
even without a redirect, the default behavior would be to load a new empty 
form, so no double form submission problem. Redirecting to a get with a 
query string is only necessary if the response depends on the original post 
content, and the details would likely be app specific, so probably best 
left up to the developer. What would a default PRG pattern look like -- 
where would it redirect, and what would the get request return?

Anthony


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











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

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


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

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


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]


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

[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: 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!
>>
>


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

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


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


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

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

[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] 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?
>>
>

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


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

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


[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 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: 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 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] 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?


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


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: 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] 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: 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] 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] 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')), ]


[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] 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.


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


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


[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] 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.
>
>

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


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


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


[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


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



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

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


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


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
>


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


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


[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']),



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


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


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

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

  1   2   >