[web2py] Re: Application not OK after upgrade from 2.5.1 to any posterior release...

2013-10-21 Thread pkomor
I have deleted all sessions files, I have packaged the application with 
2.5.1 and restored in web2py > 2.5.1, deleting session files, I have made 
an initial setup of the application with a new database migration, but the 
result is the same.

I think the only thing that application does "abnormal", is to create the 
auth_user table and auth_permissions programmatically with data of other 
table. With this users, there is not login failure and ldap authorizes, but 
there is not redirection to index page and web2py hangs. When I login with 
a initial user created when the application is installed there is no 
problem...

Thanks

El lunes, 21 de octubre de 2013 21:23:45 UTC+2, Massimo Di Pierro escribió:
>
> Can you try delete all session files?
>
> On Monday, 21 October 2013 02:58:13 UTC-5, pkomor wrote:
>>
>> Hello. I have an application that runs fine in web2py 2.5.1, I have 
>> upgraded web2py, I disabled migrations and activated after (I don't have 
>> fields in the model without the param length), but now when I login with an 
>> user created during the initial setup application, all is fine, but when 
>> any other user try to login there's not redirection to the index page and 
>> web2py hangs, with a "top" linux command I see the python process is 
>> increasing more 100%. I use ldap auth and I tried debugging but I'm not 
>> able to know what is wrong. Thanks.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] summary of session optimisations

2013-10-21 Thread Tim Richardson
I'm trying to understand better some of the tips for session optimisation. 
I've read the book and explored this group. Any improvements and 
corrections would be appreciated.

* It seems that web2py needs sessions most of them when users are logged 
in, if we're following recommendations for signed URLs etc. Also, disabled 
sessions means no CRUD according to the book, which presumably also rules 
out SQLFORM & family. 

So session.forget is a specific circumstance which is perhaps not so common.

* if a session is not changed, there is no write penalty, but this is only 
relevant whenever session.forget could have been used anyway. 

* Sessions can be stored on the filesystem (default) or in a database. 
the file system imposes locking which can block web2py if a user is doing 
several session-altering requests at the same time, most likely because of 
ajax use.
database sessions don't lock, which is an advantage. Or the ajax calls 
could do session.forget (but I suppose this wouldn't work if the ajax calls 
involved signed URLs)

On the pure comparison of filesystem vs database, I couldn't come to a 
conclusive answer from googling. I imagine an in memory DB will be faster, 
but a traditional database is going to end up as cached writes to the 
filesystem, I wonder if it can be faster (thinking of SQLSERVER Express 
edition, for example)

Also, using the filesystem for sessions can lead to a lot of files in a 
given directory which on some filesystems can be a problem (NTFS probably); 
web2py includes a session clean script to help with this.The script cleans 
up both filesystem and databaes sessions. It's possible to avoid all 
session files ending up in the same directory with the separate=True 
option, which distributes sessions between folders.

The ajax situation (avoiding locks) seems the biggest advantage to database 
sessions, unless you have access to a database which strongly outperforms 
the filesystem.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Help me test model subfolders

2013-10-21 Thread Johann Spies
On 21 October 2013 21:28, Massimo Di Pierro wrote:

> I do not understand. You have
>
>  r'^\db\.py$',
>
> shouldn't this be?
>
>  r'^db\.py$',
>
>
>
Yes it should be.  Thanks.

But that does not make any difference to the result:

python web2py.py -M -S nkb/akb
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2013
Version 2.7.4-stable+timestamp.2013.10.16.09.10.20
Database drivers available: SQLite(sqlite2), SQLite(sqlite3),
MySQL(pymysql), PostgreSQL(psycopg2), PostgreSQL(pg8000), MSSQL(pyodbc),
DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), IMAP(imaplib)
Traceback (most recent call last):
  File "/home/js/web2py/gluon/restricted.py", line 217, in restricted
exec ccode in environment
  File "applications/nkb/models/akb/akb.py", line 22, in 
db.executesql("set search_path to akb, public;")
NameError: name 'db' is not defined

js@artikel ~/web2py> tail applications/nkb/models/0.py
response.models_to_run = [
r'^0\.py$',
r'^db\.py$',
r'^dbcommon\.py$',
r'^%s/\w+\.py$' % request.controller,
r'^%s/%s/\w+\.py$' % (request.controller, request.function)


Regards
Johann

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Unable to join more than one table in SQLForm.grid

2013-10-21 Thread Jayakumar Bellie
How does that matter the my query?
I have to give some where condition.
Can you elaborate.


On Friday, October 18, 2013 9:05:06 PM UTC+5:30, villas wrote:
>
> HI Jayakumar
>
> Try using a query rather than a rows object.
>
> For example, rather than:
>  query = db().select(db.auth_user.ALL)  ## gives a rows object,  
> unusable by grid
>
> Use this:
>  query = db.auth_user.id>0  
>
> Hope you get the idea.
> Best regards,  D
>
>
>
> On Friday, 18 October 2013 06:43:24 UTC+1, Jayakumar Bellie wrote:
>>
>> Hi,
>>
>> I want to fetch all the auth_group list of a user from auth_user mapping 
>> auth_membership.
>>
>> -
>> query = db((db.auth_group.id==db.auth_membership.group_id) & (
>> db.auth_user.id==db.auth_membership.user_id) & (db.auth_user.id==
>> auth.user.id)).select(db.auth_group.ALL)
>> *# When I do the return over here, I am able to see the required 
>> data. But when I send it to the SQLFORM.grip it through the execption given 
>> below*
>> *#return dict(table=where)   
>> 
>> *
>> displayFields = [db.auth_group.role, db.auth_group.description]
>> displayHeaders = {'auth_group.role': T('Role'), 
>> 'auth_group.description' : T('Description')}
>> table = SQLFORM.grid(query,
>>  #left=left, 
>> 
>>
>>  fields=displayFields,
>>  headers=displayHeaders,
>>  deletable=False,
>>  create=True,
>>  editable=False,
>>  details=False,
>>  csv=False,
>>  links=[lambda row: A("Edit", 
>> _href=URL('manage_group', args=[row.id]))], 
>>  
>>  paginate=10)
>> return dict(table=table)
>>
>> -
>>
>> Traceback (most recent call last):
>>   File "/home/www-data/web2py/gluon/restricted.py", line 212, in restricted
>> exec ccode in environment
>>   File "/home/www-data/web2py/applications/Telematics/controllers/group.py" 
>> , 
>> line 64, in 
>>   File "/home/www-data/web2py/gluon/globals.py", line 194, in 
>> self._caller = lambda f: f()
>>   File "/home/www-data/web2py/gluon/tools.py", line 3022, in f
>> return action(*a, **b)
>>   File "/home/www-data/web2py/applications/Telematics/controllers/group.py" 
>> , 
>> line 22, in list_groups
>> paginate=10)
>>   File "/home/www-data/web2py/gluon/sqlhtml.py", line 1861, in grid
>> db = query._db
>> AttributeError: 'Rows' object has no attribute '_db'
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: new feature in trunk

2013-10-21 Thread webpypy

very nice 

what about the display of the tree in the view ? maybe as a column in a 
table.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: smartgrid linked list custom buttons

2013-10-21 Thread James Burke
Perhaps my question isn't very well defined.

When defining a linked table in a smartgrid like so:
linked_tables = dict(supply=['file'])

results in:

Files

I want it to be like this (how the view/edit/del buttons are):
Files

I know I could just define them in the links argument:
links = dict(supply=lambda row: A(SPAN(_class='icon icon-play'), SPAN(
'Files', title='Files', _class='buttontext button'), _class='button btn',_href
=URL('supply', 'file.supply', args=[row.id] )))

But I would think that the smartgrid linked table links are customisable? 
Is there a setting in the UI argument that will allow me to convert the 
links to buttons for example.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Question on SQLFORM.grid layout update

2013-10-21 Thread Sarbjit
Thanks Cliff,

Firebug was really powerful. It solved my problem in seconds.

-Sarbjit

On Monday, October 21, 2013 11:48:41 PM UTC+5:30, Cliff Kachinske wrote:
>
> You can use Firebug to look at the css classes and their attributes. You 
> can also  change them on the fly to see the results.
>
> On Monday, October 21, 2013 9:49:09 AM UTC-4, Sarbjit wrote:
>>
>> I am using SQLFORM.grid and smartgrid for viewing the records, I noticed 
>> that when I use view record button, the text seems to be on right side 
>> making the left side of the screen empty.
>>
>> It looks like 
>>  Name : 
>> John
>>Date of Birth : 
>> 21/10/1980
>>
>> I want it to look like:
>>
>> Name:  John
>> Date of Birth :   21/10/1980
>>
>> How can I modify the layout of grid and smartgrid, I tried locating the 
>> default settings in web2py.css but I was not able to figure out the proper 
>> section.
>>
>> Can some one please guide me on how this can be achieved.
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: smartgrid linked list custom buttons

2013-10-21 Thread Dave S


On Monday, October 21, 2013 3:44:16 PM UTC-7, James Burke wrote:
>
> Thanks Dave.
>
> Unfortunately they didn't use the term 'buttonification' in their thread. 
> =)
>
>

Perhaps not, but a GG search for "CSS button" turned up these 3 threads 
which might be relevant:

http://groups.google.com/d/topic/web2py/3XQzzZwZ8vk/discussion
http://groups.google.com/d/topic/web2py/TP2tRRaFyDM/discussion
http://groups.google.com/d/topic/web2py/z6VIrX6z9uk/discussion

June might be more than "a couple of months" back, so it might not be easy 
to browse to those topics.

/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Mercurial creating new apps?

2013-10-21 Thread Dave S
On Monday, October 21, 2013 4:34:08 PM UTC-7, User wrote:
>
> When I click the "Versioning" link I get "Sorry, could not find mercurial 
> installed" although I have TortoiseHg installed.  Does this work for you?
>
>
I'm running on a Linux system, so I have Mercurial without any Tortoises. 
 I might try on my laptop, but it has both THG and a non-THG Windows 
version of Mercurial, so that might not be conclusive.  The latter is 
available from the main Mercurial site, 

 which is only up to 2.6.
There are a couple of better known downloads for Windows installers for 
2.7.2, but I haven't tried them.

It is, of course, a bit of pain for the THG you already have not to be 
recognized.  There might be some path settings involved, since THG does 
make the command line tools available.

/dps



On Monday, October 21, 2013 5:56:28 PM UTC-4, Dave S wrote:
>
>> On Monday, October 21, 2013 12:15:05 PM UTC-7, User wrote:
>>>
>>> I have cloned the web2py mercurial repository and hg updated to 
>>> R-2.7.4.  I'm using TortoiseHg on windows.  Now when I want to create a new 
>>> application based on the welcome app how should I go about doing this? what 
>>> is the normal workflow for this?  I'm guessing the idea is that I would 
>>> create a new repository for each of my apps.
>>>  
>>> Can I still use the admin to create apps? Do I just manually copy the 
>>> welcome app and then hg init inside of it?
>>>  
>>>
>>
>> I believe you can do that, but the main admin app (reached via the "site" 
>> button on the Navbar, for instance) has a button for doing the copying for 
>> you.  This workflow is discussed in the Overview chapter of the book:
>> 
>>
>> Also, Web2py should detect your THG installation, and use the mercurial 
>> for it.  When you're in the admin view for your app, a "Versioning" button 
>> will show on the Navbar.  The page that takes you to is a simple wrapper 
>> for Mercurial; it will create a repository and allow you to commit, and 
>> show the commit history. If you only are doing linear development (in the 
>> Hg/THG sense of linear), then you don't need anything else, but you can 
>> point your THG browser to those repositories or use command line stuff if 
>> you need more power-user support.
>>
>> I'm still fairly new to Web2py, but the book and this forum have made me 
>> successful in setting up a simple service and some pages to display results 
>> and summaries.  It's worth working through the first couple of examples, 
>> and when you're comfortable with those launching into your project. 
>>  (Mercurial isn't part of the tutorial sessions, though, but you can use it 
>> with them.)
>>
>>
>> /dps
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: failed to compile file because: IndentationError at line # at char # expected an indented block

2013-10-21 Thread Massimo Di Pierro
Somebody should turn this into a web2py slice but here is some code example:

# in models/db.py
db.define_table(
'sale',
# optional fields ...
Field('amount_paid','double',default=0.0,writable=False,readable=False),
Field('balance_due','double',default=0.0,writable=False,readable=False),
Field('time_stamp','datetime',writable=False, readable=False, 
default=request.now),
Field('paid_on','datetime',writable=False, readable=False),
Field('payment_id',writable=False,readable=False))

# in controllers/default.py
def checkout():
form = SQLFORM(db.sale).process()
if form.accepted:
redirect(URL('pay',args=form.vars.id,hmac_key=STRIPE_SECRET_KEY))
return dict(form=form)

def pay():
if not URL.verify(request, hmac_key=STRIPE_SECRET_KEY):
redirect(URL('index'))
from gluon.contrib.stripe import StripeForm
response.flash = None # never show a response.flash 
  
order =db.sale(request.args(0,cast=int))
if not (order and order.balance_due):
session.flash = 'you paid already!'
redirect(URL('index'))
amount = order.balance_due
description ="your sale for [%s]" % (order.id)
form = StripeForm(
pk=STRIPE_PUBLISHABLE_KEY,
sk=STRIPE_SECRET_KEY,
amount=int(100*amount),
description=description).process()
if form.accepted:
auth.settings.mailer.send(
to=order.email,
subject='Sale Confirmation',
message='Your payment of $%.2f has been processed' % (amount))
order.update_record(balance_due=0,amount_paid=amount,
payment_id=form.response['id'],
paid_on=request.now)
redirect(URL('thank_you', vars=dict(code=form.response['id']),
 hmac_key=STRIPE_SECRET_KEY))
elif form.errors:
redirect(URL('pay_error'))
return dict(form=form)

def thank_you():
if not URL.verify(request, hmac_key=STRIPE_SECRET_KEY):
redirect(URL('index'))
receipt_id = request.vars.code
return locals()

def pay_error():
return locals()

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: failed to compile file because: IndentationError at line # at char # expected an indented block

2013-10-21 Thread raferbop
Thanks Massimo

On Monday, October 21, 2013 8:57:32 PM UTC-5, Massimo Di Pierro wrote:
>
> Unless you have a compelling reason to use authorize.net, consider using 
> stripe.com and the new gluon/contrib/stripe.py
>
> With stripe the card info never reaches your server and you are 
> automatically PCI compliant.
>
>
>
> On Monday, 21 October 2013 19:22:33 UTC-5, raferbop wrote:
>>
>>
>>
>> Good day Guys,
>>
>> I am currently trying to run the authorize.net credit processing 
>> example, but I am getting some indentation errors with the following lines 
>> of code;
>>
>> if form.accepts(request,session):
>> if process(form.vars.creditcard,form.vars.expiration,
>>total,form.vars.cvv,0.0,invoice,testmode=True):
>>
>> I followed the example to T, but not sure what am I doing wrong. Any help 
>> will be appreciated. Below is the code in its entirety.
>>
>> def buy():
>> if not session.cart:
>> session.flash = 'add something to the shopping cart'
>> redirect(URL('index'))
>> import uuid
>> from gluon.contrib.AuthorizeNet import process
>> invoice = str(uuid.uuid4())   
>> total = sum(db.product(id).price for id in session.cart.items())
>> form = SQLFORM.factory(
>>Field('creditcard', requires=IS_NOT_EMPTY()),
>>Field('expiration', requires=IS_MATCH('\d{2}/\d{4}')),
>>Field('cvv', requires=IS_MATCH('\d{3}')),
>>Field('shipping_address', requires=IS_NOT_EMPTY()),
>>Field('shipping_city', requires=IS_NOT_EMPTY()),
>>Field('shipping_state', requires=IS_NOT_EMPTY()),
>>Field('shipping_zip_code', 
>> requires=IS_MATCH('\d{5}(\-\d{4})?')))
>> if form.accepts(request,session):
>> if process(form.vars.creditcard,form.vars.expiration,
>>total,form.vars.cvv,0.0,invoice,testmode=True):
>>  
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: failed to compile file because: IndentationError at line # at char # expected an indented block

2013-10-21 Thread Massimo Di Pierro
Unless you have a compelling reason to use authorize.net, consider using 
stripe.com and the new gluon/contrib/stripe.py

With stripe the card info never reaches your server and you are 
automatically PCI compliant.



On Monday, 21 October 2013 19:22:33 UTC-5, raferbop wrote:
>
>
>
> Good day Guys,
>
> I am currently trying to run the authorize.net credit processing example, 
> but I am getting some indentation errors with the following lines of code;
>
> if form.accepts(request,session):
> if process(form.vars.creditcard,form.vars.expiration,
>total,form.vars.cvv,0.0,invoice,testmode=True):
>
> I followed the example to T, but not sure what am I doing wrong. Any help 
> will be appreciated. Below is the code in its entirety.
>
> def buy():
> if not session.cart:
> session.flash = 'add something to the shopping cart'
> redirect(URL('index'))
> import uuid
> from gluon.contrib.AuthorizeNet import process
> invoice = str(uuid.uuid4())   
> total = sum(db.product(id).price for id in session.cart.items())
> form = SQLFORM.factory(
>Field('creditcard', requires=IS_NOT_EMPTY()),
>Field('expiration', requires=IS_MATCH('\d{2}/\d{4}')),
>Field('cvv', requires=IS_MATCH('\d{3}')),
>Field('shipping_address', requires=IS_NOT_EMPTY()),
>Field('shipping_city', requires=IS_NOT_EMPTY()),
>Field('shipping_state', requires=IS_NOT_EMPTY()),
>Field('shipping_zip_code', 
> requires=IS_MATCH('\d{5}(\-\d{4})?')))
> if form.accepts(request,session):
> if process(form.vars.creditcard,form.vars.expiration,
>total,form.vars.cvv,0.0,invoice,testmode=True):
>  
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] failed to compile file because: IndentationError at line # at char # expected an indented block

2013-10-21 Thread raferbop


Good day Guys,

I am currently trying to run the authorize.net credit processing example, 
but I am getting some indentation errors with the following lines of code;

if form.accepts(request,session):
if process(form.vars.creditcard,form.vars.expiration,
   total,form.vars.cvv,0.0,invoice,testmode=True):

I followed the example to T, but not sure what am I doing wrong. Any help 
will be appreciated. Below is the code in its entirety.

def buy():
if not session.cart:
session.flash = 'add something to the shopping cart'
redirect(URL('index'))
import uuid
from gluon.contrib.AuthorizeNet import process
invoice = str(uuid.uuid4())   
total = sum(db.product(id).price for id in session.cart.items())
form = SQLFORM.factory(
   Field('creditcard', requires=IS_NOT_EMPTY()),
   Field('expiration', requires=IS_MATCH('\d{2}/\d{4}')),
   Field('cvv', requires=IS_MATCH('\d{3}')),
   Field('shipping_address', requires=IS_NOT_EMPTY()),
   Field('shipping_city', requires=IS_NOT_EMPTY()),
   Field('shipping_state', requires=IS_NOT_EMPTY()),
   Field('shipping_zip_code', 
requires=IS_MATCH('\d{5}(\-\d{4})?')))
if form.accepts(request,session):
if process(form.vars.creditcard,form.vars.expiration,
   total,form.vars.cvv,0.0,invoice,testmode=True):
 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: cache.action questions (views with db selects, and different views for logged-in users)

2013-10-21 Thread Anthony


> Niphlod, I'm not sure what you're referring to by the "user" parameter. 
> The closet parameters to "user" would be "session" and "public". But I 
> don't see these options helping to differentiate between logged in and 
> non-logged for caching.
>

The "session" arg doesn't differentiate between logged in states, but it 
can be used to cache a user-specific page -- you would need to add some 
logic to determine whether to do that. You can also make use of the 
"prefix" argument, and maybe set it to auth.user_id. But again, not sure 
it's a good idea to use server-side caching for every logged in user.
 

> Anthony, my problem still persists with your code; the "public" parameter 
> does not seem to be the proper parameter for this problem.
>

The "public" parameter is not intended to differentiate between logged in 
states, only to ensure the cached page remains private to the user. 

For example, when a user first hits the page (not logged-in), the public 
> parameter will be set to True. This will cache the page in it's non-logged 
> in state. If the user then logs in, and hits the page again, the browser 
> will serve the non-logged-in version of the page from cache.
>

True. Is it feasible to add an arg to the URL to flag the logged in state? 
Otherwise, as you have figured out, there is no way for the browser to know 
a new version of the page must be requested. I suppose you could use Etags 
or last-modified and have the server respond with a 304, but that still 
involves a round trip to the server.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Mercurial creating new apps?

2013-10-21 Thread User
When I click the "Versioning" link I get "Sorry, could not find mercurial 
installed" although I have TortoiseHg installed.  Does this work for you?

On Monday, October 21, 2013 5:56:28 PM UTC-4, Dave S wrote:

> On Monday, October 21, 2013 12:15:05 PM UTC-7, User wrote:
>>
>> I have cloned the web2py mercurial repository and hg updated to R-2.7.4.  
>> I'm using TortoiseHg on windows.  Now when I want to create a new 
>> application based on the welcome app how should I go about doing this? what 
>> is the normal workflow for this?  I'm guessing the idea is that I would 
>> create a new repository for each of my apps.
>>  
>> Can I still use the admin to create apps? Do I just manually copy the 
>> welcome app and then hg init inside of it?
>>  
>>
>
> I believe you can do that, but the main admin app (reached via the "site" 
> button on the Navbar, for instance) has a button for doing the copying for 
> you.  This workflow is discussed in the Overview chapter of the book:
> 
>
> Also, Web2py should detect your THG installation, and use the mercurial 
> for it.  When you're in the admin view for your app, a "Versioning" button 
> will show on the Navbar.  The page that takes you to is a simple wrapper 
> for Mercurial; it will create a repository and allow you to commit, and 
> show the commit history. If you only are doing linear development (in the 
> Hg/THG sense of linear), then you don't need anything else, but you can 
> point your THG browser to those repositories or use command line stuff if 
> you need more power-user support.
>
> I'm still fairly new to Web2py, but the book and this forum have made me 
> successful in setting up a simple service and some pages to display results 
> and summaries.  It's worth working through the first couple of examples, 
> and when you're comfortable with those launching into your project. 
>  (Mercurial isn't part of the tutorial sessions, though, but you can use it 
> with them.)
>
>
> /dps
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: cache.action questions (views with db selects, and different views for logged-in users)

2013-10-21 Thread Mark Li
Thanks Niphlod and Anthony! That answered my question about caching views 
with database selects. However, my problem with client-side caching 
differently for logged-in and non-logged in users is still a problem.

Niphlod, I'm not sure what you're referring to by the "user" parameter. The 
closet parameters to "user" would be "session" and "public". But I don't 
see these options helping to differentiate between logged in and non-logged 
for caching. Doesn't "session" only add a session id key for server-side 
caching, and "public" only determine whether a cache is useable on a single 
user's machine, or the user's network?

Anthony, my problem still persists with your code; the "public" parameter 
does not seem to be the proper parameter for this problem.

For example, when a user first hits the page (not logged-in), the public 
parameter will be set to True. This will cache the page in it's non-logged 
in state. If the user then logs in, and hits the page again, the browser 
will serve the non-logged-in version of the page from cache.

No matter what the value of "public" is (unless the browser doesn't cache 
at all for public=false), if the user hits the page in either 
logged-in/non-logged in state, and goes to the same page later in the 
opposite state, the browser will serve the previously cached version of 
that page (which will be in the wrong logged-in/non-logged in state).

The "public" parameter, if set to False, is helpful in preventing cached 
logged-in versions of the site from being the same across users. However, 
for each user, it does not help differentiate between logged in and 
non-logged cache pages.


I've done some more research, and there doesn't seem to be any 
straightforward or practical ways of doing this. The main problem is that 
the browser can't tell whether a cached page is logged-in/not-logged in 
(since it's the same URL). Let me know if I'm missing something here, I'd 
like to take advantage of cache.action.



On Monday, October 21, 2013 6:07:56 AM UTC-7, Anthony wrote:
>
>
> For users who aren't logged in, the pages would be the same. However, if a 
>> user is logged in, then there are links to the users' profile, as well as a 
>> logout link; thus making the page different for every user, and different 
>> for logged-in vs. non-logged-in users. Is there any way to effectively 
>> cache these pages, or only cache the non-logged in page for non-logged in 
>> viewers?
>>
>
> cache.action does two things -- it sends appropriate response headers to 
> the browser to enable client-side caching, and it (optionally) does 
> server-side caching via the web2py cache mechanism. You might want to avoid 
> doing per-user server-side caching, as that will start to fill up server 
> memory, and you'd have to make sure you manually clear cached values 
> periodically. Maybe consider something like:
>
> @cache.client(cache_model=cache.ram if not auth.is_logged_in() else None,
>   public=not auth.is_logged_in(), ...)
>
> That will do server-side caching of the non-logged-in page only, and it 
> will set public client-side caching to False for logged in users.
>  
>
>> Secondly, cache.action can't be used to cache views with database 
>> selects. However, if the database select was converted to a list/dict, with 
>> as_list() or as_dict(), would caching the page with cache.action be 
>> possible (this would make it pickleable as a regular dictionary)?
>>
>
> Not sure what you mean -- can you show some code? cache.action caches only 
> the output of the decorated function (and only if cache_model is specified 
> -- otherwise, all it does is send headers to the browser to enable 
> client-side caching).
>
> Anthony
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: smartgrid linked list custom buttons

2013-10-21 Thread James Burke
Thanks Dave.

Unfortunately they didn't use the term 'buttonification' in their thread. =)


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: smartgrid linked list custom buttons

2013-10-21 Thread Dave S
On Monday, October 21, 2013 2:24:02 PM UTC-7, James Burke wrote:
>
> Hi,
>
> I'd like to have my links to child tables in the smartgrid displayed as 
> buttons (like view/edit/delete) rather than links. I'd also like to add 
> icons.
>
> Is there an specific way to do this, or do I need to create them using 
> links instead?
>
>
I think it is a matter of specifying the CSS you want.

This thread discusses a tag manager, which isn't part of Web2py, but does 
demonstrate wrapping short bits of text with CSS.


ISTR that there are threads in the past couple of months that discuss 
buttonification of form helpers, and my vague memory says the answers were 
easy, but I can't point to a specific post without doing a search.

/dps

 

> Cheers,
>
> -James
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] OFF Topic - json online generator for testing purpose

2013-10-21 Thread António Ramos
Nice to test some code against a json feed

http://www.filltext.com/

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Mercurial creating new apps?

2013-10-21 Thread Dave S
On Monday, October 21, 2013 12:15:05 PM UTC-7, User wrote:
>
> I have cloned the web2py mercurial repository and hg updated to R-2.7.4.  
> I'm using TortoiseHg on windows.  Now when I want to create a new 
> application based on the welcome app how should I go about doing this? what 
> is the normal workflow for this?  I'm guessing the idea is that I would 
> create a new repository for each of my apps.
>  
> Can I still use the admin to create apps? Do I just manually copy the 
> welcome app and then hg init inside of it?
>  
>

I believe you can do that, but the main admin app (reached via the "site" 
button on the Navbar, for instance) has a button for doing the copying for 
you.  This workflow is discussed in the Overview chapter of the book:


Also, Web2py should detect your THG installation, and use the mercurial for 
it.  When you're in the admin view for your app, a "Versioning" button will 
show on the Navbar.  The page that takes you to is a simple wrapper for 
Mercurial; it will create a repository and allow you to commit, and show 
the commit history. If you only are doing linear development (in the Hg/THG 
sense of linear), then you don't need anything else, but you can point your 
THG browser to those repositories or use command line stuff if you need 
more power-user support.

I'm still fairly new to Web2py, but the book and this forum have made me 
successful in setting up a simple service and some pages to display results 
and summaries.  It's worth working through the first couple of examples, 
and when you're comfortable with those launching into your project. 
 (Mercurial isn't part of the tutorial sessions, though, but you can use it 
with them.)


/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: grid in component only works in Firefox

2013-10-21 Thread Niphlod
this means that in Opera the product_addon.load shows the  tag ?

On Monday, October 21, 2013 11:26:36 PM UTC+2, Jim S wrote:
>
> It works fine.  Also, the data input elements are all displayed 
> appropriately, just doesn't work when I click on submit to try to add 
> something.  But, works fine in Firefox.
>
>
> On Mon, Oct 21, 2013 at 4:07 PM, Niphlod  >wrote:
>
>> how can opera chunk out part of html ?
>> if you point opera to 
>>
>> /infocenter/applications/product_addon.load?workorderId...
>>
>> what do you get back ?
>>
>> On Monday, October 21, 2013 10:35:41 PM UTC+2, Jim S wrote:
>>>
>>> Found a little more.  Look at the two attachments.  One is the generated 
>>> html from Opera and the other from Firefox.  The opera one is missing the 
>>> Form element.
>>>
>>> -Jim
>>>
>>> On Monday, October 21, 2013 2:54:47 PM UTC-5, Jim S wrote:

 I have the following in my component controller:

 form = SQLFORM.factory(Field('**productSiteId', db.productSite, 
 label='Add-on',
  required=True, requires=requires),
Field('quantity', 'decimal(9,4)', 
 label='at'),
_id='addonForm',
_formname='addonForm')

 if form.process(formname='**addonForm').accepted:

 When new record is added to the controller the form.process...  works 
 fine if using Firefox, but not when using Chrome/Opera or IE.  What am I 
 missing to make this work reliably?  The other three browsers all return 
 False when adding a new record.  Firefox processes it as I'd expect it to.

  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/ssNKsOBOP8g/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Interactive maps using HTML5 data tags, no coding!

2013-10-21 Thread Niphlod
this is pretty awesome.

On Monday, October 21, 2013 11:23:38 PM UTC+2, Timmie wrote:
>
> Hello, 
> this is an ideal library for working with web2py & maps: 
>
> Interactive maps using HTML5 data tags, no coding! 
> http://geo5.org/ 
>
> Kind regards, 
> Timmie 
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: grid in component only works in Firefox

2013-10-21 Thread Jim S
Should also mention that I updated to the latest web2py this morning, 
running 2.7.4-stable+timestamp.2013.10.21.14.31.25.

-Jim

On Monday, October 21, 2013 4:26:36 PM UTC-5, Jim S wrote:
>
> It works fine.  Also, the data input elements are all displayed 
> appropriately, just doesn't work when I click on submit to try to add 
> something.  But, works fine in Firefox.
>
>
> On Mon, Oct 21, 2013 at 4:07 PM, Niphlod  wrote:
>
>> how can opera chunk out part of html ?
>> if you point opera to 
>>
>> /infocenter/applications/product_addon.load?workorderId...
>>
>> what do you get back ?
>>
>> On Monday, October 21, 2013 10:35:41 PM UTC+2, Jim S wrote:
>>>
>>> Found a little more.  Look at the two attachments.  One is the generated 
>>> html from Opera and the other from Firefox.  The opera one is missing the 
>>> Form element.
>>>
>>> -Jim
>>>
>>> On Monday, October 21, 2013 2:54:47 PM UTC-5, Jim S wrote:

 I have the following in my component controller:

 form = SQLFORM.factory(Field('**productSiteId', db.productSite, 
 label='Add-on',
  required=True, requires=requires),
Field('quantity', 'decimal(9,4)', 
 label='at'),
_id='addonForm',
_formname='addonForm')

 if form.process(formname='**addonForm').accepted:

 When new record is added to the controller the form.process...  works 
 fine if using Firefox, but not when using Chrome/Opera or IE.  What am I 
 missing to make this work reliably?  The other three browsers all return 
 False when adding a new record.  Firefox processes it as I'd expect it to.

  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/ssNKsOBOP8g/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: grid in component only works in Firefox

2013-10-21 Thread Jim Steil
It works fine.  Also, the data input elements are all displayed
appropriately, just doesn't work when I click on submit to try to add
something.  But, works fine in Firefox.


On Mon, Oct 21, 2013 at 4:07 PM, Niphlod  wrote:

> how can opera chunk out part of html ?
> if you point opera to
>
> /infocenter/applications/product_addon.load?workorderId...
>
> what do you get back ?
>
> On Monday, October 21, 2013 10:35:41 PM UTC+2, Jim S wrote:
>>
>> Found a little more.  Look at the two attachments.  One is the generated
>> html from Opera and the other from Firefox.  The opera one is missing the
>> Form element.
>>
>> -Jim
>>
>> On Monday, October 21, 2013 2:54:47 PM UTC-5, Jim S wrote:
>>>
>>> I have the following in my component controller:
>>>
>>> form = SQLFORM.factory(Field('**productSiteId', db.productSite,
>>> label='Add-on',
>>>  required=True, requires=requires),
>>>Field('quantity', 'decimal(9,4)', label='at'),
>>>_id='addonForm',
>>>_formname='addonForm')
>>>
>>> if form.process(formname='**addonForm').accepted:
>>>
>>> When new record is added to the controller the form.process...  works
>>> fine if using Firefox, but not when using Chrome/Opera or IE.  What am I
>>> missing to make this work reliably?  The other three browsers all return
>>> False when adding a new record.  Firefox processes it as I'd expect it to.
>>>
>>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/ssNKsOBOP8g/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] smartgrid linked list custom buttons

2013-10-21 Thread James Burke
Hi,

I'd like to have my links to child tables in the smartgrid displayed as 
buttons (like view/edit/delete) rather than links. I'd also like to add 
icons.

Is there an specific way to do this, or do I need to create them using 
links instead?

Cheers,

-James

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Interactive maps using HTML5 data tags, no coding!

2013-10-21 Thread Tim Michelsen
Hello,
this is an ideal library for working with web2py & maps:

Interactive maps using HTML5 data tags, no coding!
http://geo5.org/

Kind regards,
Timmie

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Bootstrap 2.2.2 / 2.3.2

2013-10-21 Thread Niphlod
PR sent for 2.3.2 .

PS: maybe we should move the discussion to web2py-developers on the plans 
to easy up working with new css frameworks and web2py

On Monday, October 21, 2013 10:55:34 PM UTC+2, Paolo Caruccio wrote:
>
> twbs versions after the 2.2.2 up to 2.3.2 did not introduce significant 
> changes. Version 3.0, instead, is a revolution. We can say that is a 
> different framework. Consequently, although it is easy to create a layout 
> based on twbs 3.0, it is complicated to adjust some components that are 
> pre-built in web2py such as forms and grids to name the main ones.
> In a previous 
> discussionNiphlod
>  and Anthony had suggested to create a file in gluon/contrib.
> Personally, I started to write some code in a module but it's at an early 
> stage. I do not know if anyone else is working on this.
>
> Edit: I forgot the most important thing +1 to 2.3.2
>
>
> Il giorno lunedì 21 ottobre 2013 21:58:06 UTC+2, Niphlod ha scritto:
>>
>> Need to change all widgets to pass to bootstrap3. I remember someone 
>> working on itbut of course it's keeping for himself :-P
>>
>> Before doing that (pass to 3), we should figure out:
>> - something to set all methods for formstyle to be homogeneous among all 
>> the app
>> - a contrib "way" to make module for formstyles and widgets
>>
>> Passing from 2.2.2 to 2.3.2 is harmless, at least for my apps.
>>
>> On Monday, October 21, 2013 9:29:38 PM UTC+2, Massimo Di Pierro wrote:
>>>
>>> If somebody sends me a git pull request, I will apply it but shouldn't 
>>> we jump to bootstrap 3?
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: grid in component only works in Firefox

2013-10-21 Thread Niphlod
how can opera chunk out part of html ?
if you point opera to 

/infocenter/applications/product_addon.load?workorderId...

what do you get back ?

On Monday, October 21, 2013 10:35:41 PM UTC+2, Jim S wrote:
>
> Found a little more.  Look at the two attachments.  One is the generated 
> html from Opera and the other from Firefox.  The opera one is missing the 
> Form element.
>
> -Jim
>
> On Monday, October 21, 2013 2:54:47 PM UTC-5, Jim S wrote:
>>
>> I have the following in my component controller:
>>
>> form = SQLFORM.factory(Field('productSiteId', db.productSite, 
>> label='Add-on',
>>  required=True, requires=requires),
>>Field('quantity', 'decimal(9,4)', label='at'),
>>_id='addonForm',
>>_formname='addonForm')
>>
>> if form.process(formname='addonForm').accepted:
>>
>> When new record is added to the controller the form.process...  works 
>> fine if using Firefox, but not when using Chrome/Opera or IE.  What am I 
>> missing to make this work reliably?  The other three browsers all return 
>> False when adding a new record.  Firefox processes it as I'd expect it to.
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Bootstrap 2.2.2 / 2.3.2

2013-10-21 Thread Paolo Caruccio
twbs versions after the 2.2.2 up to 2.3.2 did not introduce significant 
changes. Version 3.0, instead, is a revolution. We can say that is a 
different framework. Consequently, although it is easy to create a layout 
based on twbs 3.0, it is complicated to adjust some components that are 
pre-built in web2py such as forms and grids to name the main ones.
In a previous 
discussionNiphlod
 and Anthony had suggested to create a file in gluon/contrib.
Personally, I started to write some code in a module but it's at an early 
stage. I do not know if anyone else is working on this.

Il giorno lunedì 21 ottobre 2013 21:58:06 UTC+2, Niphlod ha scritto:
>
> Need to change all widgets to pass to bootstrap3. I remember someone 
> working on itbut of course it's keeping for himself :-P
>
> Before doing that (pass to 3), we should figure out:
> - something to set all methods for formstyle to be homogeneous among all 
> the app
> - a contrib "way" to make module for formstyles and widgets
>
> Passing from 2.2.2 to 2.3.2 is harmless, at least for my apps.
>
> On Monday, October 21, 2013 9:29:38 PM UTC+2, Massimo Di Pierro wrote:
>>
>> If somebody sends me a git pull request, I will apply it but shouldn't we 
>> jump to bootstrap 3?
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Bootstrap 2.2.2 / 2.3.2

2013-10-21 Thread Niphlod
Need to change all widgets to pass to bootstrap3. I remember someone 
working on itbut of course it's keeping for himself :-P

Before doing that (pass to 3), we should figure out:
- something to set all methods for formstyle to be homogeneous among all 
the app
- a contrib "way" to make module for formstyles and widgets

Passing from 2.2.2 to 2.3.2 is harmless, at least for my apps.

On Monday, October 21, 2013 9:29:38 PM UTC+2, Massimo Di Pierro wrote:
>
> If somebody sends me a git pull request, I will apply it but shouldn't we 
> jump to bootstrap 3?
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] grid in component only works in Firefox

2013-10-21 Thread Jim S
I have the following in my component controller:

form = SQLFORM.factory(Field('productSiteId', db.productSite, 
label='Add-on',
 required=True, requires=requires),
   Field('quantity', 'decimal(9,4)', label='at'),
   _id='addonForm',
   _formname='addonForm')

if form.process(formname='addonForm').accepted:

When new record is added to the controller the form.process...  works fine 
if using Firefox, but not when using Chrome/Opera or IE.  What am I missing 
to make this work reliably?  The other three browsers all return False when 
adding a new record.  Firefox processes it as I'd expect it to.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Bootstrap 2.2.2 / 2.3.2

2013-10-21 Thread Ykä Marjanen
I would vote for bootstrap 3 as it is simpler to implement and use.

With the current guidance and the layout template it is pretty easy to 
customize to any framework already. So I would only focus on improving the 
documentation, especially for customizing the forms and errors.

Then people can choose any front end framework.

Ykä

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: new feature in trunk

2013-10-21 Thread Richard Vézina
That cool Massimo!

Thanks for this...

Richard


On Mon, Oct 21, 2013 at 3:26 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Actually mine was an example. as_trees() does not dictate a model. The
> only requirement is that the model must have a self referencing field. You
> can call it any way you like it. You can pass its name as first argument of
> as_trees().
>
>
>
> On Monday, 21 October 2013 05:55:44 UTC-5, Niphlod wrote:
>>
>> ouch the easiest model to update, the worst to query.
>> I was going to post a plugin for threaded comments but then life kicked
>> in with lots of other requirements, and then other things got priority in
>> web2py.
>> I don't think this will be compatible with what I've done 'cause I use a
>> totally different model, but alas, this is better than no plugin at all.
>>
>> On Monday, October 21, 2013 5:57:00 AM UTC+2, Massimo Di Pierro wrote:
>>>
>>> It is a recurrent problem that is displays tree-like structures like
>>> threaded comments. For example:
>>>
>>> db.define_table('post',
>>> Field('parent_id','reference post'),
>>> Field('body'))
>>>
>>> where each comment has a body and a parent_id (parent_id==None for the
>>> root comment(s))
>>> We can populate the comments with some dummy data:
>>>
>>> def make_up_data():
>>> import random, uuid
>>> ids = [None]
>>> for k in range(100):
>>> ids.append(db.post.insert(**parent_id=random.choice(ids),
>>>   body=str(uuid.uuid4(
>>> if k==0:
>>> ids.pop(None)
>>> if db(db.post).isempty(): make_up_data()
>>>
>>> The new feature in trunk allows you to select the comments are organized
>>> them into trees.
>>>
>>>roots = db(db.post).select().as_trees(**)
>>>
>>> This returns a list of parent nodes. Each not stores its own children,
>>> recursively.
>>>
>>> Now you can print them all using a tree traversal:
>>>
>>> def show(row,n=0):
>>> return '  '*n+row.body+'\n'+''.join(**show(c,n+1) for c in
>>> row.children)
>>> print show(roots[0])
>>>
>>> Notice you can specify the name of the parent field:
>>>
>>> roots = db(db.post).select().as_trees(**parent_name="parent_id")
>>>
>>> Please let me know if you think this can be improved.
>>>
>>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Bootstrap 2.2.2 / 2.3.2

2013-10-21 Thread Massimo Di Pierro
If somebody sends me a git pull request, I will apply it but shouldn't we 
jump to bootstrap 3?

On Monday, 21 October 2013 11:06:06 UTC-5, Junior Phanter wrote:
>
> I use Bootstrap v2.3.2 on Web2py.
> It's ok.
>
>
> 2013/10/21 Gael Princivalle >
>
>> Hi.
>>
>> Is it possible to use Bootstrap 2.3.2 on web2py ? I would like to do it 
>> just to have an easiest css Bootstrap file to read/modify. With web2py 
>> there's just the min 2.2.2 version that's not so easy to modify.
>>
>> Thanks.
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Help me test model subfolders

2013-10-21 Thread Massimo Di Pierro
I do not understand. You have

 r'^\db\.py$',

shouldn't this be?

 r'^db\.py$',





On Monday, 21 October 2013 04:20:01 UTC-5, Johann Spies wrote:
>
> Hallo Massimo,
>
>
> There is a problem with sorting of model subfolders in 2.7.2. We made some 
>> changes in trunk. 
>>
>
> After this morning's updates from the trunk I got problems for the first 
> time which reflected a sorting problem:
>
> Traceback (most recent call last):
>
>   File "/home/js/web2py/gluon/restricted.py", line 217, in restricted
>
> exec ccode in environment
>   File "/home/js/web2py/applications/nkb/models/akb/akb.py", line 22, in 
> 
>
> db.executesql("set search_path to akb, public;")
> NameError: name 'db' is not defined
>
>
>  And my models directory:
>
> -rw-r--r--  1 js js  1196 Okt 11 07:43 0.py
> -rw-r--r--  1 js js  1354 Okt 10 23:02 0.py.orig
> drwxr-xr-x  2 js js  4096 Okt  8 14:44 akb
> -rw-r--r--  1 js js  7845 Okt 11 07:44 dbcommon.py
> -rw-r--r--  1 js js  7994 Okt 10 23:13 dbcommon.py.orig
> -rw-r--r--  1 js js  9459 Okt 11 07:44 db.py
> -rw-r--r--  1 js js  9504 Okt 10 23:07 db.py.orig
> drwxr-xr-x  2 js js  4096 Okt 21 10:41 isi
> -rw-r--r--  1 js js 11652 Okt  8 14:44 menu.py
> -rw-r--r--  1 js js 10060 Aug 29 09:30 menu.py.orig
> drwxr-xr-x  2 js js  4096 Okt  8 14:44 sabinet
>
>
> Please help me check that:
>>
>> [ ] if you have a byte-compiled app, it still runs fine
>> [ ] if you byte-compiler an app with trunk, it runs fine
>> [ ] models are executed in this order:
>> models/*.py (alphabetically) then  
>> models/*.py(alphabetically) then
>> models///*.py (also alphabetically)
>> [ ] if you set response.models_to_run (described in the book) the filter 
>> works correctly for normal apps and byte code compiled apps.
>>
>> None of the above worked for me.
>   
>
>> I have tried the following in 0.py but it did not solve the problem:
>
> response.models_to_run = [
> r'^\0\.py$',
> r'^\db\.py$',
> r'^\dbcommon\.py$', 
> r'^%s/\w+\.py$' % request.controller,
> r'^%s/%s/\w+\.py$' % (request.controller, request.function)
> ]
>
> In the end I go the app working again by doing:
>  
> > hg rename db.py 0db.py
> > hg rename dbcommon.py 0dbcommon.py 
>  
>
> Regards
> Johann
>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: new feature in trunk

2013-10-21 Thread Massimo Di Pierro
Actually mine was an example. as_trees() does not dictate a model. The only 
requirement is that the model must have a self referencing field. You can 
call it any way you like it. You can pass its name as first argument of 
as_trees(). 



On Monday, 21 October 2013 05:55:44 UTC-5, Niphlod wrote:
>
> ouch the easiest model to update, the worst to query. 
> I was going to post a plugin for threaded comments but then life kicked in 
> with lots of other requirements, and then other things got priority in 
> web2py.
> I don't think this will be compatible with what I've done 'cause I use a 
> totally different model, but alas, this is better than no plugin at all.
>
> On Monday, October 21, 2013 5:57:00 AM UTC+2, Massimo Di Pierro wrote:
>>
>> It is a recurrent problem that is displays tree-like structures like 
>> threaded comments. For example:
>>
>> db.define_table('post',
>> Field('parent_id','reference post'),
>> Field('body'))
>>
>> where each comment has a body and a parent_id (parent_id==None for the 
>> root comment(s))
>> We can populate the comments with some dummy data:
>>
>> def make_up_data():
>> import random, uuid
>> ids = [None]
>> for k in range(100):
>> ids.append(db.post.insert(parent_id=random.choice(ids),
>>   body=str(uuid.uuid4(
>> if k==0:
>> ids.pop(None)
>> if db(db.post).isempty(): make_up_data()
>>
>> The new feature in trunk allows you to select the comments are organized 
>> them into trees.
>>
>>roots = db(db.post).select().as_trees()
>>
>> This returns a list of parent nodes. Each not stores its own children, 
>> recursively.
>>
>> Now you can print them all using a tree traversal:
>>
>> def show(row,n=0):
>> return '  '*n+row.body+'\n'+''.join(show(c,n+1) for c in 
>> row.children)
>> print show(roots[0])
>>
>> Notice you can specify the name of the parent field:
>>
>> roots = db(db.post).select().as_trees(parent_name="parent_id")
>>
>> Please let me know if you think this can be improved.
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Application not OK after upgrade from 2.5.1 to any posterior release...

2013-10-21 Thread Massimo Di Pierro
Can you try delete all session files?

On Monday, 21 October 2013 02:58:13 UTC-5, pkomor wrote:
>
> Hello. I have an application that runs fine in web2py 2.5.1, I have 
> upgraded web2py, I disabled migrations and activated after (I don't have 
> fields in the model without the param length), but now when I login with an 
> user created during the initial setup application, all is fine, but when 
> any other user try to login there's not redirection to the index page and 
> web2py hangs, with a "top" linux command I see the python process is 
> increasing more 100%. I use ldap auth and I tried debugging but I'm not 
> able to know what is wrong. Thanks.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Mercurial creating new apps?

2013-10-21 Thread User
I have cloned the web2py mercurial repository and hg updated to R-2.7.4.  
I'm using TortoiseHg on windows.  Now when I want to create a new 
application based on the welcome app how should I go about doing this? what 
is the normal workflow for this?  I'm guessing the idea is that I would 
create a new repository for each of my apps.
 
Can I still use the admin to create apps? Do I just manually copy the 
welcome app and then hg init inside of it?
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: ERROR: pickle data was truncated; db table name error.

2013-10-21 Thread Kalvis Bruns
Thank you, I deleted the file, and changed the db.define_table like this:

db.define_table('NFobj',

 ...,

 migrate = False, fake_migrate = True
)

As long as I leave these settings like this, everything works. 
I wonder is there any case or an action witch I will not be able to 
accomplish in the future due to these settings? 

I am not so experienced with web2py. I haven't tried to do the database 
migration, but what If want to do the database migration in the future? 
Does the migrate=False setting restricts web2py to do the migration? 

On Monday, October 21, 2013 1:50:12 AM UTC+3, Massimo Di Pierro wrote:
>
> Have you tried?
>
> remove the databses/._NFobj.table and change
>
> db.define_table('NFobj',
>
> fake_migrate=True,
> )
>
>
> On Sunday, 20 October 2013 15:16:39 UTC-5, Kalvis Bruns wrote:
>>
>> I have a problem with my db tables definition. In db.py file there seems 
>> to be a problem with the table with name "NFCobj". I get the "> 'cPickle.UnpicklingError'> pickle data was truncated" error If I have the 
>> db.define_table command, with table name "NFCobj" like this:
>>
>> #NFCobj table
>> db.define_table('NFCobj',
>> Field('name','string',required=True),
>> Field('href','string', required=True),
>> Field('active','boolean'),
>> format='%(name)s'
>> )
>>
>> when I change the name to for example "NFobj", everything is OK:
>>
>> #NFCobj table
>> db.define_table('NFobj',
>> Field('name','string',required=True),
>> Field('href','string', required=True),
>> Field('active','boolean'),
>> format='%(name)s'
>> )
>>
>>
>> Below You can see a more datailed error description:
>>  pickle data was 
>> truncatedVersionweb2py™Version 
>> 2.7.4-stable+timestamp.2013.10.14.15.16.29PythonPython 2.7.5: 
>> D:\programming\python\web2py\web2py.exe (prefix: 
>> D:\programming\python\web2py)Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>>
>> Traceback (most recent call last):
>>   File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line 217, 
>> in restricted
>>   File "D:/programming/python/web2py/applications/linkNFC/models/db.py" 
>> , line 26, in 
>> 
>>   File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 7935, in 
>> define_table
>>   File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 7972, in 
>> lazy_define_table
>>   File "/home/mdipierro/make_web2py/web2py/gluon/dal.py", line 1020, in 
>> create_table
>> UnpicklingError: pickle data was truncated
>>
>>
>> I have already tried to delete all web2py directory, and reinstall a new 
>> fresh installation, got the last working version of the application from 
>> the bitbucket, still cant solve this issue.
>>
>>  It seems that there are some temp data or something else left somewhere 
>> on the local PC where I'm testing this application. Tommorrow I will try to 
>> run the same application from different computer. I predict that I won't be 
>> able to repeat this issue on fifferent PC.
>>
>> Please can somebody help me resolve this issue?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: grid: readable for columns and backgroundcolors for rows

2013-10-21 Thread Martin Weissenboeck
Good idea, thank you!


2013/10/21 Cliff Kachinske 

> For question #1, parse the request.args. I use the following with
> smartgrid, but grid should work similar:
>
> def index():
> fields = None # Shows all fields
> if len (request.args) > 2 and request.args = ['sometable', 'new',
> 'sometable']
> fields = [db.sometable.this, db.sometable.that,
> db.sometable.the_other]
> elif len(request.args) > 3 and request.args(0) == 'sometable' and \
>   request.args(1) == 'edit' and request.args(2) == 'sometable':
> fields = [#some list of fields you want to show on edit
> ]
> elif # other sets of request.args
> else: # falls through to the list of items in the table
> fields = [# the list of fields you want to show on the parent grid
> ]
> form = SQLFORM.grid(db.sometable, fields=fields ...#
> return dict(form=form)
>
>
> On Sunday, October 20, 2013 8:26:26 AM UTC-4, mweissen wrote:
>>
>> Hi,
>>
>> I have a SQLFORM.grid with details=True. A click on the "details"-ikon
>> (the magnifier) shows another TABLE or SQLFORM.
>>
>> Two problems:
>>
>> (1) I have one column with a lot details, which should not be visible in
>> the grid, but should be visible in the second table/sqlform.
>>
>> (2) I want to have even/odd colored rows: the grid shows two colors as
>> background, the table only one.
>>
>> Any ideas?
>> Regards, Martin
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: grid: readable for columns and backgroundcolors for rows

2013-10-21 Thread Cliff Kachinske
For question #1, parse the request.args. I use the following with 
smartgrid, but grid should work similar:

def index():
fields = None # Shows all fields
if len (request.args) > 2 and request.args = ['sometable', 'new', 
'sometable']
fields = [db.sometable.this, db.sometable.that, 
db.sometable.the_other]
elif len(request.args) > 3 and request.args(0) == 'sometable' and \
  request.args(1) == 'edit' and request.args(2) == 'sometable':
fields = [#some list of fields you want to show on edit
]
elif # other sets of request.args
else: # falls through to the list of items in the table
fields = [# the list of fields you want to show on the parent grid
]
form = SQLFORM.grid(db.sometable, fields=fields ...#
return dict(form=form)


On Sunday, October 20, 2013 8:26:26 AM UTC-4, mweissen wrote:
>
> Hi,
>
> I have a SQLFORM.grid with details=True. A click on the "details"-ikon 
> (the magnifier) shows another TABLE or SQLFORM.
>
> Two problems:
>
> (1) I have one column with a lot details, which should not be visible in 
> the grid, but should be visible in the second table/sqlform.
>
> (2) I want to have even/odd colored rows: the grid shows two colors as 
> background, the table only one. 
>
> Any ideas?
> Regards, Martin
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Question on SQLFORM.grid layout update

2013-10-21 Thread Cliff Kachinske
You can use Firebug to look at the css classes and their attributes. You 
can also  change them on the fly to see the results.

On Monday, October 21, 2013 9:49:09 AM UTC-4, Sarbjit wrote:
>
> I am using SQLFORM.grid and smartgrid for viewing the records, I noticed 
> that when I use view record button, the text seems to be on right side 
> making the left side of the screen empty.
>
> It looks like 
>  Name : 
> John
>Date of Birth : 
> 21/10/1980
>
> I want it to look like:
>
> Name:  John
> Date of Birth :   21/10/1980
>
> How can I modify the layout of grid and smartgrid, I tried locating the 
> default settings in web2py.css but I was not able to figure out the proper 
> section.
>
> Can some one please guide me on how this can be achieved.
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Recipe - How to add/remove items from a popup windows

2013-10-21 Thread Fernando Ruscitti

Hi. I'm working on an application where I have a main window with several 
fields and Objetives. The objetives should be selected from a popup windows 
(or maybe a opending div) when the user click 'add/remove objetives'.
Do you know what is the best way to manage this from web2py?

The steps are:

Open a div/popup with a list populated from a query with check boxes to 
select/deselect the items.
When the user submits on the popup, it should close and refresh the list of 
objetives selected in the main window.

Thanks very much.
Regards;
Fernando.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Bootstrap 2.2.2 / 2.3.2

2013-10-21 Thread Junior Phanter
I use Bootstrap v2.3.2 on Web2py.
It's ok.


2013/10/21 Gael Princivalle 

> Hi.
>
> Is it possible to use Bootstrap 2.3.2 on web2py ? I would like to do it
> just to have an easiest css Bootstrap file to read/modify. With web2py
> there's just the min 2.2.2 version that's not so easy to modify.
>
> Thanks.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py and PIL: The _imaging C module is not installed

2013-10-21 Thread Leonel Câmara
Remove PIL from your app modules folder and just add it to your python 
installation by simply installing it.

I would also recommend going with pillow instead of regular PIL as they 
fixed quite a lot of very old bugs.

You can get a windows pillow version here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow

Afterwards, restart web2py and you should be good to go.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Problems with Scheduler/ComfortScheduler Monitor setup on a different server than website

2013-10-21 Thread Niphlod
uhm. what if you do

{{=PRE(r_.run_output)}}

Without an example it's hard to guess what should be the correct "style".

On Monday, October 21, 2013 4:26:54 PM UTC+2, DeanK wrote:
>
> Awesome thanks.  Everything is working now.
>
> I've used the scheduler monitor a decent amount and it has worked pretty 
> well for me. This is the first bug I've noticed but if I find more I'll be 
> sure to let you know.  The only tweak I've made is the output from my tasks 
> contains lots of debug information when things go wrong and it was hard to 
> interpret since newline characters were not being displayed in the table. 
>  I simply edited line 29 in run_details.html:
>
> {{=XML(r_.run_output.replace('\n', ''))}}
>
> It's not the prettiest thing in the world. If there are lots of newline 
> characters it makes the output look almost doubled spaced, but it is useful 
> and does the trick.
>
>
> Thanks!
>
> On Saturday, October 19, 2013 8:57:14 AM UTC-4, Niphlod wrote:
>>
>> BTW, found the issue with comfort scheduler. Will update as soon as 
>> github comes back.
>>
>> [edit] Done
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Problems with Scheduler/ComfortScheduler Monitor setup on a different server than website

2013-10-21 Thread DeanK
Awesome thanks.  Everything is working now.

I've used the scheduler monitor a decent amount and it has worked pretty 
well for me. This is the first bug I've noticed but if I find more I'll be 
sure to let you know.  The only tweak I've made is the output from my tasks 
contains lots of debug information when things go wrong and it was hard to 
interpret since newline characters were not being displayed in the table. 
 I simply edited line 29 in run_details.html:

{{=XML(r_.run_output.replace('\n', ''))}}

It's not the prettiest thing in the world. If there are lots of newline 
characters it makes the output look almost doubled spaced, but it is useful 
and does the trick.


Thanks!

On Saturday, October 19, 2013 8:57:14 AM UTC-4, Niphlod wrote:
>
> BTW, found the issue with comfort scheduler. Will update as soon as github 
> comes back.
>
> [edit] Done
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Question on SQLFORM.grid layout update

2013-10-21 Thread Sarbjit
I am using SQLFORM.grid and smartgrid for viewing the records, I noticed 
that when I use view record button, the text seems to be on right side 
making the left side of the screen empty.

It looks like 
 Name : John
   Date of Birth : 
21/10/1980

I want it to look like:

Name:  John
Date of Birth :   21/10/1980

How can I modify the layout of grid and smartgrid, I tried locating the 
default settings in web2py.css but I was not able to figure out the proper 
section.

Can some one please guide me on how this can be achieved.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: cache.action questions (views with db selects, and different views for logged-in users)

2013-10-21 Thread Anthony


> For users who aren't logged in, the pages would be the same. However, if a 
> user is logged in, then there are links to the users' profile, as well as a 
> logout link; thus making the page different for every user, and different 
> for logged-in vs. non-logged-in users. Is there any way to effectively 
> cache these pages, or only cache the non-logged in page for non-logged in 
> viewers?
>

cache.action does two things -- it sends appropriate response headers to 
the browser to enable client-side caching, and it (optionally) does 
server-side caching via the web2py cache mechanism. You might want to avoid 
doing per-user server-side caching, as that will start to fill up server 
memory, and you'd have to make sure you manually clear cached values 
periodically. Maybe consider something like:

@cache.client(cache_model=cache.ram if not auth.is_logged_in() else None,
  public=not auth.is_logged_in(), ...)

That will do server-side caching of the non-logged-in page only, and it 
will set public client-side caching to False for logged in users.
 

> Secondly, cache.action can't be used to cache views with database selects. 
> However, if the database select was converted to a list/dict, with 
> as_list() or as_dict(), would caching the page with cache.action be 
> possible (this would make it pickleable as a regular dictionary)?
>

Not sure what you mean -- can you show some code? cache.action caches only 
the output of the decorated function (and only if cache_model is specified 
-- otherwise, all it does is send headers to the browser to enable 
client-side caching).

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Bootstrap 2.2.2 / 2.3.2

2013-10-21 Thread Gael Princivalle
Hi.

Is it possible to use Bootstrap 2.3.2 on web2py ? I would like to do it 
just to have an easiest css Bootstrap file to read/modify. With web2py 
there's just the min 2.2.2 version that's not so easy to modify.

Thanks.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: cache.action questions (views with db selects, and different views for logged-in users)

2013-10-21 Thread Anthony


> Secondly, cache.action can't be used to cache views with database selects. 
>> However, if the database select was converted to a list/dict, with 
>> as_list() or as_dict(), would caching the page with cache.action be 
>> possible (this would make it pickleable as a regular dictionary)?
>>
>
> Why ? cache.action just caches the rendered view. It doesn't matter how 
> many select()s you do in that controller. 
>

cache.action caches only the output of the decorated function, so it would 
only cache the rendered view if the function manually renders the view 
itself by calling response.render(), no?

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Help me test model subfolders

2013-10-21 Thread Johann Spies
It seems that when the app is working, the admin interface does not and
vice versa.

I went back to last weeks version (Version
2.7.4-stable+timestamp.2013.10.16.09.10.20) and the error is still the
same. So the problem was not with this morning's edition.  I just did not
use the admin interface since the earlier update.


Regards
Johann


On 21 October 2013 11:48, Johann Spies  wrote:

> On 21 October 2013 11:20, Johann Spies  wrote:
>
>> In the end I go the app working again by doing:
>>
>> > hg rename db.py 0db.py
>> > hg rename dbcommon.py 0dbcommon.py
>>
>>
>
> I have talked too soon.  The admin interface works with this setup but
> still not the app itself.
>
> I will have to revert to last week's setup.
>
> Regards
> Johann
>



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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: cache.action questions (views with db selects, and different views for logged-in users)

2013-10-21 Thread Niphlod


On Monday, October 21, 2013 8:25:22 AM UTC+2, Mark Li wrote:
>
> I have 2 questions about cache.action
>
> Firstly, I am looking into cache.action to cache several static pages 
> (about, contact, etc), that rarely change content.
>
> For users who aren't logged in, the pages would be the same. However, if a 
> user is logged in, then there are links to the users' profile, as well as a 
> logout link; thus making the page different for every user, and different 
> for logged-in vs. non-logged-in users. Is there any way to effectively 
> cache these pages, or only cache the non-logged in page for non-logged in 
> viewers?
>

if your page has the same url and serves different contents for logged and 
non-logged users, and logged users get everyone a different content, than 
you should cache it with the User parameter.
 

>
>
> Secondly, cache.action can't be used to cache views with database selects. 
> However, if the database select was converted to a list/dict, with 
> as_list() or as_dict(), would caching the page with cache.action be 
> possible (this would make it pickleable as a regular dictionary)?
>

Why ? cache.action just caches the rendered view. It doesn't matter how 
many select()s you do in that controller. 

>
> Would there be a significant improvement of using cache.action to cache 
> the view that has a database select, over simply caching the select?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: schema database support for the DAL

2013-10-21 Thread Niphlod
PR got in. you should start to test. right now it works just for table 
names.

On Monday, October 21, 2013 9:25:05 AM UTC+2, Johann Spies wrote:
>
> +1
>
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: new feature in trunk

2013-10-21 Thread Niphlod
ouch the easiest model to update, the worst to query. 
I was going to post a plugin for threaded comments but then life kicked in 
with lots of other requirements, and then other things got priority in 
web2py.
I don't think this will be compatible with what I've done 'cause I use a 
totally different model, but alas, this is better than no plugin at all.

On Monday, October 21, 2013 5:57:00 AM UTC+2, Massimo Di Pierro wrote:
>
> It is a recurrent problem that is displays tree-like structures like 
> threaded comments. For example:
>
> db.define_table('post',
> Field('parent_id','reference post'),
> Field('body'))
>
> where each comment has a body and a parent_id (parent_id==None for the 
> root comment(s))
> We can populate the comments with some dummy data:
>
> def make_up_data():
> import random, uuid
> ids = [None]
> for k in range(100):
> ids.append(db.post.insert(parent_id=random.choice(ids),
>   body=str(uuid.uuid4(
> if k==0:
> ids.pop(None)
> if db(db.post).isempty(): make_up_data()
>
> The new feature in trunk allows you to select the comments are organized 
> them into trees.
>
>roots = db(db.post).select().as_trees()
>
> This returns a list of parent nodes. Each not stores its own children, 
> recursively.
>
> Now you can print them all using a tree traversal:
>
> def show(row,n=0):
> return '  '*n+row.body+'\n'+''.join(show(c,n+1) for c in 
> row.children)
> print show(roots[0])
>
> Notice you can specify the name of the parent field:
>
> roots = db(db.post).select().as_trees(parent_name="parent_id")
>
> Please let me know if you think this can be improved.
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] autocomplete widget on multiple fields display issue

2013-10-21 Thread Jose C
Issue:
When setting the autocomplete widget on two fields in same form, the 
dropdown box always appears underneath the first field only, even if the 
second field is selected and typing into the second field.  Values are 
inserted into the correct fields and form submission works ok... it's just 
the form field that the dropdown box attaches too (always the 1st) that is 
a problem.

Expected Behaviour:
The dropdown selection box should appear below the field that the user is 
typing into, not always above the first field in the form.

Web2py versions tested: 
2.7.4 (and also 2.4.6).

In model:
db.contacts.nationality.widget = SQLFORM.widgets.autocomplete(request, db.
country.printable_name, limitby=(0,10), min_length=1)
db.contacts.residence.widget = SQLFORM.widgets.autocomplete(request, db.
country.printable_name, limitby=(0,10), min_length=1)

In controller:
form = SQLFORM(db.contacts, record, separator = '', formstyle = 
'bootstrap', submit_button = 'save changes')

In view:
EDIT CONTACT DETAILS
{{=form}}

Can someone else verify this is a bug?  I've been hunting in the source but 
can't see an easy way to explicitly specify which classes the widget must 
apply to.

Thanks,



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Issues with creating a hash...

2013-10-21 Thread Jason (spot) Brower
I have the following in my controller...
# -*- coding: utf-8 -*-
def validate_message(recieved_data, message_hash):
secret_salt = "12345"
import hashlib
m = hashlib.sha224()
m.update(recieved_data + secret_salt)
hashed_message = m.digest()
if message_hash == hashed_message:
return [True, hashed_message]
else:
return [False, hashed_message]

def index():
print request.post_vars
return dict(data = request.post_vars)

def test_key():
if request.vars.message:
if request.vars.message_hash:
message_status, hashed_message =
validate_message(request.vars.message, request.vars.message_hash)
else:
return dict(status="no_message_hash")
else:
return dict(status="no_message")
if message_status:
return dict(status="worked")
else:
return dict(status="borked")
This works, but if I just the last line to print what the key looks like, I
got the following error.
return dict(status="borked", hashed_message)

Traceback (most recent call last):
  File "/home/encompass/melodigram/web2py/gluon/restricted.py", line
217, in restricted
exec ccode in environment
  File 
"/home/encompass/melodigram/web2py/applications/melodigram/views/generic.json",
line 2, in 
  File "/home/encompass/melodigram/web2py/gluon/serializers.py", line
124, in json
default=default).replace(ur'\u2028',
  File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line
334, in dumps
**kw).encode(obj)
  File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line
237, in encode
chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/dist-packages/simplejson/encoder.py", line
311, in iterencode
return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb9 in position 2:
invalid start byte

Any ideas?
BR,
Jason

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Help me test model subfolders

2013-10-21 Thread Johann Spies
On 21 October 2013 11:20, Johann Spies  wrote:

> In the end I go the app working again by doing:
>
> > hg rename db.py 0db.py
> > hg rename dbcommon.py 0dbcommon.py
>
>

I have talked too soon.  The admin interface works with this setup but
still not the app itself.

I will have to revert to last week's setup.

Regards
Johann

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Help me test model subfolders

2013-10-21 Thread Johann Spies
Hallo Massimo,


There is a problem with sorting of model subfolders in 2.7.2. We made some
> changes in trunk.
>

After this morning's updates from the trunk I got problems for the first
time which reflected a sorting problem:

Traceback (most recent call last):
  File "/home/js/web2py/gluon/restricted.py", line 217, in restricted
exec ccode in environment
  File "/home/js/web2py/applications/nkb/models/akb/akb.py", line 22,
in 
db.executesql("set search_path to akb, public;")
NameError: name 'db' is not defined


 And my models directory:

-rw-r--r--  1 js js  1196 Okt 11 07:43 0.py
-rw-r--r--  1 js js  1354 Okt 10 23:02 0.py.orig
drwxr-xr-x  2 js js  4096 Okt  8 14:44 akb
-rw-r--r--  1 js js  7845 Okt 11 07:44 dbcommon.py
-rw-r--r--  1 js js  7994 Okt 10 23:13 dbcommon.py.orig
-rw-r--r--  1 js js  9459 Okt 11 07:44 db.py
-rw-r--r--  1 js js  9504 Okt 10 23:07 db.py.orig
drwxr-xr-x  2 js js  4096 Okt 21 10:41 isi
-rw-r--r--  1 js js 11652 Okt  8 14:44 menu.py
-rw-r--r--  1 js js 10060 Aug 29 09:30 menu.py.orig
drwxr-xr-x  2 js js  4096 Okt  8 14:44 sabinet


Please help me check that:
>
> [ ] if you have a byte-compiled app, it still runs fine
> [ ] if you byte-compiler an app with trunk, it runs fine
> [ ] models are executed in this order:
> models/*.py (alphabetically) then
> models/*.py(alphabetically) then
> models///*.py (also alphabetically)
> [ ] if you set response.models_to_run (described in the book) the filter
> works correctly for normal apps and byte code compiled apps.
>
> None of the above worked for me.


> I have tried the following in 0.py but it did not solve the problem:

response.models_to_run = [
r'^\0\.py$',
r'^\db\.py$',
r'^\dbcommon\.py$',
r'^%s/\w+\.py$' % request.controller,
r'^%s/%s/\w+\.py$' % (request.controller, request.function)
]

In the end I go the app working again by doing:

> hg rename db.py 0db.py
> hg rename dbcommon.py 0dbcommon.py


Regards
Johann

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: ask response.models_to_run

2013-10-21 Thread 黄祥
thank you so much for your hints and detail explaination, anthony. i've 
separated my models and changed my code into:
models/db.py
if request.controller == 'default' and request.function == 'index' :
response.models_to_run = ['db_wizard_company.py', 'db_wizard_service.py', 
  'menu.py']
elif request.function == 'news' :
response.models_to_run = ['db_wizard_news.py', 'db_wizard_company.py', 
'db_wizard_service.py', 
  'menu.py']
elif request.function == 'service' :
response.models_to_run = ['db_wizard_company.py', 'db_wizard_service.py', 
  'menu.py']
elif request.function == 'manage_news' :
response.models_to_run = ['db_wizard_news.py', 'db_wizard_company.py', 
'db_wizard_branch.py', 
  'db_wizard_user.py', 'menu.py']
elif request.function == 'manage_service' :
response.models_to_run = ['db_wizard_service.py', 'db_wizard_company.py', 
'db_wizard_branch.py', 
  'db_wizard_user.py', 'menu.py']
elif request.function == 'manage_branch' :
response.models_to_run = ['db_wizard_company.py', 'db_wizard_branch.py', 
  'db_wizard_user.py', 'menu.py']
elif request.function == 'manage_company' :
response.models_to_run = ['db_wizard_company.py', 'db_wizard_branch.py', 
  'db_wizard_user.py', 'menu.py']
elif request.controller == 'populate' and request.function == 'index' :
response.models_to_run = ['db_wizard_company.py', 'db_wizard_branch.py', 
'db_wizard_news.py', 
  'db_wizard_service.py', 'db_wizard_user.py']
else:
response.models_to_run = ['.*']

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Instant press 2.1.0 holiday edition (?)

2013-10-21 Thread Jesus Alvaro
Hi Martin
Congrats for your work

I need a colaborative wiki for my new projects:

http://stringscore.fauno.org/ @
http://computermusiclab.org/

As starting point I am using auth.wiki(), but a whole 
wiki+comments+permissions is required

I'd like to use InstantPress. I like it very much, and also the possibility 
of using both markmin and markdown in the same wiki..
 Does it provide a multiple-writer approach?
Thanks in advance

Jesus Alvaro

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Application not OK after upgrade from 2.5.1 to any posterior release...

2013-10-21 Thread pkomor
Hello. I have an application that runs fine in web2py 2.5.1, I have 
upgraded web2py, I disabled migrations and activated after (I don't have 
fields in the model without the param length), but now when I login with an 
user created during the initial setup application, all is fine, but when 
any other user try to login there's not redirection to the index page and 
web2py hangs, with a "top" linux command I see the python process is 
increasing more 100%. I use ldap auth and I tried debugging but I'm not 
able to know what is wrong. Thanks.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Virtual.Method/Field and Selects

2013-10-21 Thread Zach
Thanks a lot for your help Anthony . This worked like a charm. 

I chose this since I think it is a more tidy approach - everything that 
have to do with database definition is defined in just one place. There 
isn't much of an overhead anyway.

Again thanks a lot. 

On Friday, October 18, 2013 4:07:34 PM UTC+3, Anthony wrote:
>
>
> db.define_table('tableaa', Field('afield', 'string', required=True ), 
>>  Field('bfield', 'string', required=True ), 
>> )
>> db.tableaa.virtfield = Field.Virtual( lambda row: XML("" + 
>> row.tableaa.afield + ' ' + row.tableaa.bfield ))
>>
>> When this something is a virtual field, as is the case then the two 
>> fields it concatenates need to be in every query I select from that table 
>> or I get an error regardless of whether the virtual field is in the list of 
>> selected fileds or not.
>>
>
> You could re-write the virtual field function so it doesn't fail when one 
> or both of the required fields are missing:
>
> def virtfield(row):
> try:
> return CAT(STRONG(row.tableaa.afield), BR(), STRONG(row.tableaa.
> bfield))
> except:
> return ''
>
> db.tableaa.virtfield = Field.Virtual(virtfield)
>
> Anthony
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: new feature in trunk

2013-10-21 Thread Mirko
Hi Massimo,
this is a very promising feature !

My quick two cents:
Why not turn this generic by replacing the 'body' field with a 'node_name' 
field and add an attribute node table ?
For example: 

db.define_table('node',
Field('parent_id','reference node'),
Field('node_name','string'))
and
db.define_table('attribute',
Field('node_id','reference node'),
Field('key','string'),
Field('value','string'))
The tree definition above needs to create a fake root node, forces a given 
node to belong to only one parent node and is efficient when traversing 
tree from leaf to trunk but for a given node the children node(s) are 
unknown.

The tree definition below could be a better solution, but may require extra 
work to keep references integrity especially when moving or deleting nodes:
db.define_table('node',
Field('parent_id','list:reference node'),
Field('child_id','list:reference node'),  // sorting this 
may permit to manage siblings
Field('node_name','string'))

Eventually a delirious attribute table evolution might be to have a type 
field (string, integer, reference, ) and validator per node attribute, 
but I can't figure out how to do that :)


Thanks again for this new feature,

Mirko,


PS: btw, no plans for DAL ZODB support ? 
http://www.zodb.org/en/latest/documentation/guide/introduction.html




On Monday, October 21, 2013 5:57:00 AM UTC+2, Massimo Di Pierro wrote:
>
> It is a recurrent problem that is displays tree-like structures like 
> threaded comments. For example:
>
> db.define_table('post',
> Field('parent_id','reference post'),
> Field('body'))
>
> where each comment has a body and a parent_id (parent_id==None for the 
> root comment(s))
> We can populate the comments with some dummy data:
>
> def make_up_data():
> import random, uuid
> ids = [None]
> for k in range(100):
> ids.append(db.post.insert(parent_id=random.choice(ids),
>   body=str(uuid.uuid4(
> if k==0:
> ids.pop(None)
> if db(db.post).isempty(): make_up_data()
>
> The new feature in trunk allows you to select the comments are organized 
> them into trees.
>
>roots = db(db.post).select().as_trees()
>
> This returns a list of parent nodes. Each not stores its own children, 
> recursively.
>
> Now you can print them all using a tree traversal:
>
> def show(row,n=0):
> return '  '*n+row.body+'\n'+''.join(show(c,n+1) for c in 
> row.children)
> print show(roots[0])
>
> Notice you can specify the name of the parent field:
>
> roots = db(db.post).select().as_trees(parent_name="parent_id")
>
> Please let me know if you think this can be improved.
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: schema database support for the DAL

2013-10-21 Thread Johann Spies
+1


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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.