[web2py] Re: Proposal: Documentation in form of a wiki

2015-08-18 Thread Niphlod
as long as he commits to support it for at least 2 years, go for it. Sorry 
but I'll stick to publish whatever recipe on web2pyslices.com for the 
moment.

On Monday, August 17, 2015 at 11:39:45 PM UTC+2, Jaime Sempere wrote:

 I like the idea. I think we would need something like web2pyslices but in 
 a more modern/updated way... and easy to contribute. Web2py has a lot of 
 details very good to know but difficult to learn or to get. Also it would 
 be great to be able to upload litlle projects (I have just implemented some 
 days ago a multifile upload solution, I took some posts from this group and 
 adapt it a lot, and I would have liked to share the 'final' solution in an 
 easy way)...

 well ideas, ideas... any super hero wanna take the flag? :)



 El lunes, 17 de agosto de 2015, 12:40:18 (UTC+2), Najtsirk escribió:

 Hi,

 I was wondering: would it be ok to have a documentation in form of a wiki 
 or something so anybody can contribute to it? And sure...Massimo has to 
 confirm it before publishing it.

 My idea goes in this way: if i get my problem solved here on google 
 groups, I will be willing to contribute a short article to wiki about it. 
 Maybe wouldn't be a perfect solutions but somebody else could build upon it 
 and make better example.

 Best,
 Najtsirk



-- 
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/d/optout.


[web2py] Re: IIS 8.5 static file using rewrite problem

2015-08-18 Thread Niphlod
didn't quite get if it's an error on the recipe (which I can't replicate, 
since it's my standard tried several times setup) or your slightly changed 
recipe was the cause of the error.

On Tuesday, August 18, 2015 at 10:07:21 AM UTC+2, Remco Boerma wrote:

 Solved. 

 While gathering information about my setup I found the solution. 

 Setting Default web site  Authentication  Anonymous Authentication 
 (keep enabled)  to Application Pool Identity solved my issue. 



 Here's a few tags and keywords for future reference when someone else 
 bumps into this: 

 In IIS i have one site, which is the default web site. It's stored at 
 c:/inetpub/wwwroot. This is where the web2py zip file contents went, so 
 there is an applications folder, examples, gluon, jada jada. URL rewrite is 
 used like in the example given in the web2py book. 
 When the static rewrite rule is enabled and setting error pages  Edit 
 feature settings Detailed errors I  get the following error when 
 requesting http://wvwebt01/welcome/static/css/calendar.css:


 HTTP Error 401.3 - Unauthorized
 You do not have permission to view this directory or page because of the 
 access control list (ACL) configuration or encryption settings for this 
 resource on the Web server.

 Detailed Error Information:
 Module   IIS Web Core
 Notification   AuthenticateRequest
 Handler   StaticFile
 Error Code   0x80070005
 Requested URL   
 http://wvwebt01:80/applications/welcome/static/css/calendar.css
 Physical Path   
 C:\inetpub\wwwroot\applications\welcome\static\css\calendar.css
 Logon Method   Anonymous
 Logon User   Anonymous

 Looking at http://stackoverflow.com/a/10457630 i changed iis manager 
 default web site  authentication  Anonymous Authentication  Edit...  to 
 Application pool identity instead of specific user: IUSR (which is the 
 default). Since this user is not given any direct access on the files, but 
 following the books recipe the  application pool group is. 
 (http://www.web2py.com/books/default/chapter/29/13/deployment-recipes#IIS) 

 Thanks anyway Niphlod!

 Op donderdag 13 augustus 2015 15:03:34 UTC+2 schreef Niphlod:

 401 means not authorized. What happens without rewrite (or incorrect 
 ones) is usually 404 (not found) . 
 Can you post more details about the structure of the iis site which the 
 app belongs ?

 On Wednesday, August 12, 2015 at 6:01:45 PM UTC+2, Remco Boerma wrote:

 Hi, 

 I'm migrating from ubuntu to windows 2012R2 + IIS 8.5. 

 Following a slightly altered recipe from the book to install web2py 
 under IIS (but mostly the same) i've come across a strange error. Since i'm 
 not accustomed to IIS, it can well be my issue is standard 
 IIS-knowledge-gap related. I have installed the rules module, have web2py 
 up and running. Now i installed another app inside web2py that worked 
 before on a 2.11.2 on my local windows machine as well as on a 2.9.5 server 
 behind apache and all of a sudden my static files are 401'd 

 I don't use any special static versioning. When i disabled the static 
 rewrite rule everything works like a charm. My setup is as simple as 
 possible (only web2py in the root) running 2.12.2 stable on ii 8.5 python 
 2.7.9. 

 the static rule in web.config (comes from the sample) is: 

 rule name=static enabled=false stopProcessing=true match 
 url=^(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ / conditions 
 logicalGrouping=MatchAll trackAllCaptures=false / action 
 type=Rewrite url=applications/{R:1}/static/{R:2} 
 logRewrittenUrl=false / /rule

 Does anyone have any clue why i have those 401s? 


 With kind regards, 
 Remco Boerma




-- 
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/d/optout.


[web2py] Re: 2.12.1 is out

2015-08-17 Thread Niphlod
due to bad 
commit 
https://github.com/web2py/web2py/commit/e95115deb401552d122ff06c3482c264e02eaf32
 
 multi-groan :P

On Monday, August 17, 2015 at 4:41:25 PM UTC+2, Paolo Valleri wrote:

 @Massimo, I've just noticed that web2py 2.12.2 points to an old version of 
 pydal. is that correct?
 see https://github.com/web2py/web2py/tree/R-2.12.2/gluon/packages

 Paolo

 On Sunday, August 16, 2015 at 10:45:19 PM UTC+2, Massimo Di Pierro wrote:

 Fine with most of these. Can you send PR requests and I will 
 review/accept/reject?
 Massimo

 On Saturday, 15 August 2015 08:58:58 UTC-5, ermolaev...@gmail.com wrote:

 for prevetn pickle error please add new param in session:

 session.connect(request,response,cookie_key='kjykGFDRETfxf65',
 compression_level=None, *pickle_low*=True)


 If *pickle_low: - not use high protocol foe pickle*



-- 
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/d/optout.


[web2py] Re: Change in application request.vars when switching from Rocket to Lighttpd+FastCGI

2015-08-14 Thread Niphlod
it's the same level of bummer, if not a higher order of magnitude, to patch 
core web2py to address a bugged webserver.

On Friday, August 14, 2015 at 11:31:15 AM UTC+2, Encompass solutions wrote:

 Is there any progress with this issue?
 I have lighttpd setup and it seems to still have the issue.  Take a look 
 at this screenshot to see.
 It's a real bummer as the NGINX has proven hard to install on centos 6.6. 
 At least for us. :)




 On Sunday, March 1, 2015 at 10:38:37 AM UTC+2, Niphlod wrote:

 yep, but we do it for the users in all the important places, like 
 this, we use request.env.get('THE_PROPER_KEY')

 On Saturday, February 28, 2015 at 9:27:20 PM UTC+1, Massimo Di Pierro 
 wrote:

 They are upper case in wsgi but we are supposed to make them all lower 
 case here:

 https://github.com/web2py/web2py/blob/master/gluon/rewrite.py#L1073

 On Saturday, 28 February 2015 10:44:35 UTC-6, Niphlod wrote:



 On Saturday, February 28, 2015 at 5:08:38 PM UTC+1, Massimo Di Pierro 
 wrote:

 it is supposed to be request.env.query_string 
 or request.env.get('query_string'). It is supposed to be lower case and 
 not 
 upper case. If nginx has it upper case than there is a bug.

 In retrospect it was a mistake to convert all the env vars to lower 
 case and replace the dashed with underscore but that is what web2py does 
 anyway.



 uhm. the problem was on lighttpd. 
 Anyway, I think env vars are all uppercase: we just normalize them to 
 have an underscore and be lowercase, but it's certainly not the issue at 
 hand...web2py's code picks it up from the right place.



-- 
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/d/optout.


[web2py] Re: Load Balanced Server code updating

2015-08-13 Thread Niphlod
puppet, chef or ansible are more geared towards prepare me a new node to 
add to the cluster rather than update the application files on every node 
of my cluster but feel free to engage. My point was start small and 
simple, then reiterate. chef ansible and puppet are more likely the 1000th 
reiteration than the 1st.

On Wednesday, August 12, 2015 at 5:50:10 PM UTC+2, Michael M wrote:

 That gives me a lot to go on.  Thank-you Niphlod. 

 I just got off the vanpool this morning and found out one of my co-workers 
 runs some of our corporate infrastructure.  He suggested I look at Puppet, 
 Chef, or Ansible for cluster management.  So looks like I have some 
 learning to do.  :)

 Wish me luck.  :)

 On Wednesday, August 12, 2015 at 12:03:33 AM UTC-7, Niphlod wrote:

 the update process on several frontend servers can be split into 2 modes: 
 you can have an incremental update, in which the newer version of the 
 application doesn't break the old one, and the breaking update, in which 
 the newer version of the application breaks the old one.

 in the first case, you can log into each one of the servers and update 
 the app.
 in the second case, you need to log into each server, put the application 
 in maintenance mode, update each server, and then revoke the maintenance 
 mode on each.

 there are SEVERAL ways to do it, some more elegant and intricated, some 
 more simple and maintainable.

 Start with basics: prepare a makefile or a procedure that updates a 
 single node, then execute it in a foreach server loop. It can be bash, 
 python, go, whatever you're more comfortable with. Draw the procedure on a 
 sheet of paper first (yes, it gets the deal done to unravel the necessary 
 steps beforehand) and then implement each piece. I use fabric to handle the 
 automation part wherever I can. Bash makefiles or powershell scripts where 
 I can't.

 On Wednesday, August 12, 2015 at 7:49:13 AM UTC+2, Michael M wrote:

 Hello All,

 I was looking at Load Balancing due to my Self Service Web Portal is I/O 
 and Networking intensive.  

 I found 
 http://www.web2pyslices.com/slice/show/1360/high-availability-cluster-with-pound
  
 in it there is a this We recommend using  
 http://www.web2pyslices.com/slice/show/1360/29this install procedure 
 http://www.web2pyslices.com/slice/show/1360/29 Which looks like a 
 dead link.

 So if anyone knows the current slice that is referring to would be a 
 great help.

 The main question is: Say I have 10 servers and I make a change to a 
 module  and a view of an application.  How do I update to all servers 
 without having to log into each and upload a Tar?

 Or what is the best practices?

 I am new to web-servers so please be verbose so I can learn as much as 
 possible.  Thank-you.



-- 
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/d/optout.


[web2py] Re: IIS 8.5 static file using rewrite problem

2015-08-13 Thread Niphlod
401 means not authorized. What happens without rewrite (or incorrect ones) 
is usually 404 (not found) . 
Can you post more details about the structure of the iis site which the app 
belongs ?

On Wednesday, August 12, 2015 at 6:01:45 PM UTC+2, Remco Boerma wrote:

 Hi, 

 I'm migrating from ubuntu to windows 2012R2 + IIS 8.5. 

 Following a slightly altered recipe from the book to install web2py under 
 IIS (but mostly the same) i've come across a strange error. Since i'm not 
 accustomed to IIS, it can well be my issue is standard IIS-knowledge-gap 
 related. I have installed the rules module, have web2py up and running. Now 
 i installed another app inside web2py that worked before on a 2.11.2 on my 
 local windows machine as well as on a 2.9.5 server behind apache and all of 
 a sudden my static files are 401'd 

 I don't use any special static versioning. When i disabled the static 
 rewrite rule everything works like a charm. My setup is as simple as 
 possible (only web2py in the root) running 2.12.2 stable on ii 8.5 python 
 2.7.9. 

 the static rule in web.config (comes from the sample) is: 

 rule name=static enabled=false stopProcessing=true match 
 url=^(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ / conditions 
 logicalGrouping=MatchAll trackAllCaptures=false / action 
 type=Rewrite url=applications/{R:1}/static/{R:2} 
 logRewrittenUrl=false / /rule

 Does anyone have any clue why i have those 401s? 


 With kind regards, 
 Remco Boerma




-- 
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/d/optout.


[web2py] Re: database query parsing

2015-08-12 Thread Niphlod
when you fetch fields from different tables, as you highlighted already, 
you don't have a resultset holding just columns, you have a dict holding 
table that hold fields.

i.e. single table, named test_table with 2 fields, field_1 and 
field_2 will return a structure like

{'field_1': value1, 'field_2': value2 }

opposed to two tables, named test_table1 and test_table2 each one 
holding field_1 and field_2 will return a structure like

{'test_table1' : {'field_1': value1, 'field_2': value2 } , 'test_table2' : 
{'field_1': value1, 'field_2': value2 } }

soif you want to get to the value1 stored into the first field of 
the first table, you'd need in the first case to do just

row.field_1

while in the second case you'd need also the table name

row.test_table1.field_1



On Wednesday, August 12, 2015 at 7:49:13 AM UTC+2, Iancic Bogdan wrote:

 I have the following query: available_designs = db(db.component.id
 ==db.component_stock.fk_stock_component)(db.stock.fk_componentstock_authuser==auth.user).select()
 which returns me a row: Row {'component': {'component_description': 'x ', 
 'id': 1L, 'component_code': 'A253', 'path_to_source_file': 'x', 'name': 
 'y'}, 'stock': {'fk_stock_user': 1L, 'fk_stock_component': 1L, 
 'prints_available': 20L, 'id': 4L}}

 in view I want to print a table having the following columns: name, 
 component_description, prints_available from the row that the query returns

 I don't know how to parse the row that the query returns. Could anyone 
 help?

 This is what i have written in view:
 {{if available_designs:}}
 h3{{=T('Designs available for print:')}}/h3
 {{i=0}}
 table
 thead
 th#/th
 th{{=T('Component name')}}/th
 th{{=T('Description')}}/th
 th{{=T('Prints available)}}/th
 /thead
 tbody
 {{for design in available_designs:}}
 trtd{{=i+1}}/tdtd{{=design.name
 }}/tdtd{{=design.component_description}}/tdtd{{=design.prints_available}}/td/tr
 {{pass}}
 /tbody
 /table
 {{i=i+1}}
 {{pass}}


-- 
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/d/optout.


[web2py] Re: Load Balanced Server code updating

2015-08-12 Thread Niphlod
the update process on several frontend servers can be split into 2 modes: 
you can have an incremental update, in which the newer version of the 
application doesn't break the old one, and the breaking update, in which 
the newer version of the application breaks the old one.

in the first case, you can log into each one of the servers and update the 
app.
in the second case, you need to log into each server, put the application 
in maintenance mode, update each server, and then revoke the maintenance 
mode on each.

there are SEVERAL ways to do it, some more elegant and intricated, some 
more simple and maintainable.

Start with basics: prepare a makefile or a procedure that updates a single 
node, then execute it in a foreach server loop. It can be bash, python, 
go, whatever you're more comfortable with. Draw the procedure on a sheet of 
paper first (yes, it gets the deal done to unravel the necessary steps 
beforehand) and then implement each piece. I use fabric to handle the 
automation part wherever I can. Bash makefiles or powershell scripts where 
I can't.

On Wednesday, August 12, 2015 at 7:49:13 AM UTC+2, Michael M wrote:

 Hello All,

 I was looking at Load Balancing due to my Self Service Web Portal is I/O 
 and Networking intensive.  

 I found 
 http://www.web2pyslices.com/slice/show/1360/high-availability-cluster-with-pound
  
 in it there is a this We recommend using  
 http://www.web2pyslices.com/slice/show/1360/29this install procedure 
 http://www.web2pyslices.com/slice/show/1360/29 Which looks like a dead 
 link.

 So if anyone knows the current slice that is referring to would be a great 
 help.

 The main question is: Say I have 10 servers and I make a change to a 
 module  and a view of an application.  How do I update to all servers 
 without having to log into each and upload a Tar?

 Or what is the best practices?

 I am new to web-servers so please be verbose so I can learn as much as 
 possible.  Thank-you.


-- 
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/d/optout.


[web2py] Re: Uploading app to server using ftp

2015-08-12 Thread Niphlod
if you're uploading the app, don't upload the packed version. Upload just 
the application structure inside the folder, as it is in your development 
server.

On Wednesday, August 12, 2015 at 7:50:45 AM UTC+2, Joe wrote:

 I can't install my app on pythonanywhere server using the web2py admin 
 because the app is too big according to pythonanywhere (850MB). The only 
 option seems to be using sftp but I am unable to install the app that way.
 Here is how I tried to do it but, of course, it's not working:

 I connected to the server using sftp and located the application directory 
 in the web2py directory where I need to upload my app. I created a 
 directory there naming it init, then I uploaded my packed web2py app 
 package to the init directory using the sftp.

 I checked in the web2py admin and the init directory is there, where it's 
 supposed to be as expected but the app is not installed.

 I would appreciate some advise.

 Thanks very much.



-- 
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/d/optout.


[web2py] Re: Modifying web2py JS files -- best practices?

2015-08-06 Thread Niphlod
in addition to what mdpierro said, I'd argue that the best solution is 
overriding, which can be done with the recent web2py.js versions. If a new 
version comes out, you'd need to review the changed functionality and 
update the custom overrides accordingly.
We do this 
already 
https://github.com/web2py/web2py/blob/master/applications/welcome/static/js/web2py-bootstrap3.js

On Thursday, August 6, 2015 at 8:13:58 AM UTC+2, Massimo Di Pierro wrote:

 Why do you need to change web2py.js? I have nothing against. I just would 
 like to understand if there is something we can do to make it more general.

 On Thursday, 6 August 2015 00:41:12 UTC-5, Joe Barnhart wrote:

 It seems more and more clear I'm going to be making changes to the 
 included web2py.js file.  I'm worried about keeping current when new 
 versions of web2py come out if I've mucked a lot with this javascript file.

 So what does everyone else do?  How do we customize the platform and 
 still keep current with its evolution?  Is there an accepted best 
 practice in this area?

 -- Joe



-- 
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/d/optout.


[web2py] Re: Oracle CLOB/text insert adapter issues

2015-08-04 Thread Niphlod
ok, we were discussing the same thing over at pydal's repo to address 
another issue, that is closely related 
. https://github.com/web2py/pydal/issues/155

On Monday, August 3, 2015 at 8:57:44 PM UTC+2, Boris Aramis Aguilar 
Rodríguez wrote:

 I've found the following:

 To insert a text using the cx_Oracle driver directly if you do something 
 like

 import cx_Oracle
 connection = cx_Oracle.connect('connectionstring')

 cursor = connection.cursor()

 p = ''
 for i in range(1,1):
   p += str(i)

 sss = INSERT INTO 
 ipvpn_route_table(read_datetime,ip_vpn,route_table,destinations) VALUES 
 (NULL,6,' + p + ',' + p + ')
 cursor.execute(sss)

 It fails with the same error as the web2py traceback

 DatabaseError: ORA-01704: string literal too long

 The correct way to do it is by passing it with parameters (and it works with 
 any ammount of characters below 4GB of clob data) as follows:

 import cx_Oracle
 connection = cx_Oracle.connect('... connection string')

 cursor = connection.cursor()

 p = ''
 for i in range(1,1):
   p += str(i)

 sss = INSERT INTO 
 ipvpn_route_table(read_datetime,ip_vpn,route_table,destinations) VALUES 
 (NULL,6,:FOO,:BAR)
 cursor.execute(sss, FOO=p, BAR=p)



 El lunes, 3 de agosto de 2015, 9:51:16 (UTC-6), Boris Aramis Aguilar 
 Rodríguez escribió:

 Hi,

 I've been currently working with Oracle as a database backend, I have 
 found one issue that I highly suspect has to do with the DAL Adapter; when 
 you use web2py text fields they get mapped into CLOB with oracle database 
 backend (as you can see on the OracleAdapter code) the issue is dealing 
 with text longer than 4k characters. Oracle doesn't support a typical 
 insert with more than 4k characters dealing with a CLOB data type, because 
 it treats it as a string and strings can't be more than 4k characters long. 
 So for example dealing with a table like

 db.define_table('atable', Field('longtext', 'text'))

 db.atable.insert(longtext=somelongtext) #This fails with the following 
 exception

   File /var/www/web2py/gluon/packages/dal/pydal/objects.py, line 691, in 
 insert
 ret = self._db._adapter.insert(self, self._listify(fields))
   File /var/www/web2py/gluon/packages/dal/pydal/adapters/base.py, line 
 731, in insert
 raise e
 DatabaseError: ORA-01704: string literal too long

 And reading trough several forums I found that this error appears on CLOB 
 insertion when you do a tipycal insert. 
 https://community.oracle.com/thread/1068414?start=0tstart=0

 So i guess OracleAdapter is trying to achieve a typical insertion when it 
 shouldn't as it has to deal with CLOB logic.

 I think I could fix the problem but I'm not really sure if someone can help 
 me out with a hint of some kind.

 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/d/optout.


[web2py] Re: Again on scheduler

2015-08-04 Thread Niphlod
repeats = 0, period = 3600 .

On Tuesday, August 4, 2015 at 8:35:58 AM UTC+2, Paolo Amboni wrote:

 What if i need to *run an action every hour*?
 (Let's say to strore a data fom a sensor).

 I'm also trying to use cron but when i start python web2py.py -Y it gives 
 me errors.

 Is there a way to reschedule the same action every hour?
 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/d/optout.


[web2py] Re: scheduler

2015-08-03 Thread Niphlod
you NEED db.commit() (not commiNt()) in the scheduler function. 

On Monday, August 3, 2015 at 2:20:24 PM UTC+2, Lisandro wrote:

 Look for the traceback information in the table scheduler_run. If the 
 function fails, there will be a record in that table showing some detail 
 about the error. Post that traceback here so we can figure it out where is 
 the error.

 Also, make sure you instantiate Scheduler() with migrate=True at least one 
 time, in order to let web2py create the tables needed by the Scheduler.

 El lunes, 3 de agosto de 2015, 6:40:28 (UTC-3), Paolo Amboni escribió:


 i can't understand why this scheduled task always fails.
 *It sems something related to the command commit().*
 But without it no changes are saved in the db.
 The same function without the commit command works fine in a controller
 The code is the following:

 db.py
 db.define_table('test',
 Field('tempo','datetime',default=request.now),
 Field('nome','string')
)

 scheduler,py
 def func1():
 db.test.insert(nome='func1')
 db.commint()

 from gluon.scheduler import Scheduler
 import datetime
 scheduler= Scheduler(db,tasks=dict(test1=func1))



-- 
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/d/optout.


[web2py] Re: File upload/download over https freezes site

2015-08-03 Thread Niphlod
IMHO given that the majority of issues reported come with one step 
production deployment keywords, the book 
chapter 
http://web2py.com/books/default/chapter/29/13/deployment-recipes#One-step-production-deployment
 
should be redacted to point to the script provisioning uwsgi and nginx 
instead of the bugged one provisioning apache.

On Friday, July 31, 2015 at 7:19:54 PM UTC+2, Massimo Di Pierro wrote:

 I think that commit should be reversed. O changed to processes=5 
 threads=1. but this may cause an increased memory usage and it is not a 
 good thing with apache. Agreed that Apache is no longer recommended (not 
 just for web2py users) but we should continue to support it because it is 
 still the mots popular web server.




-- 
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/d/optout.


[web2py] Re: Error in last stable version when trying to delete through one to many relation

2015-08-03 Thread Niphlod
an app to reproduce the issue (or at least a model definition!) would be 
fine to spot the error.

On Monday, August 3, 2015 at 2:13:45 PM UTC+2, Lisandro wrote:

 I've upgraded from version 2.10.3 to last stable version 2.11.2, but after 
 the upgrade, an error is thrown when trying to delete a subset through one 
 to many relation.

 Consider the example of the book (table person, and table thing, each 
 thing is owned by one person):

 http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#One-to-many-relation

 This is the error's traceback:

 Traceback (most recent call last):
   File /home/gonguinguen/medios/gluon/restricted.py, line 227, in restricted
 exec ccode in environment
   File 
 /home/gonguinguen/medios/applications/demo_panel/controllers/contenido.py 
 http://localhost/admin/edit/demo_panel/controllers/contenido.py, line 459, 
 in module
   File /home/gonguinguen/medios/gluon/globals.py, line 412, in lambda
 self._caller = lambda f: f()
   File /home/gonguinguen/medios/gluon/tools.py, line 3583, in f
 return action(*a, **b)
   File 
 /home/gonguinguen/medios/applications/demo_panel/controllers/contenido.py 
 http://localhost/admin/edit/demo_panel/controllers/contenido.py, line 436, 
 in _eliminar_borrador
 noticia.galeria_contenido.delete()
   File 
 /home/gonguinguen/medios/gluon/packages/dal/pydal/helpers/classes.py, line 
 348, in __getattr__
 raise AttributeError
 AttributeError


 The error disappears downgrading to version 2.10.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/d/optout.


[web2py] Re: Error in last stable version when trying to delete through one to many relation

2015-08-03 Thread Niphlod
uhm, I can't reproduce with a minimal model and 2.11.2 ..
what backend are you using ?


web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2015
Version 2.11.2-stable+timestamp.2015.05.30.11.29.46
Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000, 
pyodbc
WARNING:web2py:import IPython error; use default python shell
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] 
on win
32
Type help, copyright, credits or license for more information.
(InteractiveConsole)
 db.define_table('contenido', Field('titulo'))
Table contenido (id,titulo)
 db.define_table('galeria_contenido', Field('contenido', db.contenido, 
ondele
te='NO ACTION'), Field('titulo'))
Table galeria_contenido (id,contenido,titulo)
 db.contenido.insert(titulo='test')
1L
 db.galeria_contenido.insert(contenido=1, titulo='galeria_1')
1L
 db.galeria_contenido.insert(contenido=1, titulo='galeria_2')
2L
 db.contenido[1]
Row {'titulo': 'test', 'id': 1L, 'galeria_contenido': Set (
galeria_contenido.contenido = 1)}
 contenido_1 = db.contenido[1]
 contenido_1
Row {'titulo': 'test', 'id': 1L, 'galeria_contenido': Set (
galeria_contenido.contenido = 1)}
 contenido_1.galeria_contenido.delete()
2




Can you replicate the issue with this ultra-slim model ?


-- 
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/d/optout.


[web2py] Re: Oracle CLOB/text insert adapter issues

2015-08-03 Thread Niphlod
to help pinpoint the issue, how do you insert a text, let's say of 8000 
chars, into Oracle, using python and the cxOracle driver ?

On Monday, August 3, 2015 at 5:51:16 PM UTC+2, Boris Aramis Aguilar 
Rodríguez wrote:

 Hi,

 I've been currently working with Oracle as a database backend, I have 
 found one issue that I highly suspect has to do with the DAL Adapter; when 
 you use web2py text fields they get mapped into CLOB with oracle database 
 backend (as you can see on the OracleAdapter code) the issue is dealing 
 with text longer than 4k characters. Oracle doesn't support a typical 
 insert with more than 4k characters dealing with a CLOB data type, because 
 it treats it as a string and strings can't be more than 4k characters long. 
 So for example dealing with a table like

 db.define_table('atable', Field('longtext', 'text'))

 db.atable.insert(longtext=somelongtext) #This fails with the following 
 exception

   File /var/www/web2py/gluon/packages/dal/pydal/objects.py, line 691, in 
 insert
 ret = self._db._adapter.insert(self, self._listify(fields))
   File /var/www/web2py/gluon/packages/dal/pydal/adapters/base.py, line 731, 
 in insert
 raise e
 DatabaseError: ORA-01704: string literal too long

 And reading trough several forums I found that this error appears on CLOB 
 insertion when you do a tipycal insert. 
 https://community.oracle.com/thread/1068414?start=0tstart=0

 So i guess OracleAdapter is trying to achieve a typical insertion when it 
 shouldn't as it has to deal with CLOB logic.

 I think I could fix the problem but I'm not really sure if someone can help 
 me out with a hint of some kind.

 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/d/optout.


[web2py] Re: File upload/download over https freezes site

2015-07-31 Thread Niphlod
let's not spread misinformations  python has the GIL, true, and 15 
threads with a single process won't use any cpu a single thread can use, 
nor span multiple cpus. But for anyone's sake, we're deploying a webapp in 
PRODUCTION, whose purpose should be - at the very least - be concurrent. 
If we force 1 process and a single thread, make ourselves a clap, than bang 
the head to the wall. we're serializing everything! 

tl;dr: I understand someone may think that 1 process with 15 threads 
(defaults of the apache directive) slow things down when you have 4xcpu and 
3 of them remain underutilized while serving concurrently 15 requests (buh 
huh GIL, but I'd like to see test results), and that maybe a 4 processes 
with each 5 threads would be a smarter choice (really?!) but 1 process and 
1 thread is a complete joke. 

On Friday, July 31, 2015 at 8:18:23 AM UTC+2, Derek wrote:

 I believe that's what Massimo is trying to say. Each processor has it's 
 own GIL.

 On Thursday, July 30, 2015 at 6:31:57 PM UTC-7, Dave wrote:

 Thanks for tracking that down!  So based on that post, and this one, it 
 looks like i should be setting proccesses = # of cores, and threads = 1?

 https://groups.google.com/forum/#!topic/web2py/mPdn1ClxLTI

 Massimo DI Pierro:
 There are pros and cons. If you use threads in a python program, the more 
 computing cores you have, the slower - not faster - the program gets. This 
 is a python feature because even if you have threads, there is only one 
 interpreted and therefore execution is serialized anyway. For scalability 
 you should have processes (not threads) one per core.



 On Thursday, 30 July 2015 14:15:36 UTC-6, Derek wrote:

 looks like that change came from here:


 https://groups.google.com/forum/#!searchin/web2py/processes$3D1$20threads$3D1|sort:date/web2py/jumZFKX2614/pu-NNXSMKHgJ

 based on the post from Thomas...

 Thomas J. 
 10/3/13
 I've recently been comparing Web2py and PHP, this is what i found, maybe 
 it helps:

 1.: PHP is faster whereever it can do stuff within the interpreter, that 
 includes handling post/get-data or templates. The PHP interpreter is 
 written in C, so these things are really fast, whereas Web2py has to to 
 them in Python.
 2. DB access is heavily dependent on how many records you retrieve. 
 Translating a query from DAL to SQL is basically free (so using the DAL 
 syntax for DB access isn't an issue), putting the data into Python objects 
 is quite expensive however. Only query what you really need. Also, using 
 executesql() instead of the regular DAL syntax may help there, as it 
 returns tuples, not complex data structures
 3. I've found the default config for Apache2 to be somewhat broken as 
 far as concurrency is concerned. Check your Apache/WSGI config, you 
 probably have a line like WSGIDaemonProcess web2py user=www-data 
 group=www-data in there. This actually defaults to 1 process with 15 
 threads, which -- on my machine -- completely kills performance (Python 
 doesn't do threads well because of the global interpreter lock). I've found 
 that even something like WSGIDaemonProcess web2py user=www-data 
 group=www-data processes=1 threads=1 improves performance for concurrent 
 requests dramatically. Try tinkering with the processes-value to find the 
 best config for your machine. 

 You should probably change processes before you change threads.

 On Wednesday, July 29, 2015 at 3:40:30 PM UTC-7, Dave wrote:

 That would be good to know.  Nothing in the web2py docs suggests that 
 Apache should not be used in production, it actually seems more like the 
 default since it is the first discussed in the documentation and it's used 
 in the one-step production deployment. 

 The line of code in question is also in the one-step deployment script 
 here:
 http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh


 On Wednesday, 29 July 2015 14:32:19 UTC-6, Niphlod wrote:

 I dropped off the apache train too soon to have any issues with it, 
 but frankly, given the total sum of issues encountered so far on the 
 forums, I'm starting to think that we'd need to officially discontinue 
 our apache support.. may be total lack of luck in setting it up or very 
 biased perspective, or total lack of internal knowledge but it seems that 
 every problem that pops up with deployments have apache as the common 
 ground.

 looks like this is the commit to be blamed


 https://github.com/web2py/web2py/commit/2a062a2ff5aa1e07e7bfcfdbf36b7f72e8aac5b4

 I don't know the specifics around it but if it acts like it suggests, 
 1 thread and 1 process as a total sum aren't really worth of a production 
 deployment.


 On Wednesday, July 29, 2015 at 6:00:47 PM UTC+2, Dave wrote:

 Actually, it looks like i was chasing the wrong issue... It wasn't 
 https after all.

 Everything seems to be working after changing this line in apache 
 default.conf:

 WSGIDaemonProcess web2py user=www-data group=www-data processes=1 
 threads=1

[web2py] Re: File upload/download over https freezes site

2015-07-29 Thread Niphlod
I dropped off the apache train too soon to have any issues with it, but 
frankly, given the total sum of issues encountered so far on the forums, 
I'm starting to think that we'd need to officially discontinue our apache 
support.. may be total lack of luck in setting it up or very biased 
perspective, or total lack of internal knowledge but it seems that every 
problem that pops up with deployments have apache as the common ground.

looks like this is the commit to be blamed

https://github.com/web2py/web2py/commit/2a062a2ff5aa1e07e7bfcfdbf36b7f72e8aac5b4

I don't know the specifics around it but if it acts like it suggests, 1 
thread and 1 process as a total sum aren't really worth of a production 
deployment.


On Wednesday, July 29, 2015 at 6:00:47 PM UTC+2, Dave wrote:

 Actually, it looks like i was chasing the wrong issue... It wasn't https 
 after all.

 Everything seems to be working after changing this line in apache 
 default.conf:

 WSGIDaemonProcess web2py user=www-data group=www-data processes=1 threads=1


 to:

 WSGIDaemonProcess web2py user=www-data group=www-data processes=5 threads=15



 Is there any reason not to change this default setting from one-step 
 deployment?  Can I likely set these values higher based on my hardware?

 Thanks again,
 Dave

 On Wednesday, 29 July 2015 02:52:20 UTC-6, Niphlod wrote:

 uhm, you left out some pretty specific details what resources has the 
 server web2py is deployed on ? moreover, what's the size of the file ? and 
 what code are you using to handle the upload? are you using the default 
 'upload' Field or is it in conjunction with a 'blob' one to store the file 
 on the database ?

 On Wednesday, July 29, 2015 at 4:59:29 AM UTC+2, Dave wrote:


 I have this same behavior on multiple web2py servers.  If a large file 
 is being uploaded using a SQLFORM or downloaded using the default download 
 controller, over HTTPS, the entire web server becomes unresponsive until 
 the transfer is completed or cancelled.  However, I have no issues 
 uploading/downloading the same file over HTTP, which can also take several 
 minutes to complete, but the web server is still responsive during those 
 transfers.

 I am using the one-step deployment with Apache and a wildcard 
 certificate (RapidSSL).  Would switching to nginx or cherokee give better 
 performance for https file transfers, or is this likely an issue with the 
 SSL certificate format?  Or if the file transfers over HTTPS are too CPU 
 intensive, am i better off setting up multiple servers and a load balancer?

 Thanks!
 Dave R




-- 
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/d/optout.


[web2py] Re: sqlite3 locking

2015-07-29 Thread Niphlod
to alleviate the issues, recent sqlite builds feature a mode to activate 
that is called WAL , which you can read about at 
https://www.sqlite.org/wal.html .
you can enable it just executing PRAGMA journal_mode=WAL once in the 
database . if you want to do it in web2py, run this code just once

db.executesql(PRAGMA journal_mode=WAL;)


On Monday, July 27, 2015 at 2:35:54 PM UTC+2, jackso...@quantachrome.com 
wrote:

 In the web2py book chap 29: Notice that in SQLite the database consists 
 of a single file. If it does not exist, it is created. This file is locked 
 every time it is accessed.   I assume access meant reading or writing the 
 database

 On Friday, July 24, 2015 at 4:52:26 PM UTC-4, jackso...@quantachrome.com 
 wrote:

 The docs say that web2py locks a sqlite3 database file always...even if 
 just reading. Is there a way to circumvent this so that my database writing 
 process does have to wait for web2py reading the database?



-- 
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/d/optout.


[web2py] Re: Does web2py support reCAPTCHA v2?

2015-07-29 Thread Niphlod
there's recaptcha v2 
https://github.com/web2py/web2py/blob/master/gluon/tools.py#L971

On Saturday, July 25, 2015 at 10:06:54 PM UTC+2, Chris wrote:

 I recently got an email notifying me that Google is upgrading its captcha 
 to the new no CAPTCHA version. Does web2py support that by default? I 
 tried searching in the mailing list but couldn't find the right keywords. 
 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/d/optout.


[web2py] Re: File upload/download over https freezes site

2015-07-29 Thread Niphlod
uhm, you left out some pretty specific details what resources has the 
server web2py is deployed on ? moreover, what's the size of the file ? and 
what code are you using to handle the upload? are you using the default 
'upload' Field or is it in conjunction with a 'blob' one to store the file 
on the database ?

On Wednesday, July 29, 2015 at 4:59:29 AM UTC+2, Dave wrote:


 I have this same behavior on multiple web2py servers.  If a large file is 
 being uploaded using a SQLFORM or downloaded using the default download 
 controller, over HTTPS, the entire web server becomes unresponsive until 
 the transfer is completed or cancelled.  However, I have no issues 
 uploading/downloading the same file over HTTP, which can also take several 
 minutes to complete, but the web server is still responsive during those 
 transfers.

 I am using the one-step deployment with Apache and a wildcard certificate 
 (RapidSSL).  Would switching to nginx or cherokee give better performance 
 for https file transfers, or is this likely an issue with the SSL 
 certificate format?  Or if the file transfers over HTTPS are too CPU 
 intensive, am i better off setting up multiple servers and a load balancer?

 Thanks!
 Dave R




-- 
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/d/optout.


[web2py] Re: sqlite3 locking

2015-07-29 Thread Niphlod
db.py is usually a model, so it gets executed once per request. 
Enabling WAL is a thing needed just one time only (that setting gets 
stored in the sqlite database file). When you reopen the file WAL is 
already been activated.
There is no other activity involved once the database file has been created 
and WAL-enabled. As long as you don't create sqlite databases on the fly, 
I'd not put that piece of code anywhere. 
If you're in the need of something to assure when deploying a new app or a 
new db, you can make a setup controller that, once hit, enables WAL, but 
that's pretty much about it.

On Wednesday, July 29, 2015 at 3:15:25 PM UTC+2, jackso...@quantachrome.com 
wrote:

 thats once per database I assume. Can I put it in db.py to have it 
 executed once?

 On Friday, July 24, 2015 at 4:52:26 PM UTC-4, jackso...@quantachrome.com 
 wrote:

 The docs say that web2py locks a sqlite3 database file always...even if 
 just reading. Is there a way to circumvent this so that my database writing 
 process does have to wait for web2py reading the database?



-- 
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/d/optout.


[web2py] Re: crash - session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL) on 2.9.11

2015-07-24 Thread Niphlod
iis on windows, nginx on linux.

On Thursday, July 23, 2015 at 10:00:27 PM UTC+2, Alex Glaros wrote:

 Niphlod, can you please list some alternatives to Apache?


-- 
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/d/optout.


[web2py] Re: crash - session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL) on 2.9.11

2015-07-20 Thread Niphlod
but slow as hell. ditch apache.

On Monday, July 20, 2015 at 8:14:41 AM UTC+2, ermolaev...@gmail.com wrote:

 in /gluon/globals.py I edit all to pickle.dumps(self) , 
 pickle.HIGHEST_PROTOCOL)
 and then web2py work good

 понедельник, 26 января 2015 г., 12:28:57 UTC+3 пользователь Dmitry 
 Ermolaev написал:

 solve^^
 replace all  pickle.dumps with:
 session_pickled = pickle.dumps(self) , pickle.HIGHEST_PROTOCOL)

 понедельник, 13 октября 2014 г., 20:22:57 UTC+3 пользователь Dmitry 
 Ermolaev написал:

 I use apache 2.2

 If use 2 and more apps - error will be raise for each that not got first 
 HTTP-request

 One app work normal

 Traceback (most recent call last):

   File C:\web2py-m\gluon\main.py, line 435, in wsgibase
 session.connect(request, response)
   File C:\web2py-m\gluon\globals.py, line 931, in connect
 session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
 TypeError: 'NoneType' object is not callable


 If use rocked server - all work



-- 
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/d/optout.


[web2py] Re: logout other user

2015-07-19 Thread Niphlod
cycle the sessions and delete the ones whose users you'd like to block in a 
separate process, or implement your own blockage in a model that gets 
checked at every request.
The possibility to block a session while it's logged in would probably 
never implemented in the core because of the severe performance hits 
associated to check for every request if the user is allowed to log in.

On Sunday, July 19, 2015 at 9:11:14 PM UTC+2, Alex wrote:

 Is it possible to logout other users which are currently logged in? I want 
 to temporarly block certain users. I can set the registration_key to 
 'disabled' so they cannot login anymore. But if a user is already logged in 
 I'd need to delete the session file for this user so he gets automatically 
 logged out.

 Alex



-- 
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/d/optout.


[web2py] Re: AppConfig and Storage

2015-07-14 Thread Niphlod
that's how ini parsers work: they parse the value as strings. you can force 
a conversion of the type using a cast function passed to the take() 
function. Get the inspiration from the scaffolding app, it's all there.

On Tuesday, July 14, 2015 at 6:41:29 PM UTC+2, ermolaev...@gmail.com wrote:

 if I init some var in appconfig.ini:
 my_var1 = False

 and then use it in code:
  if my_var1: - will use as True

 so I need use in appconfig.ini that code:
 my_var1 =

 понедельник, 13 июля 2015 г., 19:35:59 UTC+3 пользователь Niphlod написал:

 sorry, what ?!?!?!

 On Sunday, July 12, 2015 at 11:21:04 PM UTC+2, ermolaev...@gmail.com 
 wrote:

 in 0.py by using Storage:

 develop = False
 develop = 0
 develop = ''

 all is work

 in appconfig.ini
 develop = False
 develop = 0
 develop = ''
 setted as True !!!

 We need use now it:
 develop = 

 ((



-- 
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/d/optout.


[web2py] Re: Web2py can't connect to mssql via pypyodbc - but possible to connect from idle

2015-07-13 Thread Niphlod
web2py doesn't use freetds by default as a driver, but SQL Server... so if 
you can connect with freetds with pypyodbc it's not said that the same 
works within web2py (unless you use the same driver args).
That being said, the error no driver available smells. How did you 
install web2py ?



On Monday, July 13, 2015 at 8:02:07 AM UTC+2, achristoffersen wrote:

 (x-post from stackoverflow: 
 http://stackoverflow.com/questions/31371462/web2py-cant-connect-to-mssql-via-pypyodbc-but-possible-to-connect-from-idle
 )

 I can connect via 'naked' pypyodbc, but not via the web2py DAL.

 I installed pypyodbc as per these instructions: 
 https://code.google.com/p/pypyodbc/wiki/Linux_ODBC_in_3_steps

 In my web2py model I have:

 import pypyodbc # ps. Anthony informs me there is no need for this.
 px = DAL('mssql4://username:password@url,portnumber/databasename')

 In my controller I then have:

 def index():
 return dict(message=(px.executesql('SELECT top 1 * FROM table;')))

 Which gives me a ticket with the following traceback:

 Traceback (most recent call last):
   File /home/andreas/web2py_project/web2py/gluon/restricted.py, line 
 227, in restricted
 exec ccode in environment
   File 
 /home/andreas/web2py_project/web2py/applications/welcome/models/db.py, 
 line 95, in module
 px = DAL('mssql4://UID:password@URL,port/database')
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/base.py, 
 line 174, in __call__
 obj = super(MetaDAL, cls).__call__(*args, **kwargs)
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/base.py, 
 line 459, in __init__
 raise RuntimeError(Failure to connect, tried %d times:\n%s % 
 (attempts, tb))
 RuntimeError: Failure to connect, tried 5 times:
 Traceback (most recent call last):
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/base.py, 
 line 437, in __init__
 self._adapter = ADAPTERS[self._dbname](**kwargs)
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/adapters/base.py,
  
 line 57, in __call__
 obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/adapters/mssql.py,
  
 line 106, in __init__
 if do_connect: self.find_driver(adapter_args,uri)
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/adapters/base.py,
  
 line 188, in find_driver
 raise RuntimeError(no driver available %s % str(self.drivers))
 RuntimeError: no driver available ('pyodbc',)

 Which I find I weird, since I try to use pypyodbc, and not pyodbc. (I 
 tried to import pypyodbc as pyodbc btw, same result).

 If I open a python prompt I can do this:

 import pypyodbc
 cnxn = pypyodbc.connect('Driver=FreeTDS; Server=url; port= portnumber; 
 uid=username; pwd=password;database=database')
 cursor = cnxn.cursor()
 cursor.execute(select top 1 * from a_table where a_date  getdate() order 
 by newid())
 rows = cursor.fetchall()
 for row in rows:
  print row

 Which then outputs the desired single random row.

 So either web2py DAL is broken (not likely) or I am doing something wrong?

 p.s. Web2py version:

 2.11.2-stable+timestamp.2015.05.30.16.33.24
 (Running on Rocket 1.2.6, Python 2.7.6)



-- 
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/d/optout.


[web2py] Re: AppConfig and Storage

2015-07-13 Thread Niphlod
sorry, what ?!?!?!

On Sunday, July 12, 2015 at 11:21:04 PM UTC+2, ermolaev...@gmail.com wrote:

 in 0.py by using Storage:

 develop = False
 develop = 0
 develop = ''

 all is work

 in appconfig.ini
 develop = False
 develop = 0
 develop = ''
 setted as True !!!

 We need use now it:
 develop = 

 ((



-- 
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/d/optout.


[web2py] Re: Web2py can't connect to mssql via pypyodbc - but possible to connect from idle

2015-07-13 Thread Niphlod


On Monday, July 13, 2015 at 10:00:08 PM UTC+2, achristoffersen wrote:

 Hi Jose,

 Thanks

 Okay - So if I run python web2py -M 

 I get this:
 Version 2.11.2-stable+timestamp.2015.05.30.16.33.24
 Database drivers available: sqlite3, imaplib, pyodbc, pymysql, pg8000

 I guess pyodbc here is really pypyodbc?


yep, if pyodbc is not found system-wide, pypyodbc kicks in as a drop-in 
replacement
 

-- 
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/d/optout.


[web2py] Re: Web2py can't connect to mssql via pypyodbc - but possible to connect from idle

2015-07-13 Thread Niphlod
freetds with (py)pyodbc MUST have freetds as a proxy to connect from a 
linux host. The trick is understanding what parameters needs to be passed 
to py(pyodbc) to connect.
As mssql is usually used from windows host, the default 
connectionstring-builder uses parameters that are valuable when 
connecting from windows, but it's just a matter to pass either as a DSN or 
to pass a proper argument to driver_args to enable linux hosts to be able 
to connect. Given that usually those are in tandem with unixodbc + freetds 
setup on the server, a little tinkering is required.
I **think** that if you pass mssql4://dsn it works .
A working DSN **may be**

*DRIVER=FreeTDS;SERVER=hostname;PORT=1433;DATABASE=dbname;UID=user;PWD=password;TDS_Version=8.0;*

just to start.
BTW, passing 

*DAL(mssql4://user:password@hostname/dbname, driver_args = {'DRIVER' : 
'FreeTDS', 'TDS_Version' : '8.0'})*

should result in the same exact underlying connection.

On Monday, July 13, 2015 at 10:15:08 PM UTC+2, achristoffersen wrote:

 Thanks again Niphlod

 I don't think using SQL server is an option in linux-land?  All the 
 examples I have seen uses FreeTDS.

 On Monday, July 13, 2015 at 6:34:30 PM UTC+2, Niphlod wrote:

 web2py doesn't use freetds by default as a driver, but SQL Server... so 
 if you can connect with freetds with pypyodbc it's not said that the same 
 works within web2py (unless you use the same driver args).
 That being said, the error no driver available smells. How did you 
 install web2py ?



 On Monday, July 13, 2015 at 8:02:07 AM UTC+2, achristoffersen wrote:

 (x-post from stackoverflow: 
 http://stackoverflow.com/questions/31371462/web2py-cant-connect-to-mssql-via-pypyodbc-but-possible-to-connect-from-idle
 )

 I can connect via 'naked' pypyodbc, but not via the web2py DAL.

 I installed pypyodbc as per these instructions: 
 https://code.google.com/p/pypyodbc/wiki/Linux_ODBC_in_3_steps

 In my web2py model I have:

 import pypyodbc # ps. Anthony informs me there is no need for this.
 px = DAL('mssql4://username:password@url,portnumber/databasename')

 In my controller I then have:

 def index():
 return dict(message=(px.executesql('SELECT top 1 * FROM table;')))

 Which gives me a ticket with the following traceback:

 Traceback (most recent call last):
   File /home/andreas/web2py_project/web2py/gluon/restricted.py, line 
 227, in restricted
 exec ccode in environment
   File 
 /home/andreas/web2py_project/web2py/applications/welcome/models/db.py, 
 line 95, in module
 px = DAL('mssql4://UID:password@URL,port/database')
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/base.py, 
 line 174, in __call__
 obj = super(MetaDAL, cls).__call__(*args, **kwargs)
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/base.py, 
 line 459, in __init__
 raise RuntimeError(Failure to connect, tried %d times:\n%s % 
 (attempts, tb))
 RuntimeError: Failure to connect, tried 5 times:
 Traceback (most recent call last):
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/base.py, 
 line 437, in __init__
 self._adapter = ADAPTERS[self._dbname](**kwargs)
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/adapters/base.py,
  
 line 57, in __call__
 obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/adapters/mssql.py,
  
 line 106, in __init__
 if do_connect: self.find_driver(adapter_args,uri)
   File 
 /home/andreas/web2py_project/web2py/gluon/packages/dal/pydal/adapters/base.py,
  
 line 188, in find_driver
 raise RuntimeError(no driver available %s % str(self.drivers))
 RuntimeError: no driver available ('pyodbc',)

 Which I find I weird, since I try to use pypyodbc, and not pyodbc. (I 
 tried to import pypyodbc as pyodbc btw, same result).

 If I open a python prompt I can do this:

 import pypyodbc
 cnxn = pypyodbc.connect('Driver=FreeTDS; Server=url; port= portnumber; 
 uid=username; pwd=password;database=database')
 cursor = cnxn.cursor()
 cursor.execute(select top 1 * from a_table where a_date  getdate() 
 order by newid())
 rows = cursor.fetchall()
 for row in rows:
  print row

 Which then outputs the desired single random row.

 So either web2py DAL is broken (not likely) or I am doing something 
 wrong?

 p.s. Web2py version:

 2.11.2-stable+timestamp.2015.05.30.16.33.24
 (Running on Rocket 1.2.6, Python 2.7.6)



-- 
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/d/optout.


[web2py] Re: New feature in trunk: API tokens

2015-07-09 Thread Niphlod
do you know what a jwt token is instead of just blindly bashing a solution?
this adds a table potentially growing towards infinite (to maintain), two 
queries, creates the session, for each and every request: all of which is 
unnecessary. 
It's web2py's proprietary, needs to be managed within a grid (so within the 
app), it's user-managed, hasn't integration with ANY other language, isn't 
extentable, doesn't have a refresh API, etc.

with jwt there's a clean API on how to let them expire, another to refresh 
them, how to store an additional payload, is extendable, has integration 
with multiple languages, it's documented, tested, engineered and pushed by 
people far more experienced in auth APIs. Reinventing the wheel is cool, 
until it's not.
You send a request for a token with username and password, you get a string 
back. Those are signed tokens, so unless you discover the secret, are 
unusable. 
They're as secure as signed urls.


On Thursday, July 9, 2015 at 12:25:54 AM UTC+2, Derek wrote:

 The only difference between this and jwt (saying jwt tokens is like saying 
 atm machine, it's redundant) is that jwt can be generated client side 
 (provided the client knows the secret) and thus would be less secure than 
 this.


 On Wednesday, July 8, 2015 at 1:16:31 PM UTC-7, Niphlod wrote:

 summarizing, IMHO web2py should probably implement JWT tokens 
 http://jwt.io/ instead of this custom one to have it called properly 
 API tokens



-- 
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/d/optout.


[web2py] Re: DAL Validator for list size

2015-07-08 Thread Niphlod
from the book

IS_IN_SET and Tagging

The IS_IN_SET validator has an optional attribute multiple=False. If set to 
True, multiple values can be stored in one field. The field should be of 
type list:integer or list:string. multiple references are handled 
automatically in create and update forms, but they are transparent to the 
DAL. We strongly suggest using the jQuery multiselect plugin to render 
multiple fields.

Note that when multiple=True, IS_IN_SET will accept zero or more values, 
i.e. it will accept the field when nothing has been selected. multiplecan 
also be a tuple of the form (a,b) where a and b are the minimum and 
(exclusive) maximum number of items that can be selected respectively.


On Wednesday, July 8, 2015 at 4:36:29 PM UTC+2, Francisco Costa wrote:

 Hi,

 Is there any validator for a List size?

 db.define_table(
 'categories',
 Field('id', required=True, unique=True),
 Field('name', 'string', length=128, required=True),
 )

 db.define_table(
 'sub_categories',
 Field('id', required=True, unique=True),
 Field('name', 'string', length=128, required=True),
 Field('main_categories', 'list:reference categories', required=True),
 )

 Is it possible to limit the minsize and/or maxsize of main_categories?




-- 
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/d/optout.


[web2py] Re: New feature in trunk: API tokens

2015-07-08 Thread Niphlod
summarizing, IMHO web2py should probably implement JWT tokens 
http://jwt.io/ instead of this custom one to have it called properly API 
tokens

-- 
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/d/optout.


Re: [web2py] Re: Web2py application running very slow on rocket server in production mode

2015-07-08 Thread Niphlod
the book has a recipe for running web2py under iis

http://web2py.com/books/default/chapter/29/13/deployment-recipes#IIS

there are a few steps involved but are far more easier than setting up 
apache + mod_wsgi, and it's far more performant by default.
That setup is production-ready.

there's also a powershell setup script ready in the scripts folder, 
namely 
https://github.com/web2py/web2py/blob/master/scripts/setup-web2py-ws2012r2.ps1: 
it's production-ready to, but it intended to allow deploying on a clean host

-- 
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/d/optout.


[web2py] Re: DAL Validator for list size

2015-07-08 Thread Niphlod
seems that IS_IN_DB accepts a multiple parameter in the same exact form

https://github.com/web2py/web2py/blob/master/gluon/validators.py#L606

On Wednesday, July 8, 2015 at 7:42:55 PM UTC+2, Francisco Costa wrote:

 But what about the type list:reference?




-- 
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/d/optout.


[web2py] Re: Apache on Windows + many applications

2015-07-06 Thread Niphlod
BTW: why don't you just serve web2py behind iis ? No weird exceptions, 
easier to debug, better performances, lesser resources, etc etc. Come on, 
it's not 2001 anymore!

On Friday, July 3, 2015 at 1:44:10 PM UTC+2, Dmitry Ermolaev wrote:

 https://7pay.in/ - worked
 http://7pay.in/ - error

 in rockets server all OK

 in Apache - errors ((

 pickle with Apache rise error


-- 
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/d/optout.


[web2py] Re: Starter App (Scaffolding) selction on create app.

2015-07-02 Thread Niphlod
before having the option of having the option to choose for it'd be - at 
least required - to have something to choose from :-P

On Thursday, July 2, 2015 at 6:04:40 PM UTC+2, Encompass solutions wrote:

 There has been some discussion about different types of frameworks.
 I too have options I want to have and perhaps even the ability to take a 
 web2py.app and have it as an available template.
 Is there any plan on having an option when we create an app with web2py?
 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/d/optout.


[web2py] Re: run time error - auth_user.table appears corrupted

2015-07-02 Thread Niphlod
stop web2py, drop the databases/*_auth_user.table file, set 
fake_migrate_all=True on the DAL connection, start web2py, hit the appadmin 
page (which should trigger recreation of all *.table files), remove 
fake_migrate_all statement from the DAL connection.

On Wednesday, July 1, 2015 at 4:01:20 PM UTC+2, reddyreddy wrote:

 Can anyone help me?

 Iam getting runtime error auth_user.table appears corrupted.
 Iam not sure why it is appearing. Here are my not tables.


 db = DAL(sqlite://storage.sqlite)
 from gluon.tools import Auth
 auth = Auth(db)
 auth.define_tables(username=True)
 db.define_table('problem',
 Field('title', unique=True),
 Field('body', 'text'),
 Field('file','upload'),
 Field('ori_file',readable=False, writable=False),
 Field('outputfile','upload'),
 Field('created_on', 'date', default=request.now, readable=False, 
 writable=False),
 Field('Due date','date'),
 Field('status', readable=False, writable=False))


 db.define_table('submission', 
 Field('name', requires=[IS_NOT_EMPTY(), IS_ALPHANUMERIC()]), 
 Field('email', requires=[IS_NOT_EMPTY(), IS_EMAIL()]),
 Field('file','upload', requires=IS_NOT_EMPTY()),
 Field('status', readable=False,writable=False),
 Field('posted_on', 'date', default=request.now, readable=False, 
 writable=False),
 Field('problem_id','reference problem',readable=False, writable=False))



-- 
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/d/optout.


[web2py] Re: as_dict() on a row fails when connected to MySQL on Amazon RDS

2015-07-02 Thread Niphlod
I'm pretty sure that 

newly_inserted_id = db.table.insert(...)

should return an integer, not a row.

On Wednesday, July 1, 2015 at 4:01:19 PM UTC+2, Sean Ballow wrote:

 We are connecting successfully to MySQL on RDS

 And when attempting to insert a new record it appears to properly insert 
 into the database and we receive an ID back, for instance

 result = db.foo.insert(myfield='blah')

 print result
  1

 The problem occurs when performing the following after successfully 
 inserting a record and committing it

 result.as_dict()
  TypeError: 'NoneType' object is not callable

 result is a ROW instance and the following continues to work

 print result.id
  1

 however as_dict() fails only when connected to MySQL on RDS and not when 
 using the MySQL local instance

 Oddly enough when I use the same application connected to a locally 
 running instance of MySQL we do not receive the exception and everything 
 works as desired.

 Any ideas what may be causing the disparity between a connection to a 
 local MySQL instance and a MySQL RDS instance? I have compared system 
 variables between both databases and was unable to identify a problem

 Thanks for your help



-- 
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/d/optout.


[web2py] Re: Only one table fails to create in MySQL... and there's nothing special about it.

2015-06-30 Thread Niphlod
actually, pythonanywhere folks are really collaborative : no need to bash 
for something they aren't responsible for :P

-- 
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/d/optout.


[web2py] Re: bounty for window users

2015-06-29 Thread Niphlod
/me restricts himself to review the code before the actual merge. if noone 
rescues the bounty in a week I'll do it.

On Monday, June 29, 2015 at 5:43:30 PM UTC+2, Massimo Di Pierro wrote:

 I offer $50 is you can do this in a couple of days:

 In the web2py admin interface there is a pack custom page which 
 redirects to
 http://127.0.0.1:8000/admin/default/pack_custom/yourapp
 and has a button download w2p.

 I would like one addition button there that says download as exe which 
 will do the following:
 - download the latest web2py_win.zip
 - unzip it (using the python API)
 - copy the web2pp app in question (selected files/folders) under the 
 unzipped web2py/applications/
 - create a file routes.py under the unzipped web2py/ folder which contains
 routers = dict( BASE=dict(default_application='') )  
   where ... is the name of the app in question
 - zips the unzip folder again with name web2py.app.name.exe and 
 downloads it

 The zip/unzip should be done in RAM using the python zip module. 
 This is for those uses who develop on windows for window and expect the 
 end users to run web2py locally with a single app. And yes, they exist. It 
 would make their life easier and avoid zipping/unzipping mistakes and 
 information leakage.

 This should not take more than 10-20 lines in the admin app. It is also a 
 good exercise.
 I will only pay the first to deliver (if it works well) so post your 
 solution in the form of a pull request on github.

 Massimo


-- 
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/d/optout.


[web2py] Re: Only one table fails to create in MySQL... and there's nothing special about it.

2015-06-29 Thread Niphlod
usually it's not rocket science.. do you have a 
databases/***_restaurants.table in your databases folder ?
if yes, drop it and go to the appadmin controller to recreate it. 
From the error it seems that web2py is trying to migrate a table that is 
not on the backend but it's supposed to be there (because of a 
corresponding .table file found on the folder)

On Monday, June 29, 2015 at 8:37:41 PM UTC+2, Robert Porter wrote:

 I got everything working fine at home on my Ubuntu 14.04 server.  Then I 
 did a git push to pythonanywhere.com.  Web2py created all my new tables 
 except for one, and it continues to fail to create this table.  Tech 
 support at pythonanywhere can't find the problem.

 Here's my table that is having problems:

 db.define_table('restaurants',
 Field('place_id', 'text', required=True),
 Field('place_name', 'text'),
 Field('rest_lat', 'text'),
 Field('rest_lng', 'text'))

 I can take off the required=True but that doesn't help.  Here's the 
 error chain:

 class '_mysql_exceptions.ProgrammingError' (1146, Table 
 'trytha$test.restaurants' doesn't exist)

 Traceback (most recent call last):
   File /var/www/sites/trytha/gluon/restricted.py, line 227, in restricted
 exec ccode in environment
   File /var/www/sites/trytha/applications/trytha/models/db.py, line 112, 
 in module
 Field('rest_lng', 'text'))
   File /var/www/sites/trytha/gluon/packages/dal/pydal/base.py, line 817, 
 in define_table
 table = self.lazy_define_table(tablename,*fields,**args)
   File /var/www/sites/trytha/gluon/packages/dal/pydal/base.py, line 856, 
 in lazy_define_table
 polymodel=polymodel)
   File /var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py, 
 line 491, in create_table
 fake_migrate=fake_migrate
   File /var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py, 
 line 604, in migrate_table
 self.execute(sub_query)
   File /var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py, 
 line 1326, in execute
 return self.log_execute(*a, **b)
   File /var/www/sites/trytha/gluon/packages/dal/pydal/adapters/base.py, 
 line 1320, in log_execute
 ret = self.cursor.execute(command, *a[1:], **b)
   File /usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py, line 
 205, in execute
 self.errorhandler(self, exc, value)
   File /usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py, 
 line 36, in defaulterrorhandler
 raise errorclass, errorvalue
 ProgrammingError: (1146, Table 'trytha$test.restaurants' doesn't exist)


 Since this works at home, it's obviously a pythonanywhere problem, but 
 they requested I ask you guys for help troubleshooting it.

 So here's my question:  Anyone know a good web hosting company for Web2py? 
  I really just need vanilla Ubuntu on a server.  Alternatively, if you can 
 figure out the error, that might work too, but given pythonanywhere's weird 
 MySQL requirement of having your username as part of your DB name caused an 
 hour of annoyance when I set everything up the first time, I'm not keen on 
 giving them many more chances.


-- 
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/d/optout.


[web2py] Re: How to make role inheritable?

2015-06-29 Thread Niphlod
either you add redundantly groups or you have to resort to a recursive 
query each time you need to check for membership at higher levels than the 
first one... in either case I really don't see the issue: given that 
auth_membership is a one-to-many, web2py isn't getting in your way.

If you don't want to go for the multiple membership way, you can code 
easily a function that given the lowest membership checks recursively for 
higher levels in your own 
city--state--country--world--galaxy--universe--whatever map.

On Monday, June 29, 2015 at 9:56:20 PM UTC+2, Alex Glaros wrote:

 Example: Role is Citizen (In db.auth_group)

 Object (as in Subject/Predicate/Object) of role is City of New Orleans 
 (Added extra field in db.auth_group superObject for this object role.)

 In db.auth_membership, user_id is Bob with FK to db.auth_group.role. 
 Result: Bob is citizen of New Orleans.

 So far so good, all New Orleans citizens are handled by being added to 
 db.auth_membership

 But Bob is also a citizen of Louisiana. And also a citizen of U.S.

 How to have Louisiana and U.S. automatically inherit attributes so that 
 system knows Bob is also citizen at state and federal level?

 Goal is to have function in controller able to answer question Is Bob a 
 US citizen? without having to redundantly place Bob in additional role 
 groups (db.auth_group: state citizen role, db.auth_group: federal citizen 
 role).

 thanks,

 Alex Glaros


-- 
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/d/optout.


[web2py] Re: New feature in trunk: API tokens

2015-06-28 Thread Niphlod
IMHO token should not be restricted to a var... it should be also possible 
to use an header...

Performance-wise...as it is it's as bad as it could possibly be.
1) the extra table needs a solid unique=True on the token field: we don't 
want to do a full scan of that table for every request protected by the 
decorator...and we protect ourselves from colliding uuids.
2) why do we need 2 separate queries (one for the token, the other for the 
id ) ?

Moreover, the grid embedded in manage_tokens is a quick - but dirty - way 
to manage those... There's no restrictions on the tokens that are generated 
(the whole table is exposed). Plus, it lacks any possibility of 
customization: given the abnormal abundance of arguments we added to grid 
initialization to accomodate zillions of users, I'd say it will pop up soon 
enough the need of passing something to that grid.
We should expose an API to manage tokens, not a grid...

On Sunday, June 28, 2015 at 4:56:35 PM UTC+2, Massimo Di Pierro wrote:

 There is a new feature in trunk. Support for native API tokens.

 To enable in models/db.py use:

 auth.define_tables(username=False, signature=False, api_tokens=True)


 Then where appropriate replace 

 @auth.requires_login()

 def test(): return 'hello %s' % auth.user.first_name

 with

 @auth.requires_login_or_token()

 def test(): return 'hello %s' % auth.user.first_name

 Now your users can go to

 http:///welcome/default/user/manage_tokens

 create and expire tokens and call the decorated functions with

 http:///welcome/default/test?_token=one-of-the-tokens


 The token will give access to the function (test in the example) as if the 
 user were logged in.

 This will make it easier for you to create API for your app and delegate 
 to your users the job of creating and expiring their tokens.


 This is an EXPERIMENTAL feature. It works but it may change.


 Please test, and submit comments/suggestions.


 Massimo


-- 
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/d/optout.


[web2py] Re: New feature in trunk: API tokens

2015-06-28 Thread Niphlod
PS: the code doesn't take into consideration an expired token. the mere 
existance of the record allows the authentication.

-- 
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/d/optout.


[web2py] Re: New feature in trunk: API tokens

2015-06-28 Thread Niphlod
Ok, read it carefullyAll of that IMHO isn't really what users wants to 
implement a token-based auth on top of an API.
Apart from the fact that if the scheme of the tokens table gets corrected 
(a FK to the user_id and token unique) the first two queries are 
collapsible into one, calling login_user() triggers update_groups() (not 
sure if an API needs it for every call), plus it renews the session (that 
in an API isn't there for sure), and creates a new Session (and again, the 
cookie-based Session isn't something an API uses or requires)

The way I see it, a token-based authentication is good for a kind of 
cached/speedy authentication. You expect zillion calls to an API and you 
don't want username/passwords flying around, so you publish something 
behind the usual auth that generates a code what identifies you. Or you 
have a zillions mini-programs that needs to call the api and you don't want 
to store username-password combo in each and every program, so you request 
a token. Usually the token is also generated for a scope, so, e.g., the 
authenticated user with the token can't invalidate all other tokens...of 
change the profile email, etc etc. This goes beyond the scope of a simple 
helper in web2py and goes towards being an oauth provider an entire 
different story.
Let's assume though that the token auth gets the same permissions as the 
usual one... who you are (when you generated the token) is only one piece 
of the info: the other piece is what you're allowed to do with that token.
For all intents and purposes, a token-based auth for an API IMHO 
resembles very closely what in non-API environments is persisted in web2py 
with the Session (under the hook a cookie with the sesson id). Specifically 
the session.auth part.

non-api: You login, the heavy auth thingies take place there and only 
there (are you a valid user, is your password correct, which groups are you 
in, did you complete the registration process, and so on), and from there 
on you are issued a lightweight Session that relieves web2py from 
constantly checking at every request who you are and what you can do 
(through membership)

api: you request a token for your login, the heavy auth thingies take 
place there and only there, and you're issued a lightweight token (with 
an optional expiration) that relieves web2py from costantly checking who 
you are and what can you do. 

This naming (api_tokens) collides with the implementation: it's slower than 
the default (thinking about basic auth) because it requires at least 3 
queries for any call (1) is there a token, 2) is there a user with that id 
(duh?), are there groups for that user). On top of that, it creates a new 
session for every call. As it is, it'd better implemented as a new login 
method (and BTW, it surely is just a login method), living in contrib.



-- 
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/d/optout.


[web2py] Re: bootstrap layout adaption

2015-06-26 Thread Niphlod
folder-what ? just download the styles and refer to the correct url in your 
layout...

On Friday, June 26, 2015 at 8:23:06 AM UTC+2, Manuele wrote:

 Can anyone tell me if it could be easy to adapt this[1] bootstrap layout 
 in order to be used for a web2py application? 
 The best would be to create a plugin I guess... but the folder structure 
 seams not to fit to web2py standards... 
 Any suggest will be appreciated :) 

 Thank you very mutch 

 Best regards 

 Manuele 

 [1] https://github.com/IronSummitMedia/startbootstrap-sb-admin-2 


-- 
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/d/optout.


[web2py] Re: Layout problem

2015-06-25 Thread Niphlod
you're quite obviously missing css and js files serving.

On Thursday, June 25, 2015 at 10:17:13 AM UTC+2, Chaitu P wrote:


 Does anyone have idea why web2py default layout not working.


-- 
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/d/optout.


[web2py] Re: how to use onupdate with grid

2015-06-24 Thread Niphlod
or just onupdate=updateAuthorizationStatus

On Tuesday, June 23, 2015 at 9:41:39 PM UTC+2, Alex Glaros wrote:

 is this right?

   grid = SQLFORM.grid(db.AuthorizedInstance.id==request.get_vars.
 specificAuthorizationID, editable=True, deletable=False, create=False, 
 searchable=False, details=False, csv=False, maxtextlength=5000, onupdate=
 lambda form:updateAuthorizationStatus(form))




-- 
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/d/optout.


[web2py] Re: IS_TIME format

2015-06-24 Thread Niphlod
if you need a cutsom widget with a custom format, and you already rewrote 
the widget, why don't you rewrite also the validator ?!

On Wednesday, June 24, 2015 at 10:00:46 AM UTC+2, Annet wrote:

 I wrote a widget to format time:

 def timeplain(field, value):
 if value == None:
 value = ''
 elif 'strftime' in dir(value):
 value = value.strftime('%H:%M')
 id = '%s_%s' % (field._tablename, field.name)
 return INPUT(_type='text', _id=id, _class='form-control time_plain', 
 _name=field.name, value=str(value), requires=field.requires)

 and on the fileds of type time I have the following attributes:

 istime = dict(type='time', requires=IS_TIME(error_message='Formaat komt 
 niet overeen met HH:MM'), widget=timeplain)


 This works fine unless the form contains an error on the field of type 
 time, for example I have the following validation function:

 def __onvalidation_openinghours(form):
 if form.vars.startTime  form.vars.endTime:
 form.errors.endTime = 'De eind tijd is vroeger dan de start tijd'

 In this case the endTime is displayed in the format HH:MM:SS
 The issue can be fixed by adding:

 form.vars.endTime = form.vars.endTime.strftime('%H:%M')

 after form.errors.endTime, however, I wonder whether there is a way to 
 adjust the timeplain function to solve the issue.


 Kind regards,

 Annet





-- 
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/d/optout.


[web2py] Re: empy string from csv for integer for integer field

2015-06-24 Thread Niphlod
an integer can't be ''. set them to null of to 0 at import time :D

On Wednesday, June 24, 2015 at 7:28:21 PM UTC+2, goome wrote:

 Hello
 i have a table with integer field.
 i populated thhe db from a csv (created from other then me).
 it sometimes has empty value for the integers fields.
 So when i try to get a list of the records of the table, i got:
 type 'exceptions.ValueError' invalid literal for long() with base 10: ''

 from db.py  #table prodotti
 Field(lunghezza,integer),
 Field(larghezza,integer),

 from default.py
 prodotti = legacy_db().select(legacy_db.prodotti.ALL,orderby='prodotti.id 
 DESC', limitby=limitby)

 The error ticket:
 File 
 /home/marcello/scripts/web2py/2/web2py/applications/PROVE/controllers/default.py,
  
 line 171, in lista_prodotti
 prodotti = legacy_db().select(legacy_db.prodotti.ALL,orderby='
 prodotti.id DESC', limitby=limitby)
   File 
 /home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/objects.py, 
 line 2026, in select
 return adapter.select(self.query,fields,attributes)
   File 
 /home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/sqlite.py,
  
 line 125, in select
 return super(SQLiteAdapter, self).select(query, fields, attributes)
   File 
 /home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/base.py,
  
 line 1239, in select
 return self._select_aux(sql,fields,attributes)
   File 
 /home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/base.py,
  
 line 1220, in _select_aux
 return processor(rows,fields,self._colnames,cacheable=cacheable)
   File 
 /home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/base.py,
  
 line 1596, in parse
 value = self.parse_value(value,ft,blob_decode)
   File 
 /home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/base.py,
  
 line 1450, in parse_value
 return self.parsemap[key](value,field_type)
   File 
 /home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/base.py,
  
 line 1534, in parse_integer
 return long(value)
 ValueError: invalid literal for long() with base 10: ''

 how to face with empty values?



-- 
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/d/optout.


[web2py] Re: Expressions error in DAL query

2015-06-23 Thread Niphlod
although not in the book, epoch() is a method of a datetime field.
http://pydal.readthedocs.org/en/latest/_modules/pydal/objects.html#Expression.epoch

That being said, if I got the requirements properly, which is to craft a 
select on a datetime field for anything comprised from 5 minutes ago and 
now, I don't get the intricacies...

(db.table.field  request.now)  (db.table.field  request.now + 
datetime.timedelta(minutes=5))

doing something like the requirement strictly on a time field (i.e. missing 
the date part) doesn't make any sense on the behalf of date arithmetics: 
the only exception would be any run in the 23:55 to 00:00 frame, which you 
can account with the simplest of the if statement. Don't overcomplicate a 
simple requirement.

-- 
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/d/optout.


[web2py] Re: how to use onupdate with grid

2015-06-23 Thread Niphlod
No, it's not a redirect, even if it could be crafted as one.
and yep, you are using it wrong. 
everything on* is a callback, not a string... so it needs to be a 
function. It takes form as the input.
Strictly speaking, onupdate translates to the same thing of the onsuccess 
callback passed to the form.process() that is in charge of updating the 
record.

-- 
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/d/optout.


Re: [web2py] Upgrading to the latest version

2015-06-23 Thread Niphlod
too many scaring advices here...

first and foremost, if you have two web2py roots in any given (and 
separate) folders, they'll work without hiccup.

second: if you copy your entire application (the folder 
applications/appname) from old web2py to new web2py you can test the 
functionality on the new while keeping a safe-copy in the old. Additional 
care should be taken on the sessions/ folder and the cache/ one (i.e. 
they should be cleaned to ensure proper functionality moving the app 
between web2py versions)

third: when web2py is updated, it's best to copy over also the appadmin.py 
controller and static/js/web2py.js: this is ALWAYS safe, although is not 
always required. 
web2py.js is where the main hooks for ajax functionality resides and those 
are linked to python code in web2py, so when python code changes, 
web2py.js gets the new features accordingly. Everything else is 
application-dependant, so as long as you coded things following the 
documentation, they SHOULD NOT brake. I mean, if they break (they can, but 
we work hard in order not to), then you found a bug that will be fixed.

-- 
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/d/optout.


[web2py] Re: does every controller function require a view?

2015-06-23 Thread Niphlod
if you plan to use functions in controllers that MAY NOT be seen by users, 
just define them with a parameter (a dummy one works fine)

def this_function_is_accessible():
pass

def this_is_not_accessible(dummy=None):
pass

On Tuesday, June 23, 2015 at 7:27:42 PM UTC+2, Alex Glaros wrote:

 some functions are not viewed by user; they just return data to another 
 function.  Do those need a view? 

 I ask because if it crashes, then user may see the raw view

 thanks

 Alex Glaros


-- 
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/d/optout.


[web2py] Re: FYI - MSSQL, Executesql and data columns retrieved as strings

2015-06-18 Thread Niphlod
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#MSSQL--Microsoft-SQL-Server-

if you like api docs instead

http://pydal.readthedocs.org/en/latest/pydal.adapters.html#module-pydal.adapters.mssql

On Thursday, June 18, 2015 at 2:56:24 PM UTC+2, Brian M wrote:

 OK so what is the recommended adapter for news versions? I saw that there 
 are like 4 different mssql adapters in the dal source but it wasn't really 
 clear which one to use when.


 On Wednesday, June 17, 2015 at 1:42:02 AM UTC-5, Niphlod wrote:

 10.0 for 2008, 11.0 for 2012, (or 12.0, if sql server 2016 will show up).
 BTW: for anything else than MSSQL2000, mssql:// is NOT the recommended 
 adapter.



-- 
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/d/optout.


[web2py] Re: Problem importing modules from other app (having symlinked models and modules)

2015-06-18 Thread Niphlod
then I really don't know why are you complaining about uwsgi restarted 
several times. if you have a single process handling all the things, said 
process should be reloaded every time you update any of your apps.

On Thursday, June 18, 2015 at 3:47:32 PM UTC+2, Lisandro wrote:

 I see your point. I'm reconsidering the whole thing. Your answer made me 
 think that maybe my setup isn't quite right.

 First of all, I've found a solution for my problem of the error when 
 updating code: I will just copy the modules from one app to another, 
 instead of symlinking. I think now it's the best practical solution, and it 
 can be done quickly and easy. This solves the problem and allows me to 
 update my web2py apps without reloading uwsgi (of course there will be 
 cases where reloading will have to be done).


 Now, regarding the setup. You say multiple apps -- multiple uwsgi 
 processes, but I think my configuration is different (and maybe wrong). 

 What I have is the result of having followed this steps of the book:
 http://web2py.com/books/default/chapter/29/13/deployment-recipes#Nginx

 So I have:
  - one only web2py instance
  - one only uwsgi configuration file, as in the book: /etc/uwsgi/web2py.xml

 Then, I installed several web2py apps under /var/www/web2py/applications, 
 and I've configured routes.py to serve each web2py app through a specific 
 domain. Inside nginx's configuration, I've defined one virtual host (server 
 block) per domain, and all of them make an uwsgi_pass to the same socket, 
 thus, all web2py apps are using the same socket.

 I also have uwsgi emperor mode. I know, what's the point of having emperor 
 mode if I have only one uwsgi configuration file? It's because I'm planning 
 to run two more web2py instances, but not right now. Right now, emperor 
 mode is only watching the file /etc/uwsgi/web2py.xml. That file is pretty 
 much like the one showed by the book. So, when I say reload or restart 
 uwsgi I mean touching that file, in order to emperor reloading the 
 configuration.

 Is this setup correct (or at least acceptable) for deploying multiple 
 web2py apps?


 El miércoles, 17 de junio de 2015, 18:23:59 (UTC-3), Niphlod escribió:

 there's a distinct lack of singular/plurals in your statements that may 
 pinpoint the problem.

 multiple apps -- multiple uwsgi processes

 either you hg update all the apps, and restart ALL uwsgi processes 
 (more a reload than a restart, hopefully, touching EACH and EVERYONE of the 
 files uwsgi watches for changes, without them being simlinked) OR for every 
 app, you hg update and then restart THE uwsgi process, touching the single 
 file that reloads THAT app.

 IMHO you'd need to do the latter, without EVER simlinking anything. There 
 are tons of deploy facilities lying around that will make symlinking an 
 old-fashioned thingy.



-- 
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/d/optout.


[web2py] Re: are auth tables different than any other non-auth table?

2015-06-17 Thread Niphlod
auth_group is for groups. auth_permissions is for permissions. as any other 
table in your db, the problem is not the # of records, rather than what 
query you need to do on those.

On Wednesday, June 17, 2015 at 10:42:57 PM UTC+2, Alex Glaros wrote:

 db.auth_group is doing double duty in my app as a role table for 
 everything in addition to permissions. Examples: (a) Partnership roles with 
 the organization. (b) Employee roles such as SME for a project. There may 
 be millions of people reading/writing concurrently.

 Is there anything different about auth tables from any other table that 
 would slow things down? (will be on Postgres/Pythonanywere.com)

 Can it handle as many records as regular table?

 thanks,

 Alex Glaros


-- 
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/d/optout.


[web2py] Re: are auth tables different than any other non-auth table?

2015-06-17 Thread Niphlod
BTW: a million users doesn't really qualify for a single postgres database, 
no matter what.

On Wednesday, June 17, 2015 at 11:17:39 PM UTC+2, Niphlod wrote:

 auth_group is for groups. auth_permissions is for permissions. as any 
 other table in your db, the problem is not the # of records, rather than 
 what query you need to do on those.

 On Wednesday, June 17, 2015 at 10:42:57 PM UTC+2, Alex Glaros wrote:

 db.auth_group is doing double duty in my app as a role table for 
 everything in addition to permissions. Examples: (a) Partnership roles with 
 the organization. (b) Employee roles such as SME for a project. There may 
 be millions of people reading/writing concurrently.

 Is there anything different about auth tables from any other table that 
 would slow things down? (will be on Postgres/Pythonanywere.com)

 Can it handle as many records as regular table?

 thanks,

 Alex Glaros



-- 
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/d/optout.


[web2py] Re: Problem importing modules from other app (having symlinked models and modules)

2015-06-17 Thread Niphlod
there's a distinct lack of singular/plurals in your statements that may 
pinpoint the problem.

multiple apps -- multiple uwsgi processes

either you hg update all the apps, and restart ALL uwsgi processes (more 
a reload than a restart, hopefully, touching EACH and EVERYONE of the files 
uwsgi watches for changes, without them being simlinked) OR for every app, 
you hg update and then restart THE uwsgi process, touching the single file 
that reloads THAT app.

IMHO you'd need to do the latter, without EVER simlinking anything. There 
are tons of deploy facilities lying around that will make symlinking an 
old-fashioned thingy.

-- 
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/d/optout.


[web2py] Re: Problem importing modules from other app (having symlinked models and modules)

2015-06-17 Thread Niphlod
beside from the fact that is hardly a web2py problem, what the heck ? you 
udpate the app and you don't want to reload the process that runs 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/d/optout.


[web2py] Re: FYI - MSSQL, Executesql and data columns retrieved as strings

2015-06-17 Thread Niphlod
10.0 for 2008, 11.0 for 2012, (or 12.0, if sql server 2016 will show up).
BTW: for anything else than MSSQL2000, mssql:// is NOT the recommended 
adapter.

-- 
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/d/optout.


[web2py] Re: PostgreSQL - Sort with NULLS FIRST

2015-06-17 Thread Niphlod
nope.

On Wednesday, June 17, 2015 at 8:57:45 AM UTC+2, pysab wrote:

 Hi there :)

 I'm using web2py 2.9.10 with a database PostgreSQL 9.4 for a new project 
 and I have a question about sorting. In PostgreSQL, when I execute a 
 SELECT, I can specify 'ORDER BY x ASC NULLS FIRST', which is not the 
 default output. Is there a way to do that with the DAL other than writing a 
 raw SQL query?

 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/d/optout.


[web2py] Re: .json return in nginx/uwsgi

2015-06-17 Thread Niphlod
there's a handy directive for it.

https://github.com/web2py/web2py/blob/master/applications/welcome/models/db.py#L33

On Wednesday, June 17, 2015 at 8:57:45 AM UTC+2, K.J. Pamio wrote:

  Hello,
 In my app on the local server enough to use the termination .json in function 
 call that web2py automatically returning the results by generic.json. Now, 
 with my app running on nginx/uwsgi get an error 404 and invalid view as a 
 result of the call.

 If i use response.view = 'generic.json' in the controller methods, the system 
 returns the data as expected, however I have many actions to modify. Is it 
 possible to fix this without having to change all methods?

 Anticipate Thanks!
 Kayro

 -- 
 Att.,
 *Kayro Pamio*
 (44) 9988-8971
 
- Inglês - detectado 
- Inglês 
- Português 

   
- Inglês 
- Português 

 

-- 
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/d/optout.


[web2py] Re: response.menu will not display an image

2015-06-17 Thread Niphlod
a image=whatever/a is hardly the way to display an image .

On Wednesday, June 17, 2015 at 8:57:45 AM UTC+2, jackso...@quantachrome.com 
wrote:

 This does not work. No image is displayed. The layout seems to lose it 
 too, the response menu  now has 2 rows  this causes things to be obscured 
 by it. Should I be trying this at all? If the menu was designed for text 
 only ok but put it in the Docs. This was the only change I did to the 
 menu.py. I should mention I tried every permutation I could think of for 
 the path to the image. 

 response.menu = [
 (LI(A('home', _href='/AutoFlow/home', 
 _image=/AutoFlow/static/images/home.jpg)), False,[], []),
 (T('Readings'), False, URL('default', 'index'), []),
 (T('Analysis'), False, URL('default', 'index'), []),
 (T('Degasser'), False, URL('default', 'index'), []),
 (T('Log'), False, URL('default', 'index'), []),
 ]


-- 
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/d/optout.


[web2py] Re: Problem importing modules from other app (having symlinked models and modules)

2015-06-17 Thread Niphlod
why don't you use the emperor mode with uwsgi pointing each process to a 
file that, when you modify it, reloads automatically the process ?

On Wednesday, June 17, 2015 at 5:13:02 PM UTC+2, Lisandro wrote:

 Yes, I understand it's not a web2py problem, I was just wondering if there 
 was a way of achieving that without restarting uwsgi process.

 I can see the need of restarting the process that runs the app after 
 updating that app. However, most of the times, the update involves changes 
 to static files (css, some javascript, maybe some images), and I'm forced 
 to restart uwsgi process when the app code hasn't actually changed. 
 Moreover: I'm running a lot of web2py applications (between 40 and 50), and 
 I don't like the idea of restarting the uwsgi process that serves all that 
 apps just because I had to update some css files in just one app.

 But I understand this is not web2py related, I was just wondering if it 
 would be possible to do it in another way. 
 I will look into Mercurial to see if there is a way of updating just the 
 files that have actually changed, don't know if this would actually work. 

 Another obvious thing to do is avoiding frecuent small updates and, 
 instead, updating the app once in a while with all the changes needed. 
 However in my case this is not possible, because each app correspond to a 
 customer, and sometimes the customer needs the change to be applied 
 inmediately.


 El miércoles, 17 de junio de 2015, 3:39:07 (UTC-3), Niphlod escribió:

 beside from the fact that is hardly a web2py problem, what the heck ? you 
 udpate the app and you don't want to reload the process that runs 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/d/optout.


[web2py] Re: Cannot create records in grid

2015-06-16 Thread Niphlod
no prob. happens all time :D

On Tuesday, June 16, 2015 at 9:28:52 AM UTC+2, Mirek Zvolský wrote:

 ..that was really stupid from me. I'm sorry.
 Thank you.





 Dne úterý 16. června 2015 8:33:33 UTC+2 Mirek Zvolský napsal(a):

 Web2py 2.11.2
 Chrome  Firefox
 cache cleared

 I don't see Add button in the web2py grid.
 Explicit setting create=True doesn't help.

 In controller is just a grid with a table as source - this table is empty 
 yet.
 In view is just grid rendering {{=grid}}

 Any idea what I'm doing bad?
 Thanks.. Mirek



-- 
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/d/optout.


[web2py] Re: Cannot create records in grid

2015-06-16 Thread Niphlod
are you authenticated ? if you don't pass user_signature=False by default 
grids are read only (and for a good reason)

On Tuesday, June 16, 2015 at 8:33:33 AM UTC+2, Mirek Zvolský wrote:

 Web2py 2.11.2
 Chrome  Firefox
 cache cleared

 I don't see Add button in the web2py grid.
 Explicit setting create=True doesn't help.

 In controller is just a grid with a table as source - this table is empty 
 yet.
 In view is just grid rendering {{=grid}}

 Any idea what I'm doing bad?
 Thanks.. Mirek



-- 
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/d/optout.


[web2py] Re: Expose public ip address with SOAP

2015-06-15 Thread Niphlod
ok, rephrasing  Then, I deploy the app on internet -- how is it 
deployed ?

On Monday, June 15, 2015 at 10:19:11 AM UTC+2, DucVa wrote:

 I don't config. I am using default mode. How must I config it?

 Vào 15:51:28 UTC+7 Thứ Năm, ngày 11 tháng 6 năm 2015, Niphlod đã viết:

 it seems that web2py uses request.env.wsgi_url_scheme, 
 request.env.http_host to build the url. How is your server configured ?



-- 
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/d/optout.


[web2py] Re: Scheduler Question

2015-06-15 Thread Niphlod
uhm. sqlite lockings then ? 

On Monday, June 15, 2015 at 6:13:04 PM UTC+2, Michael Gheith wrote:

 I am querying a remote PostgreSQL database, and then inserting certain 
 values into my local SQLite database, that's all...


-- 
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/d/optout.


[web2py] Re: Desempeño en W7 64 bits

2015-06-15 Thread Niphlod
go all the way for iis and fastcgi. the first slice is outdated and frankly 
counter-productive with wfastcgi lying around.

On Monday, June 15, 2015 at 7:42:28 PM UTC+2, Leonel Câmara wrote:

 Hey, I've never tried it in production, because frankly there's just much 
 better choices of servers in Linux, this isn't just a web2py problem, it's 
 any Python framework running with WSGI. That said you should be able to get 
 pretty good performance by using IIS with ISAPI WSGI extension.

 Like this slice:

 http://www.web2pyslices.com/slice/show/1453/install-web2py-on-windows-with-iis

 Or even using FastCGI as explained in the book:
 http://www.web2py.com/books/default/chapter/29/13/deployment-recipes#IIS


-- 
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/d/optout.


Re: [web2py] Re: avoid separate query within second nested loop

2015-06-14 Thread Niphlod
sorry what ?

On Friday, June 12, 2015 at 11:35:49 PM UTC+2, Alex Glaros wrote:

 are there file size limitations when moving to dict that are not an issue 
 if python loop?


-- 
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/d/optout.


[web2py] Re: blob type crop data

2015-06-14 Thread Niphlod
you're correct. web2py handles blob types and 'upload' Fields in its own 
way. You'd have to resort to either a full migration to another table or to 
access the data using raw sql statements.

On Saturday, June 13, 2015 at 5:20:06 AM UTC+2, Viktor Boiarchuk wrote:

 Hello everybody!
 Nice to meet so excellent community.

 My problem is next. I'm trying to use web2py with *external* sqlite 
 database formed by another program. One of the column of those database 
 consists of binary data of pdf docs. So I defined that field in model 
 *Field('pdf_binary','blob')*. I'm using SQLFORM.grid to modify my table 
 (not blob column). When I submit changes they are accepted but data in 
 'pdf_binary' become corrupted (it seems it has just begging of file data).

 Moreover when I try to extract binary data from blob field I also get just 
 part of data, but when I change field type to 'text' for e.g. ,
 *Field('pdf_binary','text')* I can extract normal data, but in this case 
 I get the query contains a null character error when i try to submit 
 changes in SQLFORM.
 I can't use upload field, because my binaries was made by another program 
 and it also raises errors when updating db.
 It seems that blob type is right choice for my aims, but it doesn't worked 
 I predicted.

 I will be thankful for all advices.
 Regard
 Viktor


-- 
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/d/optout.


[web2py] Re: Scheduler Question

2015-06-14 Thread Niphlod
seems that the function that goes into timeout leaves zombie processes 
behind. What are you doing in that function ?

On Friday, June 12, 2015 at 11:56:09 PM UTC+2, Michael Gheith wrote:

 Hmmm.  Looking in the database, I have 21 TIMEOUTS which corresponds to 
 the 21 workers with all the same process ID of 10978... a red herring?


 $ pstree -p 10978

 python(10978)─┬─python(1719)

   ├─python(2063)

   ├─python(2977)

   ├─python(5383)

   ├─python(8176)

   ├─python(11013)

   ├─python(11069)

   ├─python(11521)

   ├─python(14466)

   ├─python(14490)

   ├─python(15190)

   ├─python(16210)

   ├─python(17019)

   ├─python(20546)

   ├─python(27816)

   ├─python(27882)

   ├─python(28702)

   ├─python(29459)

   ├─python(30343)

   ├─python(32193)

   └─{python}(10993)


 On Friday, June 12, 2015 at 3:49:12 PM UTC-5, Niphlod wrote:

 inspect the log to see why another worker gets started. Each worker 
 started can result AT MOST as two processes, the worker itself and the 
 process that actually executes the task.

 On Friday, June 12, 2015 at 10:36:35 PM UTC+2, Michael Gheith wrote:

 I have an application that uses the scheduler.  It runs really good, 
 however I noticed odd behavior which I don't think is normal.

 When I launch a worker thread (just one) with the following everything 
 works great: 
 python web2py.py -K myapp

 A few days later I will come back to the node that the application is 
 running on, and will run the following to see my web2py processes:
 pgrep -fl web2py

 and I will get something like the following:

 11013 python web2py.py -K myapp

 11069 python web2py.py -K myapp

 11521 python web2py.py -K myapp

 14466 python web2py.py -K myapp

 14490 python web2py.py -K myapp

 15190 python web2py.py -K myapp

 16210 python web2py.py -K myapp

 17019 python web2py.py -K myapp


 Why am I getting more than one of these processes?  I should just have 
 one, right?  Is this a bug, or normal behavior?  Please advise, 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/d/optout.


Re: [web2py] Re: avoid separate query within second nested loop

2015-06-14 Thread Niphlod


On Sunday, June 14, 2015 at 11:56:34 PM UTC+2, Alex Glaros wrote:

 is there a size limitation to a dictionary? (want to know in general for 
 future purposes)


generally, your OS free memory.
 


 is there consequential extra overhead if using the dictionary method? 


of course, its an additonal loop
 

-- 
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/d/optout.


[web2py] Re: using database record or database query in terms of performance

2015-06-12 Thread Niphlod
do option 1) , then option 2), then profile, then choose. Anything else is 
rubbish.

-- 
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/d/optout.


[web2py] Re: nginx, uwsgi, profiler

2015-06-12 Thread Niphlod
from what I remember runsnakerun has the entire call stack. It's not hard 
to identify where is the bottleneck. BTW: a read() such as in socket.read() 
is hardly something that needs fixing.

On Friday, June 12, 2015 at 7:11:44 AM UTC+2, mweissen wrote:

 A second question:

 I have found that a read-command consumes a lot of time. All other 
 statements are not conspicuous.



 ncalls  tottime  percall  cumtime  percall filename:lineno(function)
  12.9392.9392.9392.939 {built-in method read}
  15.0805.0805.0805.080 {built-in method read}
  15.6695.6695.6695.669 {built-in method read}
  12.0832.0832.0832.083 {built-in method read}
  42.7520.6882.7520.688 {built-in method read}
  42.4730.6182.4730.618 {built-in method read}

 But the profiler does not tell me which read statement makes trouble.
 Any hints how to find the malefactor?



 2015-06-12 6:57 GMT+02:00 Martin Weissenboeck mwei...@gmail.com 
 javascript::

 Thank you very much for your fast response.

 2015-06-11 21:15 GMT+02:00 Niphlod nip...@gmail.com javascript::

 runsnakerun is the best tool for the job. 
 for running with profiler and another webserver, you need to tweak 
 wsgihandler.py  pass a directory to profiler_dir


 On Thursday, June 11, 2015 at 8:39:45 PM UTC+2, mweissen wrote:


 ​I have tried the option -F with a simple web2py start:
 python web2py.py -F profilerdir...
 Works fine, no problem.

 But now I want to do the same with nginx and emperor: where is the 
 place to add the -F parameter?

 And, by the way, is there a web2py app to read and display the *.prof 
 files? I have only found cprofilev (
 https://github.com/ymichael/cprofilev).

 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/d/optout.


[web2py] Re: using database record or database query in terms of performance

2015-06-12 Thread Niphlod
profile in your case is simply a matter on how much time it takes.

On Friday, June 12, 2015 at 8:59:53 AM UTC+2, 黄祥 wrote:

 profile is it same like
 https://docs.python.org/2/library/profile.html

 or web2py profile
 i've test something like
 python web2py.py --profiler=C:\profiler

 but the result i got in the profiler folder is *.prof file, when i open 
 it, it seems to semi human readable file. don't know how to do with those 
 files.

 how can i do a benchmark of web2py app?

 thanks and best regards,
 stifan

 On Friday, June 12, 2015 at 1:31:23 PM UTC+7, Niphlod wrote:

 do option 1) , then option 2), then profile, then choose. Anything else 
 is rubbish.



-- 
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/d/optout.


[web2py] Re: Scheduler Question

2015-06-12 Thread Niphlod
inspect the log to see why another worker gets started. Each worker started 
can result AT MOST as two processes, the worker itself and the process that 
actually executes the task.

On Friday, June 12, 2015 at 10:36:35 PM UTC+2, Michael Gheith wrote:

 I have an application that uses the scheduler.  It runs really good, 
 however I noticed odd behavior which I don't think is normal.

 When I launch a worker thread (just one) with the following everything 
 works great: 
 python web2py.py -K myapp

 A few days later I will come back to the node that the application is 
 running on, and will run the following to see my web2py processes:
 pgrep -fl web2py

 and I will get something like the following:

 11013 python web2py.py -K myapp

 11069 python web2py.py -K myapp

 11521 python web2py.py -K myapp

 14466 python web2py.py -K myapp

 14490 python web2py.py -K myapp

 15190 python web2py.py -K myapp

 16210 python web2py.py -K myapp

 17019 python web2py.py -K myapp


 Why am I getting more than one of these processes?  I should just have 
 one, right?  Is this a bug, or normal behavior?  Please advise, 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/d/optout.


Re: [web2py] Re: avoid separate query within second nested loop

2015-06-12 Thread Niphlod
it's just a matter of ordering by the parent and then the child. Once you 
get a resultset similar to

parent.id | parent.style | child.id | child.name
1   yellow 4  foo1
1   yellow 5  bar1
1   yellow 6  baz1
2   yellow 7  foo2
2   yellow 8  bar2
2   yellow 9  baz2

there won't be issues, right ? you'll be looping through childs in the same 
exact order of your nested loop.

On Friday, June 12, 2015 at 9:49:02 PM UTC+2, Alex Glaros wrote:

 did you mean I only need the second query?  I know it already extracts 
 data that query one has, but I didn't know how to iterate using only the 
 second one and not redundantly display the parent values.  


-- 
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/d/optout.


[web2py] Re: web2py permissions

2015-06-12 Thread Niphlod
summarizing, web2py is just an executable. It protects you by default from 
directory traversal attacks.
Everything but static folder is dinamically created by the executable. 
You may want to serve static with your webserver of choice to relieve the 
burden off of web2py shoulders, but ultimately the only thing needed is the 
user running the executable being able to read and write in the web2py 
folder.
If you're running a multi-tenant server with multiple users running 
multiple web2py processes, sorry, you NEED to be a sysadmin.
If you're running just your site, you don't need to know anything else.

Ultimately, the executable needs to read everything in web2py, plus write 
in any of those folders:
- appname/cache -- if you use cache.disk
- appname/databases -- if you need to run migrations, with migrate=False 
isn't needed
- appname/uploads -- if you app doesn't set another folder to upload files 
to for an upload Field not backed by a database
- appname/static -- if you use static files minifications
- appname/sessions -- if you use disk-backed  sessions
- appname/languages -- if you run any page for the first time and has some 
T() strings that aren't there already (and didn't set )

if you want to see it reversed, the only places where web2py at runtime on 
production doesn't need write permissions in any scenario is
- appname/models
- appname/controllers
- appname/views


-- 
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/d/optout.


[web2py] Re: language detecting

2015-06-12 Thread Niphlod
weirdest requirement ever but  not hard

if T.accepted_language in ('ru-RU', ):
raise HTTP(404)

On Friday, June 12, 2015 at 7:31:41 PM UTC+2, lucas wrote:

 hey everyone,

 via google analytics, i am getting an inordinate amount of traffic from 
 russia.  my site would not be of interest to russians.  i have a list of 
 IPs and net masks for dropping that traffic using iptables but for some 
 reason i am still getting some russian traffic.

 how can i also detect the ru language and then tell web2py to drop or 
 cancel the sending of any subsequent page or view?  i guess i want web2py 
 to act as a backup filter to iptables.

 ok, thank in advance, lucas


-- 
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/d/optout.


[web2py] Re: avoid separate query within second nested loop

2015-06-12 Thread Niphlod
is it better to issue two separate queries returning a set with 2 records 
and 10 respectively or to fetch a joined set (and massage it later on) that 
extracts 20 records ? There's no answer to that except that the two 
possibilities are entirely doable. Cardinality of the sets comes into play, 
plus the number of columns on either tables. In one word, there's no silver 
bullet.

The problem is, the sane options are either:

a) distinct sets
q = db.parent_record.style == 'yellow'
parents = db(q).select()
childs = 
db(db.child_record.parent_id.belongs(db(q)._select(db.parent_record.id))).select()

b) joined set

parent_and_childs = db((db.parent_record.style=='yellow')  
(db.parent_record.id == db.child_record.parent_id)).select() 

what you do instead is fetching the parents AND then the joined set... 
your second query extracts all the info already

-- 
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/d/optout.


Re: [web2py] Re: avoid separate query within second nested loop

2015-06-12 Thread Niphlod
so you have a problem with python, not the database!

if you're not loop-proficient, massage it first to a dictionary, then 
loop over it

from collections import defaultdict
resultset = defaultdict(list)
for row in parents_and_childs:
resultset[row.parent_record.id].append(row)

then you can
for k,v in resultset.iteritems():
 print v[0].parent_record.name
 for child in v:
 print child.child_record.name
etc etc etc



On Friday, June 12, 2015 at 11:12:51 PM UTC+2, Alex Glaros wrote:

 I get the ordering but parent appears redundantly.  

 Do I iterate through loop checking for change in parent.id so parent only 
 gets displayed first time?

 if parent.id != previous_parent_id
 display this specific parent.id one time only
previous_parent_id = parent.id ## reset the comparison value that 
 checks for change in parent.id
 else:
 display child.name ## all the children get listed under the parent



-- 
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/d/optout.


[web2py] Re: Show button in SQLFORM only if a value is present?

2015-06-11 Thread Niphlod
use the links argument

links = [
...
dict(header='additional buttons', body=lambda row: BUTTON(.) if 
row.needs_button == 0 else ''
)
]

On Thursday, June 11, 2015 at 12:45:29 AM UTC+2, LoveWeb2py wrote:

 I should have been more specific. I meant I want to create a SQLFORM.grid 
 button and only have it show if a row.id value is present

 On Wednesday, June 10, 2015 at 5:42:33 PM UTC-4, LoveWeb2py wrote:

 I'd like to create a SQLFORM button, but only show the button if a value 
 is present in the cell. Is this possible? I'm thinking of creating a 
 function that will check to see if each record has a value present in the 
 field

 for example:

 define_table('my_sqldata',
 Field('name',
 Field('address',
 migrate=False)

 if my_sqldata.address != '' then show icon in SQLFORM else: show nothing

 Is this possible?



-- 
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/d/optout.


[web2py] Re: Expose public ip address with SOAP

2015-06-11 Thread Niphlod
it seems that web2py uses request.env.wsgi_url_scheme, 
request.env.http_host to build the url. How is your server configured ?

-- 
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/d/optout.


[web2py] Re: Basic usage statistics

2015-06-11 Thread Niphlod
you could use a redis queue to push events into, and then a scheduler tasks 
that consolidates the data in a table once in a while. 

On Thursday, June 11, 2015 at 6:55:18 PM UTC+2, Leonel Câmara wrote:

 Minor implementation details aside, has anyone came up with a better way 
 to do this?


 http://www.web2pyslices.com/slice/show/1618/basic-usage-statistics-log-what-your-users-do

 Particularly, in terms of not hitting the database so much. I'm thinking 
 of making my own system but I may as well ask before reinventing the wheel.


-- 
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/d/optout.


[web2py] Re: nginx, uwsgi, profiler

2015-06-11 Thread Niphlod
runsnakerun is the best tool for the job. 
for running with profiler and another webserver, you need to tweak 
wsgihandler.py  pass a directory to profiler_dir

On Thursday, June 11, 2015 at 8:39:45 PM UTC+2, mweissen wrote:


 ​I have tried the option -F with a simple web2py start:
 python web2py.py -F profilerdir...
 Works fine, no problem.

 But now I want to do the same with nginx and emperor: where is the place 
 to add the -F parameter?

 And, by the way, is there a web2py app to read and display the *.prof 
 files? I have only found cprofilev (https://github.com/ymichael/cprofilev
 ).

 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/d/optout.


[web2py] Re: change soap wsdl targetnamespace

2015-06-11 Thread Niphlod
isn't a simple

def what_you_serve():
  ..foo bar
  response.namespace = 'http://tempuri.org/'
  return dict(a=1)

working ?

On Thursday, June 11, 2015 at 6:36:31 PM UTC+2, Pengfei Yu wrote:

 Hi,

 I want to change the target namespace to http://tempuri.org/; in the 
 SOAP WSDL xml file. 

 From the pysimplesoap's server.py, I see that I can specify it in 
 SoapDispatcher 
 class with namespace parameter. But I wonder how can I specify it in 
 web2py controller's @service.soap decorator.

 From the code of /gluon/tools.py, it seems that the namespace could be 
 given by setting response.namespace

 def serve_soap(self, version=1.1):
 try:
 from gluon.contrib.pysimplesoap.server import SoapDispatcher
 except:
 return pysimplesoap not installed in contrib
 request = current.request
 response = current.response
 procedures = self.soap_procedures


 location = %s://%s%s % (
 request.env.wsgi_url_scheme,
 request.env.http_host,
 URL(r=request, f=call/soap, vars={}))
 *namespace = 'namespace' in response and response.namespace or 
 location*
 documentation = response.description or ''
 dispatcher = SoapDispatcher(
 name=response.title,
 location=location,
 action=location,  # SOAPAction
 namespace=namespace,
 prefix='pys',
 documentation=documentation,
 ns=True)

 I wonder how I can set response.namespace directly from web2py controller. 
 A working example will be very nice.

 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/d/optout.


[web2py] Re: change soap wsdl targetnamespace

2015-06-11 Thread Niphlod
even in the called function should be enough.

On Thursday, June 11, 2015 at 9:39:32 PM UTC+2, Pengfei Yu wrote:

 Yeah, you are right. Stupid question. I am not familiar with how response 
 works.

 def call():
 response.namespace = 'http://tempuri.org/'
 return service()


 This is enough in call() function.

 Thanks!

 On Thursday, June 11, 2015 at 3:18:13 PM UTC-4, Niphlod wrote:

 isn't a simple

 def what_you_serve():
   ..foo bar
   response.namespace = 'http://tempuri.org/'
   return dict(a=1)

 working ?

 On Thursday, June 11, 2015 at 6:36:31 PM UTC+2, Pengfei Yu wrote:

 Hi,

 I want to change the target namespace to http://tempuri.org/; in the 
 SOAP WSDL xml file. 

 From the pysimplesoap's server.py, I see that I can specify it in 
 SoapDispatcher 
 class with namespace parameter. But I wonder how can I specify it in 
 web2py controller's @service.soap decorator.

 From the code of /gluon/tools.py, it seems that the namespace could be 
 given by setting response.namespace

 def serve_soap(self, version=1.1):
 try:
 from gluon.contrib.pysimplesoap.server import SoapDispatcher
 except:
 return pysimplesoap not installed in contrib
 request = current.request
 response = current.response
 procedures = self.soap_procedures


 location = %s://%s%s % (
 request.env.wsgi_url_scheme,
 request.env.http_host,
 URL(r=request, f=call/soap, vars={}))
 *namespace = 'namespace' in response and response.namespace or 
 location*
 documentation = response.description or ''
 dispatcher = SoapDispatcher(
 name=response.title,
 location=location,
 action=location,  # SOAPAction
 namespace=namespace,
 prefix='pys',
 documentation=documentation,
 ns=True)

 I wonder how I can set response.namespace directly from web2py 
 controller. A working example will be very nice.

 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/d/optout.


[web2py] Re: caching model data

2015-06-11 Thread Niphlod
there is not much really 
 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Caching-selects
 
to see how to cache (it's not that different from the usual cache in 
web2py).

instead of db(db.table.id0).select() you use 
db(db.table.id0).select(cache=(cache.ram, 60)) if you can leave with the 
same data for 60 seconds without hitting the database. Moreover, if you use 
db(db.table.id0).select(cache=(cache.ram, 60), cacheable=True) it'll be 
faster but your code can't use row.update_record() and row.delete_record().

 If you want to use redis ... install it on the server,. than 
http://web2py.com/books/default/chapter/29/13/deployment-recipes#Caching-with-Redis
 
. Instead of using cache.ram you use cache.redis. same API interface, 
handled transparently.
Bonus point if you want to auto-fix the thundering herd problem (many 
users requesting a the same time something that isn't in cache): use 
with_lock=True and it'll be fetched one time only, while other wait in line 
the result calculated by the first client requesting the data.


On Thursday, June 11, 2015 at 2:58:47 PM UTC+2, Fabiano Faver wrote:

 Niphlod, I have a small app the DB is getting big quickly and was asked to 
 do a cache layer..I just started started to learn about it and i'm already 
 lost.  Could you point the direction to a newbie how to do it? Is it just 
 some code change in web2py? I saw there is this Redis but didn't read yet 
 how it works together with web2py and if it is this the way to do this 
 cache layer.



 Em quarta-feira, 24 de dezembro de 2014 16:10:15 UTC-2, Niphlod escreveu:

 so, what's the issue you're facing ?

 On Wednesday, December 24, 2014 12:29:24 PM UTC+1, harsha tanguturi wrote:

 I would like to cache the model data i.e., caching the selects and 
 update the cache whenever the data is updated. Putting simply a caching 
 layer has to present before the database layer and any changes to the 
 database should be reflected in cache too.



-- 
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/d/optout.


Re: [web2py] All messed up

2015-06-09 Thread Niphlod
actively refused it means that the socket you're pointing to is not 
open(able) . Review the listening ports and/or the firewall.

-- 
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/d/optout.


[web2py] Re: object 'DAL' has no attribute 'Field' - After update 2.11.2

2015-06-09 Thread Niphlod
if you'r ecoming from an older version, the structure of packages changed a 
bit and so the usual unzip over it doesn't work . Try to start with a 
unzip in a fresh folder and then copy over your applications only. it 
should work fine.

On Tuesday, June 9, 2015 at 10:47:54 AM UTC+2, Tomeu Roig wrote:

 I update web2py to last version from:
 (wget http://www.web2py.com/examples/static/nightly/web2py_src.zip)

 After start all apps included admin give errors.

 I make a cat in console, and get this info in error.
 type 'exceptions.AttributeError' type object 'DAL' has no attribute 
 'Field'


 VERSION:
 Version 2.11.2-stable+timestamp.2015.05.30.16.33.24
 SYSTEM:
 Ubuntu Server 12.04
 DATABASE: 
 PostgreSQL 9.3

 It's a bug? Anyone has the same problem?
 I'm doing something wrong? (It's not the first time that i make updates)

 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/d/optout.


[web2py] Re: Sharing source code of my application developed in web2py

2015-06-08 Thread Niphlod
if you just pack you'll send the source code. alternatively, just zip the 
applications/yourapp directory

On Monday, June 8, 2015 at 8:45:24 PM UTC+2, Meenoo wrote:

 I am new to web2py and am creating an application for my school project 
 using web2py. I need to submit the source code of the application too. Can 
 someone tell me how do I do that ? 
 Compile and Pack Compile allows me to share/deploy the application 
 without the source code. Is there any other way in which I can share my 
 source code too ? 

 Any help is greatly appreciated. 



-- 
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/d/optout.


Re: [web2py] Re: Python framework benchmarks

2015-06-08 Thread Niphlod
there's the usual ton on optimizations to be made. BTW: if sessions aren't 
needed at all, the statement to use is session.forget(response)

On Tuesday, June 9, 2015 at 12:55:52 AM UTC+2, Derek wrote:

 I created two pull requests, so it should be a bit faster now. I see it's 
 also storing sessions in the database and logs, no need for that... 

 On Monday, June 8, 2015 at 3:44:04 PM UTC-7, Alfonso de la Guarda Reyes 
 wrote:

 Massimo, 

 As Derek shows we can change anything and rerun the tests 
 Saludos, 

  
 Alfonso de la Guarda 
 Twitter: @alfonsodg 
 Redes sociales: alfonsodg 
Telef. 991935157 
 1024D/B23B24A4 
 5469 ED92 75A3 BBDB FD6B  58A5 54A1 851D B23B 24A4 


 On Mon, Jun 8, 2015 at 5:41 PM, Massimo Di Pierro 
 massimo@gmail.com wrote: 
  Where is the code you run? Did you session.forget() in web2py or did 
 you 
  create a session at every request? Also, did you disable migrations? 
  Remember web2py defaults to everything on, Flask instead, for example, 
  defaults to everything off. 
  
  
  On Monday, 8 June 2015 17:30:30 UTC-5, Alfonso de la Guarda Reyes 
 wrote: 
  
  Hi, 
  
  The idea was not to compare web2py itself, as I said I use it in the 
  frontend but I found it interesting how they will review other 
  frameworks, but also lead to reflection on how to increase the 
  performance (requests per second) for  web2py 
  Saludos, 
  
   
  Alfonso de la Guarda 
  Twitter: @alfonsodg 
  Redes sociales: alfonsodg 
 Telef. 991935157 
  1024D/B23B24A4 
  5469 ED92 75A3 BBDB FD6B  58A5 54A1 851D B23B 24A4 
  
  
  On Mon, Jun 8, 2015 at 5:27 PM, Derek sp1...@gmail.com wrote: 
   well, that's not a fair bet, falcon will compile itself with cython 
 if 
   it's 
   available. 
   
   
   On Monday, June 8, 2015 at 3:05:05 PM UTC-7, Alfonso de la Guarda 
 Reyes 
   wrote: 
   
   Hello, 
   
   As I'm finishing a project that requires processing information 
 very 
   quickly (machine learning) and lately i am using #web2py for almost 
   everything, I found the dilemma of dividing it into a solution that 
   implements a REST-based backend and frontend based on web2py, the 
 case 
   was whether that solution was actually the fastest way to avoid in 
 the 
   short term make a refactoring project and so I found the bed 
   performance testing TechEmPower 
   
   
   
   
 https://www.techempower.com/benchmarks/#section=data-r10hw=ec2test=fortune 
   
   And I decided to complete the rest of python based web frameworks 
 and 
   make a decision based on performance, since all I need is a rest to 
   implement an API that works only with the frontend. 
   
   Thus I share the results of this benchmark, the same that has been 
   generated according to the specifications described in the 
 repository 
   using TechEmPower vagrant to replicate your environment 
   
   http://codebeautify.org/jsonviewer/2e0aac 
   
   The result is similar to the URL of the test bed although almost 
 all 
   web frameworks that have added multiple users, and the surprise of 
 the 
   event was falcon, although it was also good to see that my querdio 
   Bottle still fast for its minimalist design. 
   
   
   Saludos, 
   
    
   Alfonso de la Guarda 
   Twitter: @alfonsodg 
   Redes sociales: alfonsodg 
  Telef. 991935157 
   1024D/B23B24A4 
   5469 ED92 75A3 BBDB FD6B  58A5 54A1 851D B23B 24A4 
   
   -- 
   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/d/optout. 
  
  -- 
  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/d/optout. 



-- 
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/d/optout.


[web2py] Re: Python framework benchmarks

2015-06-08 Thread Niphlod
it's the usual weirdo-test. I bet all has been done with web2py defaults, 
which means migrations, sessions on disk, etc etc etc ?!

BTW there's no news in knowing that a minimal-something performs better 
than a batteries-included one, let alone the I was built specifically 
towards something.

-- 
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/d/optout.


[web2py] Re: Want to access multiple sqlite3 databases in the same app

2015-06-08 Thread Niphlod
db1 = DAL('sqlite://number_one.db')

db2 = DAL('sqlite://number_two.db')

db3 = DAL('sqlite://number_three.db')

all done!

On Tuesday, June 9, 2015 at 12:31:22 AM UTC+2, jackso...@quantachrome.com 
wrote:

 I am a newbie. I want to have multiple sqlite3 databases accessible in my 
 application. The db variable confuses me ...in the context of a controller 
 it seems to have a value assigned to it upon entry...Is this just the last 
 value assigned in db.py(model file). If I create multiple databases in my 
 model can I switch to the one I want by doing something like this in my 
 controller 'db = DAL('sqlite://some.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/d/optout.


[web2py] Re: Connecting to postgresql - where do I put schema name in the connection?

2015-06-08 Thread Niphlod
except from the obvious seems that there is no default schema for your 
dabatase this error popped up in the past with really old versions of 
postgresql ... may I ask what version are you running ?




-- 
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/d/optout.


[web2py] Re: Import an entire file into another file.

2015-06-06 Thread Niphlod
different controllers aren't really meant to share. if you want something 
available to both controllers, put the code in models and be happy.
Or you can go the pythonic way and put under modules (helpers.py), and 
then at the top of file_whatever.py you can use

from helpers import whatever

On Saturday, June 6, 2015 at 5:26:39 AM UTC+2, am...@gettalent.com wrote:

 In rails you can do require filename and use anything from that file. 
 Can you do something similar in Web2py?
 Here's the situation:
 fila_a.py in Controllers
 file_b.py in Controllers

 I need to import most of the functions (or all of them) from file_a.py 
 into file_b.py.
 How can I achieve this?

 Thanks in advance :)


-- 
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/d/optout.


<    4   5   6   7   8   9   10   11   12   13   >