Re: [web2py] Re: Mobile and Tablets detection

2013-07-21 Thread LightDot
A quick look at WURFL - looks fine, except for the license which might be 
problematic for some projects - AGPL v3. They offer commercial licenses 
too, which might solve the problem for some.

Regards,
Ales

On Saturday, July 20, 2013 6:14:17 PM UTC+2, Christian Foster Howes wrote:

 is the WURFL library of devices more or less complete then the mobile 
 browser list?  http://wurfl.sourceforge.net/  I used the WURFL 5-6 years 
 ago and found it to be the most complete open-source list at the time.

 On Wednesday, July 17, 2013 11:57:28 PM UTC-7, AngeloC wrote:

 Hi Marcio,

 I'm planning to grow the supported mobile devices list in web2py, but the 
 support right now is fairly extensive. 
 I got the user agent strings here 
 http://www.useragentstring.com/pages/Mobile%20Browserlist/ and added at 
 least one of the devices for each family to the unit test of 
 gluon/contrib/user_agent_parser.py .

 That class right now could discriminate between phone and tablets, so I 
 think you can't find somany differences with http://mobiledetect.net/ .

 Sincerly,
 Angelo

 -- 
 Profile: http://it.linkedin.com/in/compagnucciangelo 



-- 

--- 
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] Using Custom Forms with upstream version of twitter bootstrap ( not using all default *.css web2py)

2013-07-21 Thread Rollover Cable
Hello everybody, can someone give me some light how to accomplish this kind 
of stuff
i want to build horizontal forms from bootstrap sample ( 
http://twitter.github.io/bootstrap/base-css.html#forms) using 
sqlfom/sqlform.smartgrid
i read the docs and do googling, 
can anyone give me some example how to to that. the example code is below
form class=form-horizontal
div class=control-group
label class=control-label for=inputEmailEmail/label
div class=controls
input type=text id=inputEmail placeholder=Email
/div
/div
div class=control-group
label class=control-label for=inputPasswordPassword/label
div class=controls
input type=password id=inputPassword placeholder=Password
/div
/div
div class=control-group
div class=controls
label class=checkbox
input type=checkbox Remember me
/label
button type=submit class=btnSign in/button
/div
/div
/form
how to build custom login sqlform/sqlfrom.smartgrid/sqlform.factory in 
controller using the code above 
i read the docs but still don't get it 

Notes: 
1. i'm not using all web2py css and js ( i'm using original twitter 
bootstrap, no tweak etc ).
2. i'm totally newbie, so i'm using web2py to learn twitter bootstrap , 
java script + python. so i have different purpose, different path, 
different goal to achieve, that's why i'm not using the default css and js 
script.
some people  might say i should go with flask/bottle if want to build 
something from scratch  but i want to stick with web2py.


Thanks

-- 

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




Re: [web2py] ast module

2013-07-21 Thread LightDot
On Saturday, July 20, 2013 5:10:38 PM UTC+2, Jonathan Lundell wrote:

 I was bitten by this (other features, not ast) just yesterday. My local 
 environment (OS X) has 2.7; my production environment (RHEL6) had 2.6. 
 Turns out that 2.6 does not support collections.Counter (no surprise there, 
 really). More surprising, it doesn't support the flags argument to 
 re.sub(). Huh? Easy to work around, but still...

 When I set up the servers, I started by installing 2.7.latest, but ran 
 into some conflicts that I don't recall the details of right now, and 
 reverted to the system-supplied 2.6. One of these days I'll have to set up 
 a fresh server and figure out what it takes to run 2.7.


RHEL and derivatives (CentOS, Scientific Linux) are somewhat touchy when it 
comes to the main OS python version. Python is used for yum and various 
other pieces of key OS components, so upgrading python can be problematic. 
Upgrading to vanilla python also negates the value of long term RHEL 
support (python 2.6.6 on RHEL 6 will be supported until 2023!).

I suggest looking into RHEL Software Collections, which were created to 
solve this exact problem. They allow you to install newer versions of 
software in rpm safely into */opt* and switch between new and old releases. 
This allows your RHEL system applications to continue to run with the old 
version, while new apps can work with the new version.

http://developerblog.redhat.com/2013/06/05/red-hat-software-collections-1-0-beta-now-available/
https://fedorahosted.org/SoftwareCollections/

Software Collections have 3 years of support - this only means that for 3 
years there is a complete ABI/API compatibility guarantee for ie. python 
2.7.3 and 3.3.0, then versions might change.

They seem to have had Django in mind when creating python collections, 
which might be also relevant for web2py. There are further articles about 
this, like:
http://developerblog.redhat.com/2013/02/14/setting-up-django-and-python-2-7-on-red-hat-enterprise-6-the-easy-way/

Since a large part of my work is system administration (mostly RHEL), I 
really welcomed Software Collections... Makes my life easier and my custom 
yum repos much smaller... :)

Regards,
Ales

-- 

--- 
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] split windows with redirect?

2013-07-21 Thread lucas
hello one and all,

i have a main page and when it processes the form, i want the browser to 
refresh and remain on that page.  but i want a second window/tab to open 
which will show a report output of the main window.

any good ideas on how to do that?  lucas

-- 

--- 
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: Front-end dev workflow on OS X?

2013-07-21 Thread davedigerati
Thanks Massimo, the link worked perfect / Christian thanks also, had a 
suspicion but didn't want to explore a potential rabbit hole if I could 
help it;)

On Thursday, July 18, 2013 11:26:48 PM UTC-4, davedigerati wrote:


 Newbie, first app with web2py, on OS X, have tried google/group/docs and 
 am struggling with workflow:

 The Mac binary is a package so the views  static files are hidden from 
 the system- how are people designing front ends without pulling the files 
 out (which breaks previewing) ?


-- 

--- 
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: need help testing app

2013-07-21 Thread greaneym
Thanks for testing!

On Saturday, July 20, 2013 4:43:49 PM UTC-5, dhmorgan wrote:

 After installing BeautifulSoup, it ran fine. Results matched those 
 provided by wunderground. 


 https://lh5.googleusercontent.com/-Q9oTeGGJHug/UesEfjZbvnI/ByY/maI-KdGE7UA/s1600/greaneym-weather.png


 On Saturday, July 20, 2013 4:18:10 PM UTC-5, greaneym wrote:

 Hello,

 I would like to share an app with the web2py community, and also am 
 asking for help testing it.

 https://github.com/greaneym/weather

 It needs more work but please feel free to try it.  It gave me some 
 practice using BeautifulSoup. It uses the National Weather Service's web 
 service to provide weather near you (US only).

 Thanks!
 Margaret



-- 

--- 
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] Problem with SUM on DAL statement

2013-07-21 Thread Jim S
Just upgraded to latest trunk, Version 
2.6.0-development+timestamp.2013.07.20.12.59.52.

Having a problem with SUM statements that previously worked.

If the query returns no rows, then I'm getting this traceback:

Traceback (most recent call last):
  File C:\dev\web2py\gluon\restricted.py, line 212, in restricted
exec ccode in environment
  File C:/dev/web2py/applications/ibc/controllers/dashboard.py 
http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, line 
2035, in module
  File C:\dev\web2py\gluon\globals.py, line 193, in lambda
self._caller = lambda f: f()
  File C:/dev/web2py/applications/ibc/controllers/dashboard.py 
http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, line 
1094, in contract_fees_ytd_by_distributor

(db.national_sales_data.Invoice_Print_Date__c=to_date)).select(processing_fees_sum).first()[processing_fees_sum]
 or 0
  File C:\dev\web2py\gluon\dal.py, line 6888, in __getitem__
return ogetattr(self, key)
AttributeError: 'Row' object has no attribute 
'SUM(national_sales_data.Processing_Fees__c)'

My code is:

processing_fees = 
db((db.national_sales_data.Invoice_Print_Date__c=from_date) 
(db.national_sales_data.Trading_Partner_ID__c==trading_partner) 
(db.national_sales_data.Invoice_Print_Date__c=to_date)).select(processing_fees_sum).first()[processing_fees_sum]
 
or 0

Previously this would return 0 if there were no rows selected in the query.

-Jim

-- 

--- 
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: split windows with redirect?

2013-07-21 Thread Niphlod
a window.open with javascript maybe ?

On Sunday, July 21, 2013 2:33:59 PM UTC+2, lucas wrote:

 hello one and all,

 i have a main page and when it processes the form, i want the browser to 
 refresh and remain on that page.  but i want a second window/tab to open 
 which will show a report output of the main window.

 any good ideas on how to do that?  lucas


-- 

--- 
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] Prevent specific field from update

2013-07-21 Thread lesssugar
When going to update page I would like to check the value of field_X. Then, 
depending on its current value, field_X should be updated along with the 
other ones OR be excluded from upload:

if db.table[id].field_X == A:
   #perform full update
elif db.table[id].field_X == B:
   #update all fields except field_X

Not sure how to achieve this. Ideas?

-- 

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




[web2py] Re: Problem with SUM on DAL statement

2013-07-21 Thread Niphlod
this should have been fixed already on the latest trunk

On Sunday, July 21, 2013 3:33:51 PM UTC+2, Jim S wrote:

 Just upgraded to latest trunk, Version 
 2.6.0-development+timestamp.2013.07.20.12.59.52.

 Having a problem with SUM statements that previously worked.

 If the query returns no rows, then I'm getting this traceback:

 Traceback (most recent call last):
   File C:\dev\web2py\gluon\restricted.py, line 212, in restricted
 exec ccode in environment
   File C:/dev/web2py/applications/ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, line 
 2035, in module
   File C:\dev\web2py\gluon\globals.py, line 193, in lambda
 self._caller = lambda f: f()
   File C:/dev/web2py/applications/ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, line 
 1094, in contract_fees_ytd_by_distributor
 
 (db.national_sales_data.Invoice_Print_Date__c=to_date)).select(processing_fees_sum).first()[processing_fees_sum]
  or 0
   File C:\dev\web2py\gluon\dal.py, line 6888, in __getitem__
 return ogetattr(self, key)
 AttributeError: 'Row' object has no attribute 
 'SUM(national_sales_data.Processing_Fees__c)'

 My code is:

 processing_fees = 
 db((db.national_sales_data.Invoice_Print_Date__c=from_date) 
 (db.national_sales_data.Trading_Partner_ID__c==trading_partner) 
 (db.national_sales_data.Invoice_Print_Date__c=to_date)).select(processing_fees_sum).first()[processing_fees_sum]
  
 or 0

 Previously this would return 0 if there were no rows selected in the query.

 -Jim



-- 

--- 
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: Problem with SUM on DAL statement

2013-07-21 Thread Jim Steil
Do you have a test you can run on it?  None of mine are working and I just
updated in the last hour.


On Sun, Jul 21, 2013 at 8:48 AM, Niphlod niph...@gmail.com wrote:

 this should have been fixed already on the latest trunk


 On Sunday, July 21, 2013 3:33:51 PM UTC+2, Jim S wrote:

 Just upgraded to latest trunk, Version 2.6.0-development+timestamp.**
 2013.07.20.12.59.52.

 Having a problem with SUM statements that previously worked.

 If the query returns no rows, then I'm getting this traceback:

 Traceback (most recent call last):
   File C:\dev\web2py\gluon\**restricted.py, line 212, in restricted
 exec ccode in environment
   File C:/dev/web2py/applications/**ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, 
 line 2035, in module
   File C:\dev\web2py\gluon\globals.**py, line 193, in lambda
 self._caller = lambda f: f()
   File C:/dev/web2py/applications/**ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, 
 line 1094, in contract_fees_ytd_by_**distributor
 
 (db.national_sales_data.Invoic**e_Print_Date__c=to_date)).sel**ect(processing_fees_sum).first**()[processing_fees_sum]
  or 0
   File C:\dev\web2py\gluon\dal.py, line 6888, in __getitem__
 return ogetattr(self, key)
 AttributeError: 'Row' object has no attribute 
 'SUM(national_sales_data.**Processing_Fees__c)'

 My code is:

 processing_fees = db((db.national_sales_data.**
 Invoice_Print_Date__c=from_**date) 
 (db.national_sales_data.**Trading_Partner_ID__c==**trading_partner) 
 (db.national_sales_data.**Invoice_Print_Date__c=to_**
 date)).select(processing_fees_**sum).first()[processing_fees_**sum] or 0

 Previously this would return 0 if there were no rows selected in the
 query.

 -Jim

  --

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




-- 

--- 
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: Problem with SUM on DAL statement

2013-07-21 Thread Michele Comitini
There is a bug. must be None i.e. the result is not defined.

I fixed the bug and I will send the PR asap

db.define_table('tt', Field('aa', 'integer'))

assert(db(db.tt.aa == 2).count()==0)
sum = (db.tt.aa + 1).sum()
assert(db(db.tt.aa == 2).select(sum).first()[sum]==0)
- AssertionError

I added tests for travis too.


2013/7/21 Jim Steil ato.st...@gmail.com

 Do you have a test you can run on it?  None of mine are working and I just
 updated in the last hour.


 On Sun, Jul 21, 2013 at 8:48 AM, Niphlod niph...@gmail.com wrote:

 this should have been fixed already on the latest trunk


 On Sunday, July 21, 2013 3:33:51 PM UTC+2, Jim S wrote:

 Just upgraded to latest trunk, Version 2.6.0-development+timestamp.**
 2013.07.20.12.59.52.

 Having a problem with SUM statements that previously worked.

 If the query returns no rows, then I'm getting this traceback:

 Traceback (most recent call last):

   File C:\dev\web2py\gluon\**restricted.py, line 212, in restricted

 exec ccode in environment
   File C:/dev/web2py/applications/**ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, 
 line 2035, in module

   File C:\dev\web2py\gluon\globals.**py, line 193, in lambda

 self._caller = lambda f: f()

   File C:/dev/web2py/applications/**ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, 
 line 1094, in contract_fees_ytd_by_**distributor

 
 (db.national_sales_data.Invoic**e_Print_Date__c=to_date)).sel**ect(processing_fees_sum).first**()[processing_fees_sum]
  or 0

   File C:\dev\web2py\gluon\dal.py, line 6888, in __getitem__

 return ogetattr(self, key)
 AttributeError: 'Row' object has no attribute 
 'SUM(national_sales_data.**Processing_Fees__c)'

 My code is:

 processing_fees = db((db.national_sales_data.**
 Invoice_Print_Date__c=from_**date) 
 (db.national_sales_data.**Trading_Partner_ID__c==**trading_partner) 
 (db.national_sales_data.**Invoice_Print_Date__c=to_**
 date)).select(processing_fees_**sum).first()[processing_fees_**sum] or 0

 Previously this would return 0 if there were no rows selected in the
 query.

 -Jim

  --

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




  --

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




-- 

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




Re: [web2py] Re: Problem with SUM on DAL statement

2013-07-21 Thread Jim Steil
Thanks.  Really appreciate the prompt reply on a Sunday morning!!

Jim
 On Jul 21, 2013 9:22 AM, Michele Comitini michele.comit...@gmail.com
wrote:

 There is a bug. must be None i.e. the result is not defined.

 I fixed the bug and I will send the PR asap

 db.define_table('tt', Field('aa', 'integer'))

 assert(db(db.tt.aa == 2).count()==0)
 sum = (db.tt.aa + 1).sum()
 assert(db(db.tt.aa == 2).select(sum).first()[sum]==0)
 - AssertionError

 I added tests for travis too.


 2013/7/21 Jim Steil ato.st...@gmail.com

 Do you have a test you can run on it?  None of mine are working and I
 just updated in the last hour.


 On Sun, Jul 21, 2013 at 8:48 AM, Niphlod niph...@gmail.com wrote:

 this should have been fixed already on the latest trunk


 On Sunday, July 21, 2013 3:33:51 PM UTC+2, Jim S wrote:

 Just upgraded to latest trunk, Version 2.6.0-development+timestamp.**
 2013.07.20.12.59.52.

 Having a problem with SUM statements that previously worked.

 If the query returns no rows, then I'm getting this traceback:

 Traceback (most recent call last):


   File C:\dev\web2py\gluon\**restricted.py, line 212, in restricted


 exec ccode in environment
   File C:/dev/web2py/applications/**ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, 
 line 2035, in module


   File C:\dev\web2py\gluon\globals.**py, line 193, in lambda


 self._caller = lambda f: f()


   File C:/dev/web2py/applications/**ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, 
 line 1094, in contract_fees_ytd_by_**distributor


 
 (db.national_sales_data.Invoic**e_Print_Date__c=to_date)).sel**ect(processing_fees_sum).first**()[processing_fees_sum]
  or 0


   File C:\dev\web2py\gluon\dal.py, line 6888, in __getitem__


 return ogetattr(self, key)

 AttributeError: 'Row' object has no attribute 
 'SUM(national_sales_data.**Processing_Fees__c)'

 My code is:

 processing_fees = db((db.national_sales_data.**
 Invoice_Print_Date__c=from_**date) 
 (db.national_sales_data.**Trading_Partner_ID__c==**trading_partner) 
 (db.national_sales_data.**Invoice_Print_Date__c=to_**
 date)).select(processing_fees_**sum).first()[processing_fees_**sum] or
 0

 Previously this would return 0 if there were no rows selected in the
 query.

 -Jim

  --

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




  --

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




  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/hgYEY3ZdSK4/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.




-- 

--- 
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: Problem with SUM on DAL statement

2013-07-21 Thread Michele Comitini
Warm sunday afternoon here in Italy ;-)

pull request: https://github.com/web2py/web2py/pull/144


2013/7/21 Jim Steil ato.st...@gmail.com

 Thanks.  Really appreciate the prompt reply on a Sunday morning!!

 Jim
  On Jul 21, 2013 9:22 AM, Michele Comitini michele.comit...@gmail.com
 wrote:

 There is a bug. must be None i.e. the result is not defined.

 I fixed the bug and I will send the PR asap

 db.define_table('tt', Field('aa', 'integer'))

 assert(db(db.tt.aa == 2).count()==0)
 sum = (db.tt.aa + 1).sum()
 assert(db(db.tt.aa == 2).select(sum).first()[sum]==0)
 - AssertionError

 I added tests for travis too.


 2013/7/21 Jim Steil ato.st...@gmail.com

 Do you have a test you can run on it?  None of mine are working and I
 just updated in the last hour.


 On Sun, Jul 21, 2013 at 8:48 AM, Niphlod niph...@gmail.com wrote:

 this should have been fixed already on the latest trunk


 On Sunday, July 21, 2013 3:33:51 PM UTC+2, Jim S wrote:

 Just upgraded to latest trunk, Version 2.6.0-development+timestamp.**
 2013.07.20.12.59.52.

 Having a problem with SUM statements that previously worked.

 If the query returns no rows, then I'm getting this traceback:

 Traceback (most recent call last):



   File C:\dev\web2py\gluon\**restricted.py, line 212, in restricted



 exec ccode in environment
   File C:/dev/web2py/applications/**ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, 
 line 2035, in module



   File C:\dev\web2py\gluon\globals.**py, line 193, in lambda



 self._caller = lambda f: f()



   File C:/dev/web2py/applications/**ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, 
 line 1094, in contract_fees_ytd_by_**distributor



 
 (db.national_sales_data.Invoic**e_Print_Date__c=to_date)).sel**ect(processing_fees_sum).first**()[processing_fees_sum]
  or 0



   File C:\dev\web2py\gluon\dal.py, line 6888, in __getitem__



 return ogetattr(self, key)


 AttributeError: 'Row' object has no attribute 
 'SUM(national_sales_data.**Processing_Fees__c)'

 My code is:

 processing_fees = db((db.national_sales_data.**
 Invoice_Print_Date__c=from_**date) 
 (db.national_sales_data.**Trading_Partner_ID__c==**trading_partner) 
 (db.national_sales_data.**Invoice_Print_Date__c=to_**
 date)).select(processing_fees_**sum).first()[processing_fees_**sum]
 or 0

 Previously this would return 0 if there were no rows selected in the
 query.

 -Jim

  --

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




  --

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




  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/hgYEY3ZdSK4/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.



  --

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




-- 

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




[web2py] bulk updates/insert

2013-07-21 Thread ssuresh
Hi,

I have a table userskills with the following structure

 {user_id,user_skills,skill_rating}..

It can have values like

{1,java,5}
{1,python,6}
{1,javascript,9}
{2,java,3}

etc

For a particular user, I will show him an editable grid (jquery based) 
containing all his skills and ratings. He can add new rows for new skills 
and delete and modify existing skills. He can then submit the form in one 
go..

My question is

How can i update the values in the database? Currently what I am doing is 
deleting all records in the table for that user and then bulk updating the 
new values  . Is this the best approach for such a scenario? Is there is a 
better way of doing this?

thanx,
Suresh

-- 

--- 
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 about @request.restful

2013-07-21 Thread Franco
Greetings everyone,
I've been using request.restful
to provide an restful interface to my angularjs app,
i tried to post data from the angularjs app and it works, it sends the data 
but in the POST method i've got an empty dictionary, here is my code and 
some data logs:

default controller
@request.restful()
def api():
response.view = 'generic.json'
def GET(table_name, id=None):
if table_name in db:
table = db[table_name]
if id == None:
query = (table.id  0)
else:
try:
id = int(id or 0)
except:
id = 0
query = (table.id == id)
return {table_name : db(query).select()}
def POST(table_name, **vars):
print(vars)
return locals()

angular code used to post data:
$http.post('http://127.0.0.1:8000/angularjs/default/api/person/', item).
success(function(data) {
console.log('POST: '+ item.first_name +' Result: '+ data);
});

chrome network log:


1. Request URL:
http://127.0.0.1:8000/angularjs/default/api/person/
2. Request Method:
POST
3. Status Code:
200 OK
4. Request Headersview source
   1. Accept:
   application/json, text/plain, */*
   2. Accept-Encoding:
   gzip,deflate,sdch
   3. Accept-Language:
   es,en-US;q=0.8,en;q=0.6
   4. Connection:
   keep-alive
   5. Content-Length:
   46
   6. Content-Type:
   application/json;charset=UTF-8
   7. Cookie:
   csrftoken=hMi7rvIHaxAu09tX0H8c2SDqmwwgS7Ra; 
   session_id_admin=127.0.0.1-9ef67e29-1352-4fef-a621-fcc0c3fa9182; 
   session_id_angularjs=127.0.0.1-9453b1e9-444d-4fe4-8110-9d956bfda316
   8. Host:
   127.0.0.1:8000
   9. Origin:
   http://127.0.0.1:8000
   10. Referer:
   http://127.0.0.1:8000/angularjs/default/index
   11. User-Agent:
   Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like 
   Gecko) Chrome/28.0.1500.72 Safari/537.36
   5. Request Payloadview source
{id:0, first_name:John, last_name:Doe}
1. first_name: John
   2. id: 0
   3. last_name: Doe
6. Response Headersview source
   1. Cache-Control:
   no-store, no-cache, must-revalidate, post-check=0, pre-check=0
   2. Connection:
   keep-alive
   3. Content-Length:
   4
   4. Content-Type:
   text/html; charset=utf-8
   5. Date:
   Sun, 21 Jul 2013 17:38:41 GMT
   6. Expires:
   Sun, 21 Jul 2013 17:38:41 GMT
   7. Pragma:
   no-cache
   8. Server:
   Rocket 1.2.6 Python/2.7.5
   9. Set-Cookie:
   session_id_angularjs=127.0.0.1-9453b1e9-444d-4fe4-8110-9d956bfda316; 
   Path=/
   10. X-Powered-By:
   web2py
   

I made some tests using the requests module and it works, so for instance 
i think that the problem is within the way that angularjs sends the data.

Thanks in advance,

Franco



-- 

--- 
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] define model, required only one from two fields

2013-07-21 Thread K. Antonis Tzorvas
i have a table:

db.define_table('records', Field('file', 'upload'), Field('url', 'string'))

and i want either file or url to be filled, cases that both are empty 
or filled should not pass.

any idea on how to implement this one?

-- 

--- 
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] cannot redefine field

2013-07-21 Thread K. Antonis Tzorvas
db.define_table('station',
Field('name'),
Field('country', 'string'),
Field('city', 'string'),
Field('records_file', 'upload'),
format='%(name)s',
migrate=False)

db.station.name.requires = IS_NOT_IN_DB(db, 'station.name')

i had this one
and i want to add an extra line
db.station.records_file = IS_NOT_EMPTY()

but i am getting this erro:

 SyntaxError: Object exists and cannot be redefined: records_file

  
any idea?

-- 

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




Re: [web2py] cannot redefine field

2013-07-21 Thread Jonathan Lundell
On 21 Jul 2013, at 11:28 AM, K. Antonis Tzorvas antonis.tzor...@gmail.com 
wrote:
 db.define_table('station',
 Field('name'),
 Field('country', 'string'),
 Field('city', 'string'),
 Field('records_file', 'upload'),
 format='%(name)s',
 migrate=False)
 
 db.station.name.requires = IS_NOT_IN_DB(db, 'station.name')
 
 i had this one
 and i want to add an extra line
 db.station.records_file = IS_NOT_EMPTY()
 
 but i am getting this erro:
 SyntaxError: Object exists and cannot be redefined: records_file
  
 any idea?

db.station.records_file.requires = IS_NOT_EMPTY()

-- 

--- 
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] cannot redefine field

2013-07-21 Thread K. Antonis Tzorvas
you are right, forgotten about the .requires part :/
thanks!

On Sunday, July 21, 2013 9:32:15 PM UTC+3, Jonathan Lundell wrote:

 On 21 Jul 2013, at 11:28 AM, K. Antonis Tzorvas 
 antonis...@gmail.comjavascript: 
 wrote:

 db.define_table('station',
 Field('name'),
 Field('country', 'string'),
 Field('city', 'string'),
 Field('records_file', 'upload'),
 format='%(name)s',
 migrate=False)

 db.station.name.requires = IS_NOT_IN_DB(db, 'station.name')

 i had this one
 and i want to add an extra line
 db.station.records_file = IS_NOT_EMPTY()

 but i am getting this erro:

 SyntaxError: Object exists and cannot be redefined: records_file

  
 any idea?


 db.station.records_file.requires = IS_NOT_EMPTY()



-- 

--- 
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: Is there an issue with my web2py install? can't pickle function objects

2013-07-21 Thread Joe Magaro
Hi. I have another issue,and in researching it i'm wondering if this is 
somewhat related to having 2 or more domains served from web2py? 

On Tuesday, July 16, 2013 10:44:46 PM UTC-4, Joe Magaro wrote:

 Hi, Lately when I'm in the admin section, when I perform an action such as 
 installing a new app, or deleting a view I keep getting the error below. Im 
 not sure what changed to affect this, please help!

 raceback (most recent call last):
   File /home/www-data/web2py/gluon/main.py, line 606, in wsgibase
 session._try_store_in_cookie_or_file(request, response)
   File /home/www-data/web2py/gluon/globals.py, line 757, in 
 _try_store_in_cookie_or_file
 self._try_store_in_file(request, response)
   File /home/www-data/web2py/gluon/globals.py, line 763, in 
 _try_store_in_file
 if not response.session_id or self._forget or self._unchanged():
   File /home/www-data/web2py/gluon/globals.py, line 719, in _unchanged
 session_pickled = cPickle.dumps(dict(self))
   File /usr/lib/python2.7/copy_reg.py, line 70, in _reduce_ex
 raise TypeError, can't pickle %s objects % base.__name__
 TypeError: can't pickle function objects

 Error snapshot [image: 
 help]https://www.mywebsonic.com/admin/default/ticket/admin/65.94.90.186.2013-07-17.06-41-06.14386b00-ff0d-47ad-bf32-de51a08fda61#

 type 'exceptions.TypeError'(can't pickle function objects)


-- 

--- 
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: Using a recursive select but encountered a broken reference

2013-07-21 Thread Joe Magaro
Hi, Im also having the same issue, and the fix above seemed to work --  I'm 
wondering if there is an official fix for this?

On Saturday, March 2, 2013 2:55:17 PM UTC-5, Marin Pranjić wrote:

 This happened to an user multiple times. No idea why it happens.

 Error ticket doesn't show much, this is everything I can get from there:

 Traceback (most recent call last):
  File /home/www-data/web2py/gluon/main.py, line 571, in wsgibase
  session._try_store_in_cookie_or_file(request, response)
  File /home/www-data/web2py/gluon/globals.py, line 738, in 
 _try_store_in_cookie_or_file
  self._try_store_in_file(request, response)
  File /home/www-data/web2py/gluon/globals.py, line 745, in 
 _try_store_in_file
  if not response.session_id or self._forget or self._unchanged():
  File /home/www-data/web2py/gluon/globals.py, line 700, in _unchanged
  session_pickled = cPickle.dumps(dict(self))
  File /usr/lib/python2.7/copy_reg.py, line 74, in _reduce_ex
  getstate = self.__getstate__
  File /home/www-data/web2py/gluon/dal.py, line 7355, in __getattr__
  self.__allocate()
  File /home/www-data/web2py/gluon/dal.py, line 7350, in __allocate
  raise RuntimeError, Using a recursive select but encountered a broken 
 reference: %s %d%(self._table, int(self))
 RuntimeError: Using a recursive select but encountered a broken reference: 
 auth_group 5



 However, auth_group record with id=5 exists. I have no idea why it raises an 
 error.

 I'm using web2py 2.2.1, this is production instance so I can't test with 
 other versions right now.


 Marin



-- 

--- 
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: bulk updates/insert

2013-07-21 Thread Niphlod
unless you're updating the corresponding rows whenever the user clicks on 
it, deleting them all and then reinserting them it's one of the two ways to 
go. 
I'd just vote for update_or_insert() if you're concerned about keeping 
the same original ids as long as the user doesn't modify those, but that's 
highly app dependant.
However, in practical database theory, if you're going to fetch a lot of 
times those records and you want them often to be all skills for a single 
user, you'd better have them not scattered among your huge table (read: 
it's better to have them in sequential order), in order to optimize 
database seeks.


On Sunday, July 21, 2013 7:38:46 PM UTC+2, ssuresh wrote:

 Hi,

 I have a table userskills with the following structure

  {user_id,user_skills,skill_rating}..

 It can have values like

 {1,java,5}
 {1,python,6}
 {1,javascript,9}
 {2,java,3}

 etc

 For a particular user, I will show him an editable grid (jquery based) 
 containing all his skills and ratings. He can add new rows for new skills 
 and delete and modify existing skills. He can then submit the form in one 
 go..

 My question is

 How can i update the values in the database? Currently what I am doing is 
 deleting all records in the table for that user and then bulk updating the 
 new values  . Is this the best approach for such a scenario? Is there is a 
 better way of doing this?

 thanx,
 Suresh



-- 

--- 
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] offtopic : beuatiful code

2013-07-21 Thread Niphlod
I actually skipped over this a few times and today I finally reached its 
place in my playlist for free time... sorry if you seen it before, but I 
actually learned at least 5 things out of it that I really didn't know 
of.

https://www.youtube.com/watch?v=OSGv2VnC0go

if you want slides

https://speakerdeck.com/pyconslides/transforming-code-into-beautiful-idiomatic-python-by-raymond-hettinger-1

-- 

--- 
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: need help testing app

2013-07-21 Thread Massimo Di Pierro
Thank you margaret. Will test it asap.

Massimo

On Saturday, 20 July 2013 16:18:10 UTC-5, greaneym wrote:

 Hello,

 I would like to share an app with the web2py community, and also am asking 
 for help testing it.

 https://github.com/greaneym/weather

 It needs more work but please feel free to try it.  It gave me some 
 practice using BeautifulSoup. It uses the National Weather Service's web 
 service to provide weather near you (US only).

 Thanks!
 Margaret


-- 

--- 
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: Prevent specific field from update

2013-07-21 Thread Massimo Di Pierro
How about this?

record = db.table[id]
newfieldvalues = {'field_X':'value', }
if record.field_X == 'B': del newfieldvalues['field_X']
record.update_record(**newfieldvalues)


if db.table[id].field_X == A:
   #perform full update
elif db.table[id].field_X == B:
   #update all fields except field_X



On Sunday, 21 July 2013 08:11:44 UTC-5, lesssugar wrote:

 When going to update page I would like to check the value of field_X. 
 Then, depending on its current value, field_X should be updated along with 
 the other fields OR be excluded from upload:

 if db.table[id].field_X == A:
#perform full update
 elif db.table[id].field_X == B:
#update all fields except field_X

 Not sure how to achieve this. Ideas?


-- 

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




Re: [web2py] Re: Problem with SUM on DAL statement

2013-07-21 Thread Jim Steil
That fixed it.  Thanks again.  Enjoy the weather while you can.  Here in
Wisconsin, the summer goes by too quickly.


On Sun, Jul 21, 2013 at 9:57 AM, Michele Comitini 
michele.comit...@gmail.com wrote:

 Warm sunday afternoon here in Italy ;-)

 pull request: https://github.com/web2py/web2py/pull/144


 2013/7/21 Jim Steil ato.st...@gmail.com

 Thanks.  Really appreciate the prompt reply on a Sunday morning!!

 Jim
  On Jul 21, 2013 9:22 AM, Michele Comitini michele.comit...@gmail.com
 wrote:

 There is a bug. must be None i.e. the result is not defined.

 I fixed the bug and I will send the PR asap

 db.define_table('tt', Field('aa', 'integer'))

 assert(db(db.tt.aa == 2).count()==0)
 sum = (db.tt.aa + 1).sum()
 assert(db(db.tt.aa == 2).select(sum).first()[sum]==0)
 - AssertionError

 I added tests for travis too.


 2013/7/21 Jim Steil ato.st...@gmail.com

 Do you have a test you can run on it?  None of mine are working and I
 just updated in the last hour.


 On Sun, Jul 21, 2013 at 8:48 AM, Niphlod niph...@gmail.com wrote:

 this should have been fixed already on the latest trunk


 On Sunday, July 21, 2013 3:33:51 PM UTC+2, Jim S wrote:

 Just upgraded to latest trunk, Version 2.6.0-development+timestamp.**
 2013.07.20.12.59.52.

 Having a problem with SUM statements that previously worked.

 If the query returns no rows, then I'm getting this traceback:

 Traceback (most recent call last):




   File C:\dev\web2py\gluon\**restricted.py, line 212, in restricted




 exec ccode in environment
   File C:/dev/web2py/applications/**ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, 
 line 2035, in module




   File C:\dev\web2py\gluon\globals.**py, line 193, in lambda




 self._caller = lambda f: f()




   File C:/dev/web2py/applications/**ibc/controllers/dashboard.py 
 http://127.0.0.1:8000/admin/default/edit/ibc/controllers/dashboard.py, 
 line 1094, in contract_fees_ytd_by_**distributor




 
 (db.national_sales_data.Invoic**e_Print_Date__c=to_date)).sel**ect(processing_fees_sum).first**()[processing_fees_sum]
  or 0




   File C:\dev\web2py\gluon\dal.py, line 6888, in __getitem__




 return ogetattr(self, key)



 AttributeError: 'Row' object has no attribute 
 'SUM(national_sales_data.**Processing_Fees__c)'

 My code is:

 processing_fees = db((db.national_sales_data.**
 Invoice_Print_Date__c=from_**date) 
 (db.national_sales_data.**Trading_Partner_ID__c==**trading_partner) 
 (db.national_sales_data.**Invoice_Print_Date__c=to_**
 date)).select(processing_fees_**sum).first()[processing_fees_**sum]
 or 0

 Previously this would return 0 if there were no rows selected in the
 query.

 -Jim

  --

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




  --

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




  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/hgYEY3ZdSK4/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.



  --

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




  --

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/hgYEY3ZdSK4/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.




-- 

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

2013-07-21 Thread Auden RovelleQuartz
Does anyone know what the following error means?


{
Ticket ID

70.92.230.24.2013-07-22.00-17-44.194ba64e-ab76-48e6-9d4c-935bedce8cf2
type 'exceptions.AttributeError' 'module' object has no attribute 
'serializers'Versionweb2py™Version 
2.5.1-stable+timestamp.2013.06.06.15.39.19PythonPython 2.7.3: 
/usr/bin/python (prefix: /usr)Traceback

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

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/omniavx/models/db.py 
https://omniavx.com/admin/edit/omniavx/models/db.py, line 2, in module
from applications.omniavx.modules.app_constants import * #CDN-16
  File /home/www-data/web2py/gluon/custom_import.py, line 100, in 
custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File applications/omniavx/modules/app_constants.py, line 6, in module
from gluon.tools import Recaptcha
  File /home/www-data/web2py/gluon/custom_import.py, line 100, in 
custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File /home/www-data/web2py/gluon/tools.py, line 37, in module
import gluon.serializers as serializers
AttributeError: 'module' object has no attribute 'serializers'

}

-- 

--- 
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: define model, required only one from two fields

2013-07-21 Thread Massimo Di Pierro
def index():
if 'file' in request.var: db.records.url.requires=IS_NOT_EMPTY()
else: db.records.file.requires=IS_NOT_EMPTY()
form = SQLFORM(db.records)


On Sunday, 21 July 2013 13:11:40 UTC-5, K. Antonis Tzorvas wrote:

 i have a table:

 db.define_table('records', Field('file', 'upload'), Field('url', 'string'))

 and i want either file or url to be filled, cases that both are empty 
 or filled should not pass.

 any idea on how to implement this one?


-- 

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

2013-07-21 Thread Jonathan Lundell
On 21 Jul 2013, at 5:07 AM, LightDot light...@gmail.com wrote:
 I suggest looking into RHEL Software Collections, which were created to solve 
 this exact problem. They allow you to install newer versions of software in 
 rpm safely into /opt and switch between new and old releases. This allows 
 your RHEL system applications to continue to run with the old version, while 
 new apps can work with the new version.

Thanks, I'll check that out.

The problem I was running into, IIRC, had to do with coordinating a new Python 
with mod_wsgi and web2py's virtualenv. I'll re-read the wsgi instructions for 
that, I guess.

-- 

--- 
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: Front-end dev workflow on OS X?

2013-07-21 Thread Tim Richardson
Using the source is really easy and definitely the way to go once you've 
got your feet under the desk. 
Python even comes with OS X, although go to python.org and update it 
perhaps. 
I use OS X and I can't even remember the 'app' version. You just go into a 
terminal, cd to the folder where you have the source, and execute
python web2py.py


Then some point further you'll probably wish you had timely access not just 
to the most recent released version of the source, but to the development 
version (trunk). At that point, you'll install git and learn how to 
clone web2py, which is another way of getting the source in a folder, but 
with the ability to access any released version and trunk. 

Note that the web2py book is actually a web2py app, so you can download it 
and run it via web2py. 


On Sunday, 21 July 2013 22:48:58 UTC+10, davedigerati wrote:

 Thanks Massimo, the link worked perfect / Christian thanks also, had a 
 suspicion but didn't want to explore a potential rabbit hole if I could 
 help it;)

 On Thursday, July 18, 2013 11:26:48 PM UTC-4, davedigerati wrote:


 Newbie, first app with web2py, on OS X, have tried google/group/docs and 
 am struggling with workflow:

 The Mac binary is a package so the views  static files are hidden from 
 the system- how are people designing front ends without pulling the files 
 out (which breaks previewing) ?



-- 

--- 
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: Errors in form, please check it out....... HOW?

2013-07-21 Thread REM
Crucially, one needs to remain aware of this passage from the manual:

*When you upload an application, you need to specify a name for it (using 
different names allows you to install multiple copies of the same 
application)*

This is the root of the problem I was having and, probably, you too.



On Monday, June 17, 2013 10:04:50 AM UTC-4, REM wrote:

 I'm attempting to understand a few things and decided to test out one of 
 the items at: http://web2py.com/appliances

 Specifically, the video library example at the bottom of the page. I tried 
 installing it from the URL feature on the admin page but I get the message:

 Errors in form, please check it out

 However, how in the world does one check it out? WHERE is it? WHAT, in 
 fact, am I checking out?

 I downloaded the referenced .web2py file and my (Ubuntu) system tells me 
 it's a gzipped file, but I can't open it with anything. I then tried 
 installing that locally downloaded file through admin: same error.

 So, I tried downloading and installing others and, in every single case: 
 no donuts!

 So, how does one even begin to figure out the cause of this?


-- 

--- 
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: Editor broken in trunk (07-18-13) on FF 23

2013-07-21 Thread Tim Richardson
On trunk, OS x 10.8.3 and Firefox 23 it works fine for me. 

-- 

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




[web2py] [web2pyy] Mysql 2 Mongodb

2013-07-21 Thread Mike Veltman

I am just playing around with mongodb and web2py 

I noticed that when I just make a web2py dump of my mysql db and then upload it 
to mongodb some of the joins now just rec id's are right and some are newly 
generated.

Also would it be possible to keep id to be web2py specific and to use _id for 
mongodb ?

I was wondering if it was a bug. In this case in the setup table the pointers 
to the frame work fine, but the pointers in the setupprofile named lparprofile 
do not exist anymore in the lparprofile table.

Mike 


db.define_table('frame',

Field('framename', type='string',
  unique=True,
  label=T('Framename')),
Field('description', type='string',
  label=T('Description')),
Field('netboot', type='string',default=None,
  label=T('Netboot information')),
Field('ip', type='string',
  unique=True,
  label=T('IP Address')),
Field('servermodel', type='string',default=p6,
  label=T('Server model')),
Field('serial', type='string',default=None,
  label=T('Serial Number')),
Field('lvname', type='string',default=FRAMEx,
  label=T('Frame extension for storage logical volumes')),
Field('framestaterecord_ID', type='integer',
  label=T('Frame State record ID')),
Field('created_on','datetime',default=request.now,
  label=T('Created On'),writable=False,readable=False),
Field('modified_on','datetime',default=request.now,
  label=T('Modified On'),writable=False,readable=False,
  update=request.now),
format='%(framename)s',
migrate=settings.migrate)

# Table rules
db.frame.framename.requires = IS_NOT_EMPTY()
db.frame.ip.requires = IS_NOT_EMPTY()
db.frame.servermodel.requires = IS_IN_SET(['p5', 'p6'])

db.define_table('setup',

Field('setupname', type='string',
  unique=True,
  label=T('Setup name')),
Field('description', type='string',
  label=T('Description')),
Field('frame_id', db.frame,
  label=T('Frame ID')),
Field('course_id', db.course,
  label=T('Course ID')),
Field('usedstorage_id', db.storageunit,
  label=T('Storage ID')),
Field('disksetupname_id', db.disksetupname,
  label=T('Disk group selection ID for storage setup')),
Field('nimhost_id', db.host,
  label=T('Nim Host ID')),
Field('hmchost_id', db.host,
  label=T('HMC Host ID')),
Field('ready', type='boolean',
  default=False,
  label=T('Ready for use')), 
Field('nostorage', type='boolean',
  default=False,
  label=T('No storage needed')),
Field('noprofiles', type='boolean',
  default=False,
  label=T('No profiles needed')),
Field('nonim', type='boolean',
  default=False,
  label=T('No nim actions needed')),
  Field('securitylevel', type='integer',
  default=0,
  label=T('Security Level')),
Field('created_on','datetime',default=request.now,
  label=T('Created On'),writable=False,readable=False),
Field('modified_on','datetime',default=request.now,
  label=T('Modified On'),writable=False,readable=False,
  update=request.now),
format='%(setupname)s',
migrate=settings.migrate)   

# Table rules for setup
db.setup.setupname.requires = IS_NOT_EMPTY()
db.setup.frame_id.requires = IS_IN_DB(db, 'frame.id', 'frame.framename')
db.setup.course_id.requires = IS_IN_DB(db, 'course.id', 'course.coursename')
db.setup.usedstorage_id.requires = IS_IN_DB(db, 'storageunit.id', 
'storageunit.storagename')
db.setup.nimhost_id.requires = IS_IN_DB(db, 'host.id', 'host.hostname')
db.setup.hmchost_id.requires = IS_IN_DB(db, 'host.id', 'host.hostname')
db.setup.disksetupname_id.requires = IS_IN_DB(db, 'disksetupname.id', 
'disksetupname.disksetupnamedesc')

db.define_table('setupprofile',

Field('setup_id', db.setup,
  label=T('Setup ID')),
Field('frame_id', db.frame,
  default=5,
  label=T('Frame ID')),
Field('lparprofile_id', db.lparprofile,
  label=T('Profile ID')),
Field('seq','integer',
  label=T('Deployment Sequence')),
migrate=settings.migrate)   


# table rules for setup profile
db.setupprofile.seq.requires = IS_INT_IN_RANGE(1, 300)
db.setupprofile.setup_id.requires = IS_IN_DB(db, 'setup.id', 'setup.setupname')
db.setupprofile.lparprofile_id.requires = IS_IN_DB(db, 'lparprofile.id', 
'lparprofile.lparname')
db.setupprofile.frame_id.requires = IS_IN_DB(db, 'frame.id', 'frame.framename')



-- 

--- 
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] Pass helpers in variable to views

2013-07-21 Thread shapovalovdenis
Hi!

Know that I missing something obvious here, but still:

I store parts of page to be displayed in db, in html code, and return it to 
view, so content from db is in content_block var:

   def get_block():
  [some other code]
  content_block = XML(h1 Some Title /h1 img 
src='{{=URL('static','images/python.gif')}}, sanitize=False
  return dict(form=form, content_block = content_block)


view:
{{extend 'layout.html'}}
{{=form}}
{{block content_block}} {{=content_block}} {{end}}

but it turns out that URL helper is not executed when passed to view in an 
variable, so I get img src={{=URL( static',images= python.gif')}}= 
in the browser. 
Probably the view gets constructed (parsed) before vars passed to it are 
added.

So, what is the best way to pass HTML parts with helpers (for IMG, A, etc) 
to view in an variable and still use the advantages of URL helper? 
I don't like the idea of statically setting links in html parts.


-- 

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