[web2py] Re: Handling (2006, 'MySQL server has gone away') from Scheduler, pythonanywhere

2015-02-02 Thread Niphlod
uhm. does pythonanywhere even support a running process outside the web one 
?

BTW: all kinky calls to the db are fail-safed in the scheduler (see 
wrapped_* functions), to alleviate locking (albeit primarely for sqlite). 
This has the added benefit of making the scheduler more resilient against 
blocking, but this has gone away sounds like some problems with the 
underlying connectionpool

-- 
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: mssql connection URGENT!

2015-02-02 Thread Omi Chiba
Thank you for the reply. I found that that problem was why it doesn't 
accept IP Address instead of Named Instance and fixed the SQL Server 
configuration to use static IP to connect SQL Server. 

I can't connect to my servers SQL database via an IP Address
http://dba.stackexchange.com/questions/62165/i-cant-connect-to-my-servers-sql-database-via-an-ip-address

Problem Solved!

On Monday, February 2, 2015 at 1:33:35 PM UTC-6, Massimo Di Pierro wrote:

 The problem is that since you did not specify a name for the .table files 
 you get default (nobody does). default is a hash of the db uri so if you 
 change it the .table files break. If this is just a change in the name but 
 the tables are already in the database, the you should enable a 
 fake_migration (
 http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#migrate--fake_migrate)
  
 so that new .table files are created. If this is a new database, you need 
 to enable migrations (I see they are disabled for you). Make sure you do 
 not change the database schema until this is resolved else there is no way 
 for me to tell in which state you db and your .table are.

 Massimo

 On Monday, 2 February 2015 08:29:23 UTC-6, Omi Chiba wrote:

 The below connection statement was working fine and the SQL Servers's 
 instance was HELPDESK/HELPDESK.

 dbh = DAL(mssql2://username:password@HELPDESK/HS2000CS, 
 migrate_enabled=False)

 Now, our vendor change the name of instance to  HELPDESK/HELPDESK_VM.

 I tried, 
 dbh = DAL(mssql2://username:password@[HELPDESK/HELPDESK_VM]/HS2000CS, 
 migrate_enabled=False)
 dbh = DAL(mssql2://username:password@10.30.6.222/HS2000CS, 
 migrate_enabled=False)

 SQL Server is in our local network and 10.30.6.222 is the local ip 
 address.

 but both doesn't work.

 It's in production and I need to fix in a few hours. Please 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: Adding the number of day to a date

2015-02-02 Thread Anthony Smith
Hi 
Sorry misunderstood the question.
T2.completed_date is triggered when someone enters the date the task is 
completed on.

cheers

On Tuesday, 3 February 2015 06:35:00 UTC+11, Dave S wrote:



 On Sunday, February 1, 2015 at 12:13:54 AM UTC-8, Anthony Smith wrote:

 Hi Richard

 the trigger is T2.completed_date+T1.with_holding = T2.withhold_until

 I am reasonably new to web2py, can get though most things, but this has 
 me.

  
 I think Richard was asking what event causes T2 to be updated.  Does it 
 happen, for instance, when someone  visits a web page that display values 
 from T2?   Is it supposed to happen when someone completes a form updating 
 T1?  Should it happen on a periodic basis even if there is no user activity?

 That said, Massimo's comments explain the way the arithmetic is done; 
 Richard's question is about where the arithmetic code should be placed.

 (This is one of my favorite references:
 URL:http://docs.python.org/2/library/datetime.html#timedelta-objects)

 /dps



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


[web2py] OT: Firefox complaint

2015-02-02 Thread Dave S
This isn't a web2py problem, but it does show up when I'm testing or using 
my web2py code, so there's a chance that it could be ameliorated by web2py 
with an appropriate header inclusion, or something.   But even without 
that, it will feel good to grouse out loud:

Firefox makes an orderly exit (File Menu, select Quit) and politely 
savess the session.  On restart, offers me the session to start up, and all 
is good.  Except. 

For some reason, the session saves some tabs not with the last URL used, 
but the first URL that was found /last time/, which after several weeks of 
such cycles is way out of date.  That particular tab gets updated many 
times (beginning with correcting the IP; the server is a local one not 
covered by a public DNS, and the IP is dynamically assigned); none of these 
updates are applied when I cycle things the next time. 

This behavior occurs with recent versions of FF (33 and later) and on both 
Fedora 16 and Windows 7. 

Sorry to interrupt, but I do feel better now.

/dps

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


Re: [web2py] How to mimic routes.py with nginx

2015-02-02 Thread Michele Comitini


Il giorno lunedì 2 febbraio 2015 12:29:00 UTC+1, alex ha scritto:

 Michele, 

 Thank you for quick answer! 

 If I put in nginx server directive: 

 location ~ ^/AAA(/.*)?$ { rewrite ^.*$ http://example.com/app/ctr/fnc 
 break ; }

 and leave web2py/applications/app/routes.py with only 

 routes_out = (
 ('/app/ctr/fnc', r'/AAA'),
 )

 everytime I call /AAA it gets rewritten to /app/ctr/fnc.
 Instead, I would like to see always /AAA 



I think you should post a minimal server directive to reproduce the 
problem.
Don't use complete URI's (i.e. with https part) or you are likely to get an 
http redirection. This should get closer to you need: 

location /AAA { rewrite ^/AAA/.*$ /a/c/f last; }

location / { uwsgi|scgi|fcgi handler section }
 

 On the other hand, if I remove the rewrite from nginx server directive, 
 and I leave both routes_in and routes_out as described before in 
 /app/routes.py, it works but randomly. 

 Once every two or three times I refresh the page, I get:

 invalid request




 On Mon, Feb 2, 2015 at 7:50 PM, Michele Comitini michele@gmail.com 
 javascript: wrote:

 you still need your routes.py in place:

 routes_out = (
 ('/app/ctr/fnc', r'/AAA'),

 )


 2015-02-02 11:23 GMT+01:00 al ex a22...@gmail.com javascript::

 I have setup this route in /web2py/applications/app

 routes_in = (
 (r'/AAA/?', '/app/ctr/fnc'),
 )

 routes_out = (
 ('/app/ctr/fnc', r'/AAA'),

 )


 With rockets, on localhost, it works fine. 

 On production server nginx 1.7.9, uwsgi 2.0.8, python 2.7.6, if I 
 repeatedly refresh /AAA, sometimes it work, sometimes it gives: invalid 
 request.

 This goes apparently randomly. 

 How to isolate and solve this problem? 
 I thought maybe trying to eliminate routes.py, and mimic the same rules 
 on nginx, could give me a hint. 

 routes_in would go to 

 location ~ ^/AAA(/.*)?$ { rewrite ^.*$ http://example.com/app/ctr/fnc 
 break ; }

 but how to write route_out in this case? 


  -- 
 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 javascript:.
 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 javascript:.
 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: Default value (Not in table) in Dropdown

2015-02-02 Thread Omi Chiba
Thanks. It worked great!!!

On Monday, February 2, 2015 at 4:07:36 PM UTC-6, Niphlod wrote:

 that's pretty obvious. look at what you're trying to render in the 
 view!


  {{for model in models:}}
 option value={{=model.Name}} 
 {{= selected='selected' if model.Name==request.vars.model_name else 
 }}
 {{=model.Name}}
 /option
 {{pass}}


 at the very least, if you want to keep the same code in the view, you 
 should have the controller pass a list with a Storage() that has a Name 
 attribute

 from gluon.storage import Storage
 models = [ Storage(Name='SELECT 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.


Re: [web2py] Re: Memory leaks in web2py : how do you track them ?

2015-02-02 Thread Richard Vézina
appointment app where having memory leaks

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


https://groups.google.com/d/msg/web2py/u-eU-2vhims/1u3fOnqPoUMJ
https://groups.google.com/d/msg/web2py/QbR7pY3xHuM/rOyuHhVmbjYJ

Richard

On Mon, Feb 2, 2015 at 2:26 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 What application is this? Are you using cache.ram or a cache decorator?
 That would cause this.


 On Sunday, 1 February 2015 03:18:05 UTC-6, Louis Amon wrote:

 I have a web2py server running on heroku.

 So far my server had little traffic, and Heroku being a cloud PaaS
 service means they put processes to sleep if they're not used for a while.

 Because of that, I never really noticed that the memory signature of my
 application was growing at every request until my server got put to sleep
 due to inactivity (at night most often), and thus the memory was reset upon
 restart.

 This is no longer the case, and now my server often becomes unavailable
 due to memory quotas, which is a big issue on production.


 I've been using several tools to track the memory usage of web2py, one of
 which is the logs of Heroku itself, eg:

 2015-02-01T09:01:46.965380+00:00 heroku[web.1]: source=web.1 dyno=heroku.
 28228261.c4fede81-d205-4dad-b07e-2ad6dcc49a0f sample#*memory_total=186.27MB
 sample#memory_rss=180.75MB sample#memory_cache=5.52MB*
 sample#memory_swap=0.00MB sample#memory_pgpgin=71767pages
 sample#memory_pgpgout=24081pages

 As far as I can tell, the memory_cache signature is rather small and is
 stable around 5MB (I don't use cache a lot on my website, precisely for
 fear of memory leaks).

 Based on the documentation
 https://devcenter.heroku.com/articles/log-runtime-metrics,
 memory_rss on Heroku refers to:


- *Resident Memory* (memory_rss): The portion of the dyno’s memory
(megabytes) held in RAM.

  This variable keeps growing at every request, seemingly regardless of
 which page is accessed.

 You will find attached the memory chart of my app, taken from Heroku's
 Metrics back-office : every vertical line is a hard reset I had to do
 manually to prevent the app from exceeding quotas. The red zone is a server
 downtime because of swap usage making requests to be served very very
 slowly.


 I've tried using the memory_profiler library to decorate some functions
 in my code and try to track memory usage increase, but it is a very tedious
 task and so far I haven't managed to find the root of my problem.


 I suspect my issue to be in models since those are loaded on every
 request, but I can't use memory_profiler on them since models aren't
 natively encapsulated in any function.


 Is there a function somewhere in Gluon that loads every model, and which
 I could decorate to scope which model might have memory leaks ?

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


-- 
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: trouble with like

2015-02-02 Thread Niphlod
try to see what

db(db.mytable.id)._select(db.table.myfield.like('%.mp3'))

prints out

On Monday, February 2, 2015 at 9:39:20 PM UTC+1, weheh wrote:

 I had a query

 db.mytable.myfield.like('%.mp3')

 where the actual field contents were mytable.myfield.cypher1.cypher2.mp3 
 and it worked OK. But now it's non-functional.

 After replacing the query with the following

 db.mytable.myfield.endswith('.mp3')

 everything is working fine again. 

 What happened to like? Anybody else run into this problem, or am I doing 
 something stupid?


-- 
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] trouble with like

2015-02-02 Thread weheh
I had a query

db.mytable.myfield.like('%.mp3')

where the actual field contents were mytable.myfield.cypher1.cypher2.mp3 
and it worked OK. But now it's non-functional.

After replacing the query with the following

db.mytable.myfield.endswith('.mp3')

everything is working fine again. 

What happened to like? Anybody else run into this problem, or am I doing 
something stupid?

-- 
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] Default value (Not in table) in Dropdown

2015-02-02 Thread Omi Chiba
For example, I have a list models table and build a dropdown list from it 
but I want dropdown show something like SELECT Model, then pick the 
model. I don't want to register the SELECT Model record in table. What's 
the easiest and clean way to do? I have 5 drop down list so ideally when I 
change the first dropdown, other 4 should show SELECT  on the 
dropdown's default.

*my controller*
models = db().select(db.KR_Model.ALL)

*my view*
tdselect name='model_name'
{{for model in models:}}
option value={{=model.Name}} 
{{= selected='selected' if 
model.Name==request.vars.model_name else }}
{{=model.Name}}
/option
{{pass}}
/select/td

-- 
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: Memory leaks in web2py : how do you track them ?

2015-02-02 Thread Niphlod


 @niplhod do you know if is there a way to integrate memory profiling in 
 travis-ci??

  
I don't see it in any of the docs. if you have something in mind that will 
print out something as a value, we could print an alarm on a crafted build 
if some value passes a threshold, but that's pretty much all I can think of.

-- 
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: Default value (Not in table) in Dropdown

2015-02-02 Thread Niphlod
building it by hand kinda slows things down a lot (boilerplate alert). 
Thankfully, we all know HTML, but bring!

Having a widget displaying a default value (that won't get accepted) is 
pretty damn easy with IS_IN_SET(..., zero='choose me...')

with html and the requirement of no added validation (both serverside or 
javascript), you can only do

selectoption selected disabledchoose one/optionoption value=1
/option/select

i.e. make the first option selected AND disabled. It will show up but the 
user won't be able to transmit it as part of the form, not even in 
javascript (val() of this select would be *null*)


-- 
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: Default value (Not in table) in Dropdown

2015-02-02 Thread Niphlod
that's pretty obvious. look at what you're trying to render in the 
view!


 {{for model in models:}}
option value={{=model.Name}} 
{{= selected='selected' if model.Name==request.vars.model_name else 
}}
{{=model.Name}}
/option
{{pass}}


at the very least, if you want to keep the same code in the view, you 
should have the controller pass a list with a Storage() that has a Name 
attribute

from gluon.storage import Storage
models = [ Storage(Name='SELECT 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: Question about web2py roadmap.

2015-02-02 Thread Dave S
I find this post to be a lot clearer in terms of understanding what Joe is 
getting after than the posts earlier in the thread.

I'm thinking that SQLFORM already takes a lot of the drudgery out of form 
design, and so I'm missing what Joe thinks is missing.  I haven't used the 
MS web design tools much (studied Silverlight 1.1 a couple of years ago), 
so  I'm definitely not a power user thereof, so I may not have the 
perspective to evaluate Joe's request.  (I'm also out-of-date in doing 
Android app dev; that doesn't use Eclipse Galileo anymore, but I think 
there was some similarity between EG and SL design of the visual side.)

/dps

On Saturday, January 31, 2015 at 9:01:41 AM UTC-8, JoeCodeswell wrote:

 Dear Leonel,

 I agree that you can and *should* do both. For my web2py projects, I am 
 BOTH Developer and Administrator, *at* *least initially*, before i hand 
 it over to my user.

 Regarding *my suggestions to improve* the help web2py gives me with the 
 *Administration 
 Tasks for my users*, my suggestion is to help *me, as developer,* 
 customize the web2py Administrative capabilities for them. Possibly 
 choosing from an easily understood menu of options of say 
 registration/login types, etc.. 

 Regarding *my suggestions to improve* the help web2py gives me with the 
 *Website 
 Creation Tasks* *for me as a developer*, I'd love, for example to have a 
 Form Designer that would generate easily understandable/tweak-able web2py 
 MVC code, to take the repeated drudgery out of form generation. I am 
 thinking here, of the process i used to use in Microsoft Development. I 
 would 

- first, use the MS form designer to help me flesh out my user 
interface View, making sure to get user buy in,
- and then, hook that/those View(s) up with Model/Controller code for 
implementation.


 Thanks to all for a GREAT discussion.

 Love and peace,

 Joe

 On Friday, January 30, 2015 at 2:17:51 PM UTC-8, Leonel Câmara wrote:

 I strongly agree with Massimo on this. By making administrative tasks 
 easier you take that burden out of many developers. Not every developer is 
 part of a big team that has one guy just to take care of administrative 
 stuff. This is very true in the startup market where I think web2py has an 
 advantage.   
   
 There's also another point, if you make web2py easier to admin it will be 
 easier for different hosting platforms to support it, this can take even 
 more admin tasks out of the developers hands (like pythonanywhere already 
 does).  
   
 There's no conflict between the two, you can work on features for both 
 the developers and the administrators, and specially the poor dudes having 
 to wear both hats. In the end it's always good for the developers.



-- 
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: mssql connection URGENT!

2015-02-02 Thread Omi Chiba
Thanks!

On Monday, February 2, 2015 at 3:06:05 PM UTC-6, Niphlod wrote:

 uhm. Technically having more than one instance of mssql running on the 
 same ip is possible (multiple named instances) but it involves a totally 
 different connection handshake. 
 If you don't specify different port numbers, you can still have them 
 dynamic but you have to resort to have SQL Server Browser running on the 
 server and specifying a connection using the odbc connectionstring 
 notation (mssql://{Driver={SQL 
 Server};Server=hostname\instancename;..}), that will trigger that new 
 handshakeeverything works fine, I use it every day.


-- 
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: Submit current form prior to logout?

2015-02-02 Thread Niphlod
that works only if your controller accepts basically any data (very low 
barrier on validation). My usecase scenario didn't ever involve the user 
not knowing it's submitting data, and I'd treat half-filled forms with a 
dedicated controller to clean/purge/mark_as_unreliable data what's coming 
in...but that's me with my usual scenario.
The underlying concept in developing is that every app has its own 
goals... in principle, if you can live with whatever data the user had the 
time to fill, there's nothing wrong with your approach.

On Sunday, February 1, 2015 at 4:27:12 AM UTC+1, lillian wrote:


 Yeah that's basically what I came up with between posting and seeing your 
 reply, except I'm letting the code in my controller do the actual db update 
 (its that same code used if the user had clicked on submit) and then I 
 redirect based on what UI element called submit (submit button? do the 
 normal thing.  Logout button? logout. etc.)

 Does that make sense?  It works but I'm wondering if there might be issues 
 I'm not aware of.  Kinda new to this type of programming :-/

 On Friday, January 30, 2015 at 1:31:08 PM UTC-8, Niphlod wrote:

 the gist of it should be something like

 $(function() {
 $('a#thelogoutbutton').on('click', function(e) {
 e.preventDefault();
 if (code_to_submit_the_form() == 'everythingwentwell') {
 window.href = this.href;
 } else {
 managefailure();
 //optionally window.href = this.href
 } 
 })
 })

 as a general rule, it's not a polite thing to do to block on something 
 if the user presses i want to go out of here, so be sure to do it as 
 switfly as possible (i.e. don't require a strict check on 
 code_to_submit_the_form() and make it happen in under a half second).



-- 
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: Default value (Not in table) in Dropdown

2015-02-02 Thread Omi Chiba
In my controller, can I just add the default value in controller something 
like below? If possible, this is the easiest one for me. Though I will get 
error I do this.


*controller*
   if request.vars.model_name: 
models = db(db.KR_Lead.ModelName == 
request.vars.model_name).select(db.KR_Lead.ALL)
else:
*models = 'SELECT Model'*

Error:
type 'exceptions.AttributeError'('str' object has no attribute 'Name')



On Monday, February 2, 2015 at 3:38:11 PM UTC-6, Niphlod wrote:

 building it by hand kinda slows things down a lot (boilerplate alert). 
 Thankfully, we all know HTML, but bring!

 Having a widget displaying a default value (that won't get accepted) is 
 pretty damn easy with IS_IN_SET(..., zero='choose me...')

 with html and the requirement of no added validation (both serverside or 
 javascript), you can only do

 selectoption selected disabledchoose one/optionoption value=1
 /option/select

 i.e. make the first option selected AND disabled. It will show up but the 
 user won't be able to transmit it as part of the form, not even in 
 javascript (val() of this select would be *null*)




-- 
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: Adding the number of day to a date

2015-02-02 Thread Dave S


On Sunday, February 1, 2015 at 12:13:54 AM UTC-8, Anthony Smith wrote:

 Hi Richard

 the trigger is T2.completed_date+T1.with_holding = T2.withhold_until

 I am reasonably new to web2py, can get though most things, but this has me.

  
I think Richard was asking what event causes T2 to be updated.  Does it 
happen, for instance, when someone  visits a web page that display values 
from T2?   Is it supposed to happen when someone completes a form updating 
T1?  Should it happen on a periodic basis even if there is no user activity?

That said, Massimo's comments explain the way the arithmetic is done; 
Richard's question is about where the arithmetic code should be placed.

(This is one of my favorite references:
URL:http://docs.python.org/2/library/datetime.html#timedelta-objects)

/dps

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


[web2py] Re: mssql connection URGENT!

2015-02-02 Thread Niphlod
uhm. Technically having more than one instance of mssql running on the same 
ip is possible (multiple named instances) but it involves a totally 
different connection handshake. 
If you don't specify different port numbers, you can still have them 
dynamic but you have to resort to have SQL Server Browser running on the 
server and specifying a connection using the odbc connectionstring 
notation (mssql://{Driver={SQL 
Server};Server=hostname\instancename;..}), that will trigger that new 
handshakeeverything works fine, I use it every day.

-- 
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: Memory leaks in web2py : how do you track them ?

2015-02-02 Thread Michele Comitini
I have been using this sometimes ago, if there is a cyclic reference or a 
stale reference of some sort, it help to spot it.

https://groups.google.com/d/msg/web2py-developers/Rd8hC5aFRZo/UTxZHjAwWcUJ
http://mg.pov.lt/objgraph/

Il giorno lunedì 2 febbraio 2015 22:48:17 UTC+1, Louis Amon ha scritto:

 I've installed this memory profiler 
 https://github.com/fabianp/memory_profiler and tried the profile 
 decorator it provides, and the output is pretty awesome ! 

 I've ran the exact same request twice, and these are the outputs of the 
 profile on *gluon.compileapp.run_models_in* :

 *First run*

 Line #Mem usageIncrement   Line Contents

 

531  28.8945 MiB   0. MiB   @profile(precision=4)

532 def run_models_in(environment):

533 

534 Runs all models (in the app 
 specified by the current folder)

535 It tries pre-compiled models first 
 before compiling them.

536 

537 

538  28.8945 MiB   0. MiB   folder = environment['request'].
 folder

539  28.8945 MiB   0. MiB   c = environment['request'].
 controller

540 #f = 
 environment['request'].function

541  28.8945 MiB   0. MiB   response = environment['response']

542 

543  28.8945 MiB   0. MiB   path = pjoin(folder, 'models')

544  28.8945 MiB   0. MiB   cpath = pjoin(folder, 'compiled')

545  28.8945 MiB   0. MiB   compiled = os.path.exists(cpath)

546  28.8945 MiB   0. MiB   if compiled:

547 models = sorted(listdir(cpath, 
 '^models[_.][\w.]+\.pyc$', 0), model_cmp)

548 else:

549  28.8984 MiB   0.0039 MiB   models = sorted(listdir(path, 
 '^\w+\.py$', 0, sort=False), model_cmp_sep)

550  28.8984 MiB   0. MiB   models_to_run = None

551  41.7812 MiB  12.8828 MiB   for model in models:

552  41.7656 MiB  -0.0156 MiB   if response.models_to_run != 
 models_to_run:

553  37.3164 MiB  -4.4492 MiB   regex = models_to_run = 
 response.models_to_run[:]

554  37.3164 MiB   0. MiB   if isinstance(regex, list):

555  37.3320 MiB   0.0156 MiB   regex = re_compile('|'.
 join(regex))

556  41.7656 MiB   4.4336 MiB   if models_to_run:

557  41.7656 MiB   0. MiB   if compiled:

558 n = len(cpath)+8

559 fname = model[n:-4].
 replace('.','/')+'.py'

560 else:

561  41.7656 MiB   0. MiB   n = len(path)+1

562  41.7656 MiB   0. MiB   fname = model[n:].
 replace(os.path.sep,'/')

563  41.7656 MiB   0. MiB   if not regex.search(fname) 
 and c != 'appadmin':

564 continue

565  41.7656 MiB   0. MiB   elif compiled:

566 code = read_pyc(model)

567  41.7656 MiB   0. MiB   
 ...

-- 
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: variable query

2015-02-02 Thread José Eloy
Sorry for my delay in answer.

Anthony:

Your solution works well:

db(db.articulos.id.belongs(list_of_ids)).select()

Creating a list of ids and using belongs was the correct for me.

Thanks guys for the 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: web2py + maps. Any sugestion?

2015-02-02 Thread nick name
Also have a look at: https://github.com/jwass/mplleaflet

Seems to also make Matplotlib-style plots work well with leaflet. haven't 
tried it yet, but it looks awesome.

On Monday, January 19, 2015 at 7:42:30 AM UTC+2, Carlos A. Armenta Castro 
wrote:

 Im trying to work with maps for a vehicle tracking system. I found several 
 js libraries like google maps api, leaflet, gmaps.js, openstreet, mapbox 
 and too many more like that. 
 Would you recommend any library? Sugestions to work with web2py and maps 
 (gis)? 
 Thank you and sorry for my english.

-- 
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: syntax error in update command

2015-02-02 Thread Niphlod
the syntax is

db(q).update(fieldname=something)

you instead are trying to do

db(q).update(tablename.fieldname=something)



On Sunday, February 1, 2015 at 8:54:21 PM UTC+1, Alex Glaros wrote:

 anyone see why this update line doesn't work?

 db(db.auth_user.id == auth.user_id).update(auth_user.last_logged_in=
 request.now)

 raises this error:

 type 'exceptions.SyntaxError' keyword can't be an expression  

 but this works in the Database Administration (appadmin) with table 
 auth_user

 last_logged_in = request.now

 and this other unrelated update works:

 db(db.InternalMessage.id == this_message.id).update(dateTimeMessageRead=
 request.now)

 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.


Re: [web2py] How to mimic routes.py with nginx

2015-02-02 Thread Michele Comitini
you still need your routes.py in place:

routes_out = (
('/app/ctr/fnc', r'/AAA'),

)


2015-02-02 11:23 GMT+01:00 al ex a22...@gmail.com:

 I have setup this route in /web2py/applications/app

 routes_in = (
 (r'/AAA/?', '/app/ctr/fnc'),
 )

 routes_out = (
 ('/app/ctr/fnc', r'/AAA'),

 )


 With rockets, on localhost, it works fine.

 On production server nginx 1.7.9, uwsgi 2.0.8, python 2.7.6, if I
 repeatedly refresh /AAA, sometimes it work, sometimes it gives: invalid
 request.

 This goes apparently randomly.

 How to isolate and solve this problem?
 I thought maybe trying to eliminate routes.py, and mimic the same rules on
 nginx, could give me a hint.

 routes_in would go to

 location ~ ^/AAA(/.*)?$ { rewrite ^.*$ http://example.com/app/ctr/fnc
 break ; }

 but how to write route_out in this case?


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


-- 
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] How to mimic routes.py with nginx

2015-02-02 Thread al ex
Michele,

Thank you for quick answer!

If I put in nginx server directive:

location ~ ^/AAA(/.*)?$ { rewrite ^.*$ http://example.com/app/ctr/fnc break
; }

and leave web2py/applications/app/routes.py with only

routes_out = (
('/app/ctr/fnc', r'/AAA'),
)

everytime I call /AAA it gets rewritten to /app/ctr/fnc.
Instead, I would like to see always /AAA


On the other hand, if I remove the rewrite from nginx server directive, and
I leave both routes_in and routes_out as described before in
/app/routes.py, it works but randomly.

Once every two or three times I refresh the page, I get:

invalid request




On Mon, Feb 2, 2015 at 7:50 PM, Michele Comitini michele.comit...@gmail.com
 wrote:

 you still need your routes.py in place:

 routes_out = (
 ('/app/ctr/fnc', r'/AAA'),

 )


 2015-02-02 11:23 GMT+01:00 al ex a22...@gmail.com:

 I have setup this route in /web2py/applications/app

 routes_in = (
 (r'/AAA/?', '/app/ctr/fnc'),
 )

 routes_out = (
 ('/app/ctr/fnc', r'/AAA'),

 )


 With rockets, on localhost, it works fine.

 On production server nginx 1.7.9, uwsgi 2.0.8, python 2.7.6, if I
 repeatedly refresh /AAA, sometimes it work, sometimes it gives: invalid
 request.

 This goes apparently randomly.

 How to isolate and solve this problem?
 I thought maybe trying to eliminate routes.py, and mimic the same rules
 on nginx, could give me a hint.

 routes_in would go to

 location ~ ^/AAA(/.*)?$ { rewrite ^.*$ http://example.com/app/ctr/fnc
 break ; }

 but how to write route_out in this case?


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


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


-- 
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] How to mimic routes.py with nginx

2015-02-02 Thread al ex
I have setup this route in /web2py/applications/app

routes_in = (
(r'/AAA/?', '/app/ctr/fnc'),
)

routes_out = (
('/app/ctr/fnc', r'/AAA'),

)


With rockets, on localhost, it works fine.

On production server nginx 1.7.9, uwsgi 2.0.8, python 2.7.6, if I
repeatedly refresh /AAA, sometimes it work, sometimes it gives: invalid
request.

This goes apparently randomly.

How to isolate and solve this problem?
I thought maybe trying to eliminate routes.py, and mimic the same rules on
nginx, could give me a hint.

routes_in would go to

location ~ ^/AAA(/.*)?$ { rewrite ^.*$ http://example.com/app/ctr/fnc break
; }

but how to write route_out in this case?

-- 
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: Handling (2006, 'MySQL server has gone away') from Scheduler, pythonanywhere

2015-02-02 Thread Kiran Subbaraman
Looks similar to this open-issue: 
https://github.com/web2py/web2py/issues/733



Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Tue, 03-02-2015 2:47 AM, Niphlod wrote:
uhm. does pythonanywhere even support a running process outside the 
web one ?


BTW: all kinky calls to the db are fail-safed in the scheduler (see 
wrapped_* functions), to alleviate locking (albeit primarely for 
sqlite).
This has the added benefit of making the scheduler more resilient 
against blocking, but this has gone away sounds like some problems 
with the underlying connectionpool

--
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 
mailto:web2py+unsubscr...@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] insecure string pickle

2015-02-02 Thread Dmitry Ermolaev
Error ticket for adminTicket ID

127.0.0.1.2015-02-03.07-40-32.4dc31e25-5b8c-4c78-b525-2a58b4ff7015
type 'exceptions.ValueError' insecure string pickleВерсияweb2py™Version 
2.9.12-stable+timestamp.2015.01.17.06.11.03PythonPython 2.7.6: 
C:\Python27\python.exe (prefix: C:\Python27)Traceback

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

Traceback (most recent call last):
  File C:\web2py-m\gluon\restricted.py, line 224, in restricted
exec ccode in environment
  File C:/web2py-m/applications/admin\compiled\controllers.default.errors.py, 
line 1945, in module
  File C:\web2py-m\gluon\globals.py, line 393, in lambda
self._caller = lambda f: f()
  File C:/web2py-m/applications/admin\compiled\controllers.default.errors.py, 
line 1554, in errors
  File C:\Python27\lib\pickle.py, line 1378, in load
return Unpickler(file).load()
  File C:\Python27\lib\pickle.py, line 858, in load
dispatch[key](self)
  File C:\Python27\lib\pickle.py, line 966, in load_string
raise ValueError, insecure string pickle
ValueError: insecure string pickle

Error snapshot [image: help] 
http://127.0.0.1:8000/admin/default/ticket/admin/127.0.0.1.2015-02-03.07-40-32.4dc31e25-5b8c-4c78-b525-2a58b4ff7015#

type 'exceptions.ValueError'(insecure string pickle)

inspect attributes
Frames
   
   - 
   
   *File C:\web2py-m\gluon\restricted.py in restricted at line 224* код 
   аргументы переменные
   - 
   
   *File 
   C:\web2py-m\applications\admin\compiled\controllers.default.errors.py in 
   module at line 1945* код аргументы переменные
   - 
   
   *File C:\web2py-m\gluon\globals.py in lambda at line 393* код аргументы
переменные
   - 
   
   *File 
   C:\web2py-m\applications\admin\compiled\controllers.default.errors.py in 
   errors at line 1554* код аргументы переменные
   - 
   
   *File C:\Python27\lib\pickle.py in load at line 1378* код аргументы 
   переменные
   - 
   
   *File C:\Python27\lib\pickle.py in load at line 858* код аргументы 
   переменные
   - 
   
   *File C:\Python27\lib\pickle.py in load_string at line 966* код аргументы
переменные
   Function argument list
   
   (self=pickle.Unpickler instance)
   Code listing
   
   961.
   962.
   963.
   964.
   965.
   966.
   
   967.
   968.
   969.
   970.
   
   def load_string(self):
   rep = self.readline()[:-1]
   for q in \': # double or single quote
   if rep.startswith(q):
   if len(rep)  2 or not rep.endswith(q):
   raise ValueError, insecure string pickle
   
   rep = rep[len(q):-len(q)]
   break
   else:
   raise ValueError, insecure string pickle
   
   VariablesbuiltinValueErrortype 'exceptions.ValueError'
   
Context

locals request session response
In file: 
C:\web2py-m\applications\admin\compiled\controllers.default.errors.pyc

1.

code object module at 072EADA0, file 
C:/web2py-m/applications/admin\compiled\controllers.default.errors.py, line 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] uwsgi: strange messages

2015-02-02 Thread Martin Weissenboeck
Two questions about uwsgi:

*(1) Server one: *I have installed nginx+uwsgi using the script on a test
server. web2py works fine, but the uwsgi.log file shows a new entry every
second (marked red).
And there is a warning (green) - how can I run uWSGI not as root?
This is the logfile after a restart (sorry, I know, there are many lines):

*** Starting uWSGI 2.0.9 (64bit) on [Tue Feb  3 08:25:09 2015] ***
compiled with version: 4.8.2 on 18 January 2015 11:43:22
os: Linux-3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your processes number limit is 15784
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
Python version: 2.7.6 (default, Mar 22 2014, 23:03:41)  [GCC 4.8.2]
*** starting uWSGI Emperor ***
*** has_emperor mode detected (fd: 6) ***
[uWSGI] getting INI configuration from web2py.ini
*** Starting uWSGI 2.0.9 (64bit) on [Tue Feb  3 08:25:09 2015] ***
compiled with version: 4.8.2 on 18 January 2015 11:43:22
os: Linux-3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014
nodename: mweissen-test
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /etc/uwsgi
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
setgid() to 33
set additional group 125 (dovecot)
setuid() to 33
your processes number limit is 15784
limiting address space of processes...
your process address space limit is 536870912 bytes (512 MB)
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload
could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /tmp/web2py.socket fd 3
Python version: 2.7.6 (default, Mar 22 2014, 23:03:41)  [GCC 4.8.2]
*** Python threads support is disabled. You can enable it with
--enable-threads ***
Python main interpreter initialized at 0x1865760
your mercy for graceful operations on workers is 60 seconds
*** Operational MODE: no-workers ***
spawned uWSGI master process (pid: 35875)
*** Python threads support is disabled. You can enable it with
--enable-threads ***
Python main interpreter initialized at 0x1a07a90
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
[uwsgi-cron] command python /home/www-data/web2py/web2py.py -Q -S welcome
-M -R scripts/sessions2trash.py -A -o registered as cron task
mapped 363840 bytes (355 KB) for 4 cores
*** Operational MODE: preforking ***
added /home/www-data/web2py/ to pythonpath.
mounting wsgihandler:application on /
worker 1 killed successfully (pid: 35873)
Respawned uWSGI worker 1 (new pid: 35885)
mapping worker 1 to CPUs: 0
emperor-i-am-ready-to-accept/write(): Bad file descriptor [core/uwsgi.c
line 3453]
Tue Feb  3 08:25:09 2015 - lost communication with the Emperor, goodbye...
Tue Feb  3 08:25:09 2015 - graceful shutdown triggered...
Gracefully killing worker 1 (pid: 35885)...
WSGI app 0 (mountpoint='/') ready in 0 seconds on interpreter 0x1a07a90
pid: 35878 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 35878)
Tue Feb  3 08:25:09 2015 - [emperor] vassal web2py.ini has been spawned
spawned uWSGI worker 1 (pid: 35888, cores: 1)
spawned uWSGI worker 2 (pid: 35889, cores: 1)
spawned uWSGI worker 3 (pid: 35890, cores: 1)
spawned uWSGI worker 4 (pid: 35891, cores: 1)
*** Stats server enabled on /tmp/stats.socket fd: 16 ***
mapping worker 2 to CPUs: 0
mapping worker 3 to CPUs: 0
mapping worker 4 to CPUs: 0
mapping worker 1 to CPUs: 0
Tue Feb  3 08:25:09 2015 - [emperor] vassal web2py.ini is ready to accept
requests
worker 1 killed successfully (pid: 35885)
worker respawning too fast !!! i have to sleep a bit (2 seconds)...
Respawned uWSGI worker 1 (new pid: 35892)
mapping worker 1 to CPUs: 0
emperor-i-am-ready-to-accept/write(): Bad file descriptor [core/uwsgi.c
line 3453]
Tue Feb  3 08:25:12 2015 - lost communication with the Emperor, goodbye...
Tue Feb  3 08:25:12 2015 - graceful shutdown triggered...
Gracefully killing worker 1 (pid: 35892)...
worker 1 killed successfully (pid: 35892)
Respawned uWSGI worker 1 (new pid: 35893)
mapping worker 1 to CPUs: 0
emperor-i-am-ready-to-accept/write(): Bad file descriptor [core/uwsgi.c
line 3453]
Tue Feb  3 08:25:13 2015 - lost communication with the Emperor, goodbye...
Tue Feb  3 08:25:13 2015 - graceful shutdown 

[web2py] Re: Memory leaks in web2py : how do you track them ?

2015-02-02 Thread Michele Comitini
@Leonel you should make a PR of this.  We have a program profiler, a memory 
profiler would be great!

@niplhod do you know if is there a way to integrate memory profiling in 
travis-ci??


Il giorno lunedì 2 febbraio 2015 00:35:50 UTC+1, Leonel Câmara ha scritto:

 If you have pool_size defined can you tell me if putting pool_size=0 in 
 your DAL solves this problem?

 Anyway I got really interested in this, for some unknown to me reason, and 
 decided to create a *VERY CRUDE* decorator to memory check your 
 controller functions for leaks, I guess with time we could refine this if 
 there's a desire to have a memory leak checker for controller functions in 
 web2py. I hope it helps, if it doesn't at least it was fun to code.

  
 def memcheck(f):
 
 A crude decorator to memory check your web2py controller's functions.


 False positives are possible if your controller function returns less 
 than
 common stuff.


 Put it in your models and then decorate your controller functions.


 example:


 @memcheck
 def index():
 response.flash = T(Welcome to web2py!)
 return dict(message=T('Hello World'))


 BEERWARE - You should try to buy Leonel Câmara beers!
 
 from functools import wraps
 from collections import Counter, Mapping, Iterable
 from gluon.languages import lazyT
 from gc import get_objects


 def get_value_objects(v):
 
 Generate an object for each value in a value including itself.
 
 if isinstance(v, basestring):
 yield v
 elif isinstance(v, lazyT):
 yield v
 yield v.s # Check lazyT symbols dict
 for i in v.s:  
 for new_v in get_value_objects(i):
 yield new_v
 elif isinstance(v, Mapping):
 yield v
 for i in v.values():
 for new_v in get_value_objects(i):
 yield new_v
 elif isinstance(v, Iterable):
 yield v
 for i in v:
 for new_v in get_value_objects(i):
 yield new_v
 else:
 yield v


 @wraps(f)
 def wrapper(*args, **kwargs):
 before = Counter(type(obj) for obj in get_objects())
 result = f(*args, **kwargs)
 after = Counter(type(obj) for obj in get_objects())
 result_objs = Counter(type(obj) for obj in get_value_objects(
 result))
 count = after - before - result_objs - Counter([Counter])
 # This and other stuff put in the response or session is not a 
 memory
 # leak.
 # So false positives may appear for what's not accounted here.
 if response.flash: 
 count -= Counter(type(obj) for obj in get_value_objects(
 response.flash))
 if response.js: 
 count -= Counter(type(obj) for obj in get_value_objects(
 response.js))
 
 # Finally we are ready to report what we have found.
 for k in count:
 print 'LEAKED: %d of type %s' % (count[k], k)
 return result


 return wrapper





-- 
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: syntax error in update command

2015-02-02 Thread Alex Glaros
thanks Niphlod

works perfectly; how could I miss that?

much appreciated

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: Groupby year on date field

2015-02-02 Thread Moiz Nagpurwala


trangely, this is what I get with the same app, same data, same code, both 
on pythonanywhere and my local machine.

https://lh3.googleusercontent.com/-mJM6wRc-lpc/VMxUS7cXeQI/A90/xFO6KgNk-DI/s1600/Capture.JPG


On Saturday, January 31, 2015 at 3:14:22 AM UTC+5:30, Niphlod wrote:


 https://lh6.googleusercontent.com/-pWsAPTKJbZ8/VMv7E7GHWnI/ARs/OMWXe-Ku54c/s1600/counts.png
 are you sure that the issue is not fetching but rather visualizing the 
 results you already fetched ???


-- 
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: ckeditor : how to make read only, how to remove the toolbar in a dynamic way

2015-02-02 Thread Tim Nyborg
Depends on how you're implementing the widget.

I've got a CKEditor widget as follows (pretty much a glorified copy of 
text.widget with the ckeditor class):

class CKEditor(FormWidget):
_class = 'ckeditor' 
   
@classmethod
def widget(cls, field, value, **attributes):
 
generates a TEXTAREA tag. 

see also: :meth:`FormWidget.widget`
 
default = dict(value=value) 
attr = cls._attributes(field, default, **attributes) 
return TEXTAREA(**attr) 

Used in the model, it's:

idb.define_table(
'module',
Field('id', 'id', readable=False),
...
Field('description', 'text', widget=CKEditor.widget)
)  

So to do what you're suggesting, I change it to:

def hideable_ckeditor_widget():
return SQLFORM.widgets.text.widget if 'new' in request.args or 'edit' 
in request.args else CKEditor.widget

idb.define_table(
'module',
Field('id', 'id', readable=False),
...
Field('description', 'text', widget=hideable_ckeditor_widget())
)  



On Sunday, February 1, 2015 at 9:25:35 AM UTC, Serge Bourgeois wrote:

 I just implemented the ckeditor plugin. It looks great, but I need help 
 (example if possible) showing how to hide the ckeditor toolbar for some 
 text fields, for instance in a controller with a smartgrid, where 
 request.args does not contain 'now' nor 'edit'.
 Thanks in advance !
 Serge


-- 
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] mssql connection URGENT!

2015-02-02 Thread Omi Chiba
The below connection statement was working fine and the SQL Servers's 
instance was HELPDESK/HELPDESK.

dbh = DAL(mssql2://username:password@HELPDESK/HS2000CS, 
migrate_enabled=False)

Now, our vendor change the name of instance to  HELPDESK/HELPDESK_VM.

I tried, 
dbh = DAL(mssql2://username:password@[HELPDESK/HELPDESK_VM]/HS2000CS, 
migrate_enabled=False)
dbh = DAL(mssql2://username:password@10.30.6.222/HS2000CS, 
migrate_enabled=False)

SQL Server is in our local network and 10.30.6.222 is the local ip address.

but both doesn't work.

It's in production and I need to fix in a few hours. Please 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] Handling (2006, 'MySQL server has gone away') from Scheduler, pythonanywhere

2015-02-02 Thread Ian Ryder
Hi, I've got a showstopper running scheduler on pythonanywhere - every few 
hours it drops out with:

Traceback (most recent call last): File /web2py/gluon/shell.py, 
line 272, in run exec(python_code, _env) File string, line 1, in 
module File /web2py/gluon/scheduler.py, 
line 719, in loop self.wrapped_report_task(task, self.async(task)) File 
/web2py/gluon/scheduler.py, 
line 868, in wrapped_report_task db.rollback() File /web2py/gluon/dal.py, 
line 8555, in rollback self._adapter.rollback() File 
/web2py/gluon/dal.py, 
line 1922, in rollback return self.connection.rollback()
OperationalError: (2006, 'MySQL server has gone away')

I can trap the error scheduler.py but I'm not sure how to reinitiate the 
connection - this error only seems to come from this process and it will 
happen even if it's not being used. Everything else seems to work fine.

Any help on how to handle and reconnect gracefully appreciated.

Thanks
Ian

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

2015-02-02 Thread Eric
Richard,

Thank you for your kind response. I did find the SQLFORM example and got it 
to present the form and accept a file. I'm still struggling with an overall 
idea of how things work in Web2py (and perhaps the web itself). Is there a 
resource that clearly describes what happens when a page is accessed the 
order or processing what happens. I don't quite understand what Python code 
is triggered immediately, how messages or whatever are generated as someone 
interacts with the page, etc. This is a general question and I'm sure there 
are good recourses for me to read. What I'm trying to avoid is just 
assuming some magic happens.

Eric

On Thursday, January 29, 2015 at 12:20:53 PM UTC-6, Richard wrote:

 Without the code from your controller and view it is more difficult to be 
 sure of what you are talking about exactly...

 I guess you have wrote a model, where you define a field of type upload, 
 then you want to understand how the upload of the file works and thing get 
 done...

 A simple question may be hard to draw, there  is many code layer involves, 
 but book explanation about upload may be a good start for you to understand 
 :

 http://web2py.com/books/default/chapter/29/07/forms-and-validators#SQLFORM-and-uploads

 Web2py is a framework, so many things that you may use to write from 
 scratch in php are readily available in web2py without you to butter 
 recoding them, except if you need custom things not offers and even then, 
 there many ways to tweaks web2py default feature most of the time, passing 
 just more parameters...

 Richard

 On Wed, Jan 28, 2015 at 10:46 AM, Eric eric@gmail.com javascript: 
 wrote:

 Sorry if this is too basic a question. I very new to web programming and 
 Web2py. I have written some desktop applications. Where I'm having trouble 
 right now is understanding exactly how the Python code in Web2py interacts 
 with the HTML. In my desktop GUI apps, a control like a button generates a 
 trigger or callback which I can capture and execute code in response. I'm 
 sure something like this is happening in web apps too, but I'm not quite 
 getting how it works. For example, If I place the following tag in the 
 HTML: 
 input type=file name=fileID
 the page will display a button with which I can select a file with the 
 browser's open file dialog. It will even show the file name on the page 
 after selection. What I can't see is how I execute a Python function in 
 response to this selection or how to get the filename to the function. I'm 
 thinking I need some basic instruction in how web programming works so any 
 references would be appreciated. I've been working my way through an 
 on-line HTML tutorial, but it seems that javascript is also important.

 Thanks in advanced,

 Eric

 -- 
 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 javascript:.
 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: Submit current form prior to logout?

2015-02-02 Thread lillian

Yeah that's basically what I came up with between posting and seeing your 
reply, except I'm letting the code in my controller do the actual db update 
(its that same code used if the user had clicked on submit) and then I 
redirect based on what UI element called submit (submit button? do the 
normal thing.  Logout button? logout. etc.)

Does that make sense?  It works but I'm wondering if there might be issues 
I'm not aware of.  Kinda new to this type of programming :-/

On Friday, January 30, 2015 at 1:31:08 PM UTC-8, Niphlod wrote:

 the gist of it should be something like

 $(function() {
 $('a#thelogoutbutton').on('click', function(e) {
 e.preventDefault();
 if (code_to_submit_the_form() == 'everythingwentwell') {
 window.href = this.href;
 } else {
 managefailure();
 //optionally window.href = this.href
 } 
 })
 })

 as a general rule, it's not a polite thing to do to block on something 
 if the user presses i want to go out of here, so be sure to do it as 
 switfly as possible (i.e. don't require a strict check on 
 code_to_submit_the_form() and make it happen in under a half second).


-- 
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: Memory leaks in web2py : how do you track them ?

2015-02-02 Thread Massimo Di Pierro
What application is this? Are you using cache.ram or a cache decorator? 
That would cause this.

On Sunday, 1 February 2015 03:18:05 UTC-6, Louis Amon wrote:

 I have a web2py server running on heroku.

 So far my server had little traffic, and Heroku being a cloud PaaS service 
 means they put processes to sleep if they're not used for a while.

 Because of that, I never really noticed that the memory signature of my 
 application was growing at every request until my server got put to sleep 
 due to inactivity (at night most often), and thus the memory was reset upon 
 restart.

 This is no longer the case, and now my server often becomes unavailable 
 due to memory quotas, which is a big issue on production.


 I've been using several tools to track the memory usage of web2py, one of 
 which is the logs of Heroku itself, eg:

 2015-02-01T09:01:46.965380+00:00 heroku[web.1]: source=web.1 dyno=heroku.
 28228261.c4fede81-d205-4dad-b07e-2ad6dcc49a0f sample#*memory_total=186.27MB 
 sample#memory_rss=180.75MB sample#memory_cache=5.52MB* 
 sample#memory_swap=0.00MB sample#memory_pgpgin=71767pages 
 sample#memory_pgpgout=24081pages

 As far as I can tell, the memory_cache signature is rather small and is 
 stable around 5MB (I don't use cache a lot on my website, precisely for 
 fear of memory leaks).

 Based on the documentation 
 https://devcenter.heroku.com/articles/log-runtime-metrics, memory_rss 
 on Heroku refers to:


- *Resident Memory* (memory_rss): The portion of the dyno’s memory 
(megabytes) held in RAM.

  This variable keeps growing at every request, seemingly regardless of 
 which page is accessed.

 You will find attached the memory chart of my app, taken from Heroku's 
 Metrics back-office : every vertical line is a hard reset I had to do 
 manually to prevent the app from exceeding quotas. The red zone is a server 
 downtime because of swap usage making requests to be served very very 
 slowly.


 I've tried using the memory_profiler library to decorate some functions 
 in my code and try to track memory usage increase, but it is a very tedious 
 task and so far I haven't managed to find the root of my problem.


 I suspect my issue to be in models since those are loaded on every 
 request, but I can't use memory_profiler on them since models aren't 
 natively encapsulated in any function.


 Is there a function somewhere in Gluon that loads every model, and which I 
 could decorate to scope which model might have memory leaks ?


-- 
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: Handling (2006, 'MySQL server has gone away') from Scheduler, pythonanywhere

2015-02-02 Thread Massimo Di Pierro
Did you put any dal query in a try... except? I am recently seeing people 
do this a lot and it very wrong.

On Monday, 2 February 2015 05:09:47 UTC-6, Ian Ryder wrote:

 Hi, I've got a showstopper running scheduler on pythonanywhere - every few 
 hours it drops out with:

 Traceback (most recent call last): File /web2py/gluon/shell.py, 
 line 272, in run exec(python_code, _env) File string, line 1, in 
 module File /web2py/gluon/scheduler.py, 
 line 719, in loop self.wrapped_report_task(task, self.async(task)) File 
 /web2py/gluon/scheduler.py, 
 line 868, in wrapped_report_task db.rollback() File 
 /web2py/gluon/dal.py, 
 line 8555, in rollback self._adapter.rollback() File 
 /web2py/gluon/dal.py, 
 line 1922, in rollback return self.connection.rollback()
 OperationalError: (2006, 'MySQL server has gone away')

 I can trap the error scheduler.py but I'm not sure how to reinitiate the 
 connection - this error only seems to come from this process and it will 
 happen even if it's not being used. Everything else seems to work fine.

 Any help on how to handle and reconnect gracefully appreciated.

 Thanks
 Ian


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

2015-02-02 Thread Richard Vézina
The whole chapter 7 (http://web2py.com/books/default/chapter/29/07/)

Is basically that!! If  you follow example step by step you should better
understand how it works... You can have a read of chapter 3 (
http://web2py.com/books/default/chapter/29/03/)

And the chapter 1 (
http://web2py.com/books/default/chapter/29/01/introduction#In-the-box),
there is some graph with big picture details...

I would have difficulties to make a comprehensive resume here of all what
contained in this chapters...

But read them is pretty straightforward and comprehensive...

Richard


On Fri, Jan 30, 2015 at 4:04 PM, Eric eric.sh...@gmail.com wrote:

 Richard,

 Thank you for your kind response. I did find the SQLFORM example and got
 it to present the form and accept a file. I'm still struggling with an
 overall idea of how things work in Web2py (and perhaps the web itself). Is
 there a resource that clearly describes what happens when a page is
 accessed the order or processing what happens. I don't quite understand
 what Python code is triggered immediately, how messages or whatever are
 generated as someone interacts with the page, etc. This is a general
 question and I'm sure there are good recourses for me to read. What I'm
 trying to avoid is just assuming some magic happens.

 Eric

 On Thursday, January 29, 2015 at 12:20:53 PM UTC-6, Richard wrote:

 Without the code from your controller and view it is more difficult to be
 sure of what you are talking about exactly...

 I guess you have wrote a model, where you define a field of type upload,
 then you want to understand how the upload of the file works and thing get
 done...

 A simple question may be hard to draw, there  is many code layer
 involves, but book explanation about upload may be a good start for you to
 understand :
 http://web2py.com/books/default/chapter/29/07/forms-
 and-validators#SQLFORM-and-uploads

 Web2py is a framework, so many things that you may use to write from
 scratch in php are readily available in web2py without you to butter
 recoding them, except if you need custom things not offers and even then,
 there many ways to tweaks web2py default feature most of the time, passing
 just more parameters...

 Richard

 On Wed, Jan 28, 2015 at 10:46 AM, Eric eric@gmail.com wrote:

 Sorry if this is too basic a question. I very new to web programming and
 Web2py. I have written some desktop applications. Where I'm having trouble
 right now is understanding exactly how the Python code in Web2py interacts
 with the HTML. In my desktop GUI apps, a control like a button generates a
 trigger or callback which I can capture and execute code in response. I'm
 sure something like this is happening in web apps too, but I'm not quite
 getting how it works. For example, If I place the following tag in the
 HTML:
 input type=file name=fileID
 the page will display a button with which I can select a file with the
 browser's open file dialog. It will even show the file name on the page
 after selection. What I can't see is how I execute a Python function in
 response to this selection or how to get the filename to the function. I'm
 thinking I need some basic instruction in how web programming works so any
 references would be appreciated. I've been working my way through an
 on-line HTML tutorial, but it seems that javascript is also important.

 Thanks in advanced,

 Eric

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


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

2015-02-02 Thread Richard Vézina
I wasn't know Massimo put them online, but thers is also his vid :
http://www.web2py.com/examples/default/videos/

Many hours of tutorial...

:)

Richard

On Mon, Feb 2, 2015 at 2:30 PM, Richard Vézina ml.richard.vez...@gmail.com
wrote:

 The whole chapter 7 (http://web2py.com/books/default/chapter/29/07/)

 Is basically that!! If  you follow example step by step you should better
 understand how it works... You can have a read of chapter 3 (
 http://web2py.com/books/default/chapter/29/03/)

 And the chapter 1 (
 http://web2py.com/books/default/chapter/29/01/introduction#In-the-box),
 there is some graph with big picture details...

 I would have difficulties to make a comprehensive resume here of all what
 contained in this chapters...

 But read them is pretty straightforward and comprehensive...

 Richard


 On Fri, Jan 30, 2015 at 4:04 PM, Eric eric.sh...@gmail.com wrote:

 Richard,

 Thank you for your kind response. I did find the SQLFORM example and got
 it to present the form and accept a file. I'm still struggling with an
 overall idea of how things work in Web2py (and perhaps the web itself). Is
 there a resource that clearly describes what happens when a page is
 accessed the order or processing what happens. I don't quite understand
 what Python code is triggered immediately, how messages or whatever are
 generated as someone interacts with the page, etc. This is a general
 question and I'm sure there are good recourses for me to read. What I'm
 trying to avoid is just assuming some magic happens.

 Eric

 On Thursday, January 29, 2015 at 12:20:53 PM UTC-6, Richard wrote:

 Without the code from your controller and view it is more difficult to
 be sure of what you are talking about exactly...

 I guess you have wrote a model, where you define a field of type upload,
 then you want to understand how the upload of the file works and thing get
 done...

 A simple question may be hard to draw, there  is many code layer
 involves, but book explanation about upload may be a good start for you to
 understand :
 http://web2py.com/books/default/chapter/29/07/forms-
 and-validators#SQLFORM-and-uploads

 Web2py is a framework, so many things that you may use to write from
 scratch in php are readily available in web2py without you to butter
 recoding them, except if you need custom things not offers and even then,
 there many ways to tweaks web2py default feature most of the time, passing
 just more parameters...

 Richard

 On Wed, Jan 28, 2015 at 10:46 AM, Eric eric@gmail.com wrote:

 Sorry if this is too basic a question. I very new to web programming
 and Web2py. I have written some desktop applications. Where I'm having
 trouble right now is understanding exactly how the Python code in Web2py
 interacts with the HTML. In my desktop GUI apps, a control like a button
 generates a trigger or callback which I can capture and execute code in
 response. I'm sure something like this is happening in web apps too, but
 I'm not quite getting how it works. For example, If I place the following
 tag in the HTML:
 input type=file name=fileID
 the page will display a button with which I can select a file with the
 browser's open file dialog. It will even show the file name on the page
 after selection. What I can't see is how I execute a Python function in
 response to this selection or how to get the filename to the function. I'm
 thinking I need some basic instruction in how web programming works so any
 references would be appreciated. I've been working my way through an
 on-line HTML tutorial, but it seems that javascript is also important.

 Thanks in advanced,

 Eric

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




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

[web2py] Re: mssql connection URGENT!

2015-02-02 Thread Massimo Di Pierro
The problem is that since you did not specify a name for the .table files 
you get default (nobody does). default is a hash of the db uri so if you 
change it the .table files break. If this is just a change in the name but 
the tables are already in the database, the you should enable a 
fake_migration 
(http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#migrate--fake_migrate)
 
so that new .table files are created. If this is a new database, you need 
to enable migrations (I see they are disabled for you). Make sure you do 
not change the database schema until this is resolved else there is no way 
for me to tell in which state you db and your .table are.

Massimo

On Monday, 2 February 2015 08:29:23 UTC-6, Omi Chiba wrote:

 The below connection statement was working fine and the SQL Servers's 
 instance was HELPDESK/HELPDESK.

 dbh = DAL(mssql2://username:password@HELPDESK/HS2000CS, 
 migrate_enabled=False)

 Now, our vendor change the name of instance to  HELPDESK/HELPDESK_VM.

 I tried, 
 dbh = DAL(mssql2://username:password@[HELPDESK/HELPDESK_VM]/HS2000CS, 
 migrate_enabled=False)
 dbh = DAL(mssql2://username:password@10.30.6.222/HS2000CS, 
 migrate_enabled=False)

 SQL Server is in our local network and 10.30.6.222 is the local ip address.

 but both doesn't work.

 It's in production and I need to fix in a few hours. Please 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.


Re: [web2py] ckeditor : how to make read only, how to remove the toolbar in a dynamic way

2015-02-02 Thread Serge Bourgeois
in stead of 'now' and 'edit', read 'new' or 'edit' ...

2015-02-01 10:25 GMT+01:00 Serge Bourgeois serge.bourgeo...@gmail.com:

 I just implemented the ckeditor plugin. It looks great, but I need help
 (example if possible) showing how to hide the ckeditor toolbar for some
 text fields, for instance in a controller with a smartgrid, where
 request.args does not contain 'now' nor 'edit'.
 Thanks in advance !
 Serge

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