[web2py] Re: How to get rid if the /init/default/ in the URL?

2017-10-23 Thread Dave S


On Monday, October 23, 2017 at 8:00:29 PM UTC-7, Joe wrote:
>
> Hi Anthony,
>
> My file structure on pythonanywhere looks like this:
>
>
> /home/username/web2py/applications/my_app_directory/applications/init
>
> *init* being the app name.
>
>  
>

The book doesn't mention using extra levels of directories when discussing 
PythonAnywhere deployment
(chapter 13).  Perhaps they are confusing the routing code when applying 
the "hide the app+controller" rules.

In the web2py directory, I have a routes.py file which contains this code:
>
>  
>
>  
> routers = dict(
>
>  
>
> BASE = dict( 
>
> default_application='init' 
>
> ), 
>
> init = dict( 
>
> default_controller='default', 
>
> default_function='index', 
>
> functions=['call', 'download', 'index', 'user'] 
>
> ) 
>
> ) 
>
>
>
> So, the web2py directory contains an application directory which contains 
> all my app directories. Then, all the app directories also have an 
> application directory which contains the app, *named init*.
>
>  
>
> I am not so sure if this is the optimal structure. Is it?
>
>
Are you doing this for source control reasons?  I would instead consider 
using just the normal level of directories.  If you're dealing with 
multiple repositories, than maybe an ln -s might help flatten web2py's view 
while keeping trees separate, but I would try without it .

 
>
> In any case, I used the button on the pythonanywhere *Web* tab to *Reload 
> www.myapp.com *. And, nothing changed.
>
>  
>
> I would love to resolve this, and find out what's wrong. 
>
>
> Thanks again for all your help.
>
>
> Cheers,
>
>
> Joe
>
>
>
/dps
 

>
>
> On Sunday, October 15, 2017 at 10:07:51 PM UTC+8, Anthony wrote:
>>
>> On Friday, October 13, 2017 at 7:22:42 PM UTC-4, Joe wrote:
>>>
>>> Hi Dave, I have reloaded the apps in web2py if that's what you mean. I 
>>> can't restart web2py, I can only reload the apps, I guess.
>>> Is there an other way on pythonanywhere? I mean, restarting web2py 
>>> instead of reloading the apps?
>>>
>>> *Re: robots.txt*
>>> If I put robots.txt in my static folder the URL will still have to be 
>>> *mysite.com/init/static/robots.txt 
>>> * to reach it- this is the 
>>> issue I am trying to solve - I am trying have *mysite.com/robots.txt 
>>> *
>>>
>>
>> Are you sure you have created /web2py/routes.py as described above and 
>> either reloaded the routes via the button in the web2py admin app or 
>> reloaded the web app via the PythonAnywhere "Web" tab? Note that routes.py 
>> must be in the root /web2py folder.
>>
>> Anthony
>>
>

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


[web2py] Re: How to get rid if the /init/default/ in the URL?

2017-10-23 Thread Joe
Hi Anthony,

My file structure on pythonanywhere looks like this:


/home/username/web2py/applications/my_app_directory/applications/init

*init* being the app name.

 

In the web2py directory, I have a routes.py file which contains this code:

 

 
routers = dict(

 

BASE = dict( 

default_application='init' 

), 

init = dict( 

default_controller='default', 

default_function='index', 

functions=['call', 'download', 'index', 'user'] 

) 

) 



So, the web2py directory contains an application directory which contains 
all my app directories. Then, all the app directories also have an 
application directory which contains the app, *named init*.

 

I am not so sure if this is the optimal structure. Is it?

 

In any case, I used the button on the pythonanywhere *Web* tab to *Reload 
www.myapp.com*. And, nothing changed.

 

I would love to resolve this, and find out what's wrong. 


Thanks again for all your help.


Cheers,


Joe




On Sunday, October 15, 2017 at 10:07:51 PM UTC+8, Anthony wrote:
>
> On Friday, October 13, 2017 at 7:22:42 PM UTC-4, Joe wrote:
>>
>> Hi Dave, I have reloaded the apps in web2py if that's what you mean. I 
>> can't restart web2py, I can only reload the apps, I guess.
>> Is there an other way on pythonanywhere? I mean, restarting web2py 
>> instead of reloading the apps?
>>
>> *Re: robots.txt*
>> If I put robots.txt in my static folder the URL will still have to be 
>> *mysite.com/init/static/robots.txt 
>> * to reach it- this is the 
>> issue I am trying to solve - I am trying have *mysite.com/robots.txt 
>> *
>>
>
> Are you sure you have created /web2py/routes.py as described above and 
> either reloaded the routes via the button in the web2py admin app or 
> reloaded the web app via the PythonAnywhere "Web" tab? Note that routes.py 
> must be in the root /web2py folder.
>
> Anthony
>

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


[web2py] New syntax error?

2017-10-23 Thread Dave S
In  my 2.15.x testing, I've been concentrating on the https interface, but 
I now tried to do a -M -S that would queue up a Scheduler task.  And I ran 
into an unexpected problem with syntax errors on print statements.

   if when:
  print "ri_s: when " + when

Even when I shorten the line to remove the concatenation, I get a syntax 
error:

Traceback (most recent call last):
  File "web2py.py", line 33, in 
gluon.widget.start(cron=True)
  File "/home/ec2-user/web2py/web2py-2.15.4/web2py/gluon/widget.py", line 
1152, in start
cronjob=options.cronjob)
  File "/home/ec2-user/web2py/web2py-2.15.4/web2py/gluon/shell.py", line 258
, in run
execfile(pyfile, _env)
  File "applications/updater/controllers/default.py", line 140
print "ri_s: when "
  ^
SyntaxError: invalid syntax

I tried changing the variable name to "pwhen" in case this was an 
if-statement/keyword issue, but still "invalid syntax".

As you might guess, default.py loads fine for https requests, and this code 
loads fine with -S under 2.14.6, so I'm not sure what's going on here.

/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] Re: MySql encryption using DAL

2017-10-23 Thread appjarbiz
I am using "autossh" which is a monitor wrapper around ssh that restarts 
the ssh connection if it gets dropped.  It appears to be working well.

On Thursday, October 12, 2017 at 4:52:49 PM UTC-5, appj...@gmail.com wrote:
>
> I'm using Heroku. Would the VPN option be more stable/reliable/performant 
> than an SSH tunnel?
>
> On Thursday, October 12, 2017 at 8:07:36 AM UTC-5, CDA wrote:
>>
>> Depending on the type of cloud service you may be able to setup VPN over 
>> internet and connect your DB via the VPN tunnel.
>>
>> On Oct 11, 2017 11:24 PM,  wrote:
>>
>>
>>
>> On Wednesday, October 11, 2017 at 11:52:02 AM UTC-5, Massimo Di Pierro 
>> wrote:
>>
>>>
>>>
>>> On Saturday, 7 October 2017 01:55:53 UTC-5, appj...@gmail.com wrote:

 Thank you Massimo!

 There is a great detailed deployment recipe for SSH tunneling to your 
 database server from a Heroku app instance (dyno). It works as of this 
 post.10/8/17

 https://stackoverflow.com/questions/21575582/ssh-tunneling-from-heroku/46629121#46629121

 There are 2 issues/questions with this though:

 1) So now that I can tunnel in, I have a performance question:  Since 
 the mysql database server will be making all of its connections to 
 localhost is that a single connection rather than multiple?  Will I lose 
 database read concurrency?  If so, will either that or the SSH tunnels be 
 a 
 bottleneck and severely degrade my database performance?

>>>
>>> web2py has connection pooling. Each of connection from the pool will go 
>>> through the tunnel, concurrently up to the max number in the pool.
>>>

 2) SSH tends to be flaky and drop connections leaving a broken Web2py 
 app instance.  Any suggestions on best practices for handling that case?

>>>
>>>
>>> No. Sorry. If others have suggestions I would like to hear them.
>>>  
>>>

 It's too bad DAL doesn't support secure connections.  Encrypted 
 database connections are pretty standard nowadays and I see there are 
 python mysql connectors that do. Has anyone successfully swapped out the 
 one that ships with one of those?

>>>
>>> It would be easy to add. we will work in it.
>>>
>>
>> Thank you!  What is the process for this? Should I open an issue in 
>> github? 
>>
>>>  
>>>

 Cloud deployment is new to me so I really appreciate the help, and I 
 love using Web2py so thanks for making it and the ongoing support! 

 -- 
>> 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: Update database (multiple tables) with CSV in sequence

2017-10-23 Thread Dave S


On Saturday, October 21, 2017 at 2:25:47 PM UTC-7, Matthew J Watts wrote:
>
> Hi all
>
> I'm pretty new to web2py and web development in general. I'm really stuck 
> with something and haven't been able to find a tutorial which can help me 
> out etc. I was wondering if some one could point me in the right direction. 
>
> I have three tables. I want to upload a csv, and update each table in 
> sequence, so a newly generated primary key  can be passed to each 
> successive table. 
>
> (1)
> db.define_table('study_info',  
> Field('title'))
>  One 
> to many relationship
> (2)
> db.define_table('',
> Field('study_info_id', 'reference study_info'),
> Field('taxon_name', type = 'string', 
> comment='Classification of sample collected'))
>
> (3)
> db.define_table('sample_data',   
>  One to many relationship
> Field('Core_data_id', 'reference core_data'),
> Field('value', type = 'double'))
>
>
> So just to clarify , data gets entered into the first table,  the primary 
> key from table 1 is then passed to the foreign key of 2, then same again 
> for 2 to 3. 
>
> I managed to get the function working to update one table from a csv,  
>  Would i somehow modify this with a for loop to insert one line from the 
> csv at a time?
>
> def import_csv(): 
> from gluon.sqlhtml import form_factory
> form = SQLFORM.factory(Field('csvfile','upload',uploadfield=False))
> if form.process().accepted:
> db.study_info.import_from_csv_file(request.vars.csvfile.file)
> redirect(URL('index'))
> return dict(form=form) 
>
>
>
I see 3 possible ways to go:

Probably the cleanest is to do what import_from_csv_file() does:

 import csv  # it's in the standard Python library,
csv.reader(mycsvfile, etc)
# 
# for each line in the file:
lineno, line in enumerate(reader):
   validate line
   new_id = update_or_insert()
   # take a look at gluon/packages/dal/pydal/objects.py, lines 911-949 
   # to see how column headers are handled, etc
   handle_next_table_here(..., new_id,...)

The second way is similar, but puts more burden on you in preparing the 
insert

file = open(mycsvfile)
while not eof:
   line = readline(file)
   pieces = line.split(",")
   pieces = pieces.cleanup()
   # cleanup is a routine you supply to validate the format of the fields
   # the split and the cleanup may need to handle different delimiters 
("csv" may actually be tab-seperated, or space-seperated)
   # and if you have what looks like a delimiter in a quoted field, you 
have to deal with that, too.
   # but if your csv is controlled enough, you can do this without too much 
trouble.
   new_id = update_or_insert()
   handle_next_table_here(..., new_id,...)

The third choice is easy [1] but ugly, and may be slow:

file1 = open(mycsvflle, "rb")
while not eof:
   line = files1.readline()
   file2 = open(mytmpfile, "wb")
   file2.write(line)
   file2.close()
   import_from_csv_file(file2)
   newrow = db(query).select().last()
   handle_next_table_here(..., newrow.id,...)



[1] okay, not dramatically easier than the first 2

Good luck!

/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] confirm_registration form 'hardcoded' labels

2017-10-23 Thread Anthony
On Monday, October 23, 2017 at 1:24:44 PM UTC-4, tomasz bandura wrote:
>
> Thanks, 
>
> I will try to open an issue.
>
> Regarding button - label is translated...strange, I'll check it why :)
>

Oh yeah, don't worry about that -- submit_button ends up getting wrapped in 
T() by the SQLFORM code.

Anthony

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


Re: [web2py] confirm_registration form 'hardcoded' labels

2017-10-23 Thread tomasz bandura
Thanks,

I will try to open an issue.

Regarding button - label is translated...strange, I'll check it why :)


T.

2017-10-23 19:09 GMT+02:00 Anthony :

> Feel free to open an issue or submit a pull request. Note, looks like the
> submit button label is hard coded as well.
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/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] confirm_registration form 'hardcoded' labels

2017-10-23 Thread Anthony
Feel free to open an issue or submit a pull request. Note, looks like the 
submit button label is hard coded as well.

Anthony

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


[web2py] confirm_registration form 'hardcoded' labels

2017-10-23 Thread tomasz bandura
Hello,

I have to provide translation for 'confirm registration form' and I noticed
different behaviour of first_name and last_name labels ( compared to
'password' fields).

So I can only provide translation for Password and Confirm Password labels.
In the *gluon.tools.py * ( line 3373,3376 ) labels
for first and last names are 'hardcoded'.

What is a reason of that solution and/or how can I fix it in my code ( How
to set correct labels)? Not jquery solution please :)


I think labels should be set to

first_name > label=self.messages.label_first_name (line 3373)
last_name > label=self.messages.label_last_name (line 3379)

Regards
Tom

-- 
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 can i change background picture of web2py site

2017-10-23 Thread Anthony
Have you tried doing a force refresh in the browser?

On Monday, October 23, 2017 at 11:00:15 AM UTC-4, Dan Carroll wrote:
>
> It is not that easy. I replace the background.jpg with another image and 
> the old image replaces my new image. Over and over. Very frustrating.
>
>
> On Wednesday, June 22, 2016 at 2:56:21 PM UTC-4, Dave S wrote:
>>
>>
>>
>> On Wednesday, June 22, 2016 at 10:23:56 AM UTC-7, Filip Bogdanovski wrote:
>>>
>>> Title
>>
>>
>>
>> You have 2 easy choices for the standard bootstrap-styled apps (like the 
>> welcome app):  replace yourapp/static/images/background.jpg with your 
>> desired background, or tweak yourapp/static/css/web2py-bootstrap3.css; line 
>> 107 is the settings for the background.
>>
>> In the stupid.css apps, like the examples app, I'm not sure a background 
>> is set, but you could probably add one in layout.html or in an additional 
>> css file (look at examples.css, although it is set up to display the web2py 
>> book without a background image).
>>
>> /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: How can i change background picture of web2py site

2017-10-23 Thread Dan Carroll
It is not that easy. I replace the background.jpg with another image and 
the old image replaces my new image. Over and over. Very frustrating.


On Wednesday, June 22, 2016 at 2:56:21 PM UTC-4, Dave S wrote:
>
>
>
> On Wednesday, June 22, 2016 at 10:23:56 AM UTC-7, Filip Bogdanovski wrote:
>>
>> Title
>
>
>
> You have 2 easy choices for the standard bootstrap-styled apps (like the 
> welcome app):  replace yourapp/static/images/background.jpg with your 
> desired background, or tweak yourapp/static/css/web2py-bootstrap3.css; line 
> 107 is the settings for the background.
>
> In the stupid.css apps, like the examples app, I'm not sure a background 
> is set, but you could probably add one in layout.html or in an additional 
> css file (look at examples.css, although it is set up to display the web2py 
> book without a background image).
>
> /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: LOAD() component redirect destroys session

2017-10-23 Thread Anthony
Hard to say without seeing your code. Nothing about a redirect affects the 
session, so your code must be making the changes.

Anthony

On Monday, October 23, 2017 at 10:13:44 AM UTC-4, Auden RovelleQuartz wrote:
>
> if I am on page_one that has a LOAD() component on it that runs say every 
> 5 seconds (timeout = 5000)
>
> and if while on that page I have
>
> session.parameter_one = some value
> session.parameter_two = some value
> session.parameter_three = some value
>
> if based on certain conditions the component redirects to page_two, then I 
> notice that
>
> session.parameter_one = None
> session.parameter_two = None
> session.parameter_three = None
>
> is there some way to redirect to a page from a component where all session 
> variables are kept intact?
>

-- 
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: migrating database and updating it

2017-10-23 Thread Anthony
It's not quite clear exactly what you have copied and/or changed, so hard 
to say what you need to do. But in general, if you want to update your code 
and have the production database migrated to match the new code, you should 
copy everything *except* the contents of the /databases directory (leave 
the production /databases directory untouched). Then after the code has 
been copied, make sure migrations are enabled, and on the first request, 
the production database will be migrated to match the new models. Sounds 
like you didn't follow that process and things have gotten out of sync.

Anthony

On Monday, October 23, 2017 at 6:54:22 AM UTC-4, Yebach wrote:
>
> Hello
>
> So as said I copied the whole app directory to my new server, also 
> restored my database on postgres.  
> First my settings for migrate and false_migrate are set to False and 
> immediately I get an error: relation of table auth_user already exists. I 
> set the migrate for this table (auth.define_tables(username=False, 
> signature=False, *migrate = False*) ) to False, then I get an error 
> relation of table scheduler already exists. So i set migrate = False for 
> that table also in my scheduler.py file. And afterwards the app itself 
> works. 
>
> I already find this kind of behavior strange since I copied "stuff" and 
> things don't work --> I would appreciate guidance for further migrations 
> already here. I need to keep my auth_user table data etc.
>
> Now I want to use my new db.py file and if I set migrate to True - I get 
> an error immediately that table xyz already exists. 
>
> Any suggestions 
>
> 2017-10-18 16:48 GMT+02:00 Anthony:
>
>> On Wednesday, October 18, 2017 at 10:37:17 AM UTC-4, Yebach wrote:
>>>
>>> I am trying to keep my production db with all its data but update the 
>>> structure with the new web2py db code
>>>
>>
>> Yes, then as noted below, just update the web2py code, make sure 
>> migrations are on, and do *not* touch the production /databases folder 
>> (the *.table files there provide a record of the current state of the 
>> production database, so web2py knows what migrations to run to make the 
>> database match the new model code).
>>
>> Anthony
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/opmKbIW-7LA/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.
>>
>
>
>
> -- 
> Lep pozdrav 
>
> Vid Ogris
>
>
>

-- 
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] LOAD() component redirect destroys session

2017-10-23 Thread Auden RovelleQuartz
if I am on page_one that has a LOAD() component on it that runs say every 5 
seconds (timeout = 5000)

and if while on that page I have

session.parameter_one = some value
session.parameter_two = some value
session.parameter_three = some value

if based on certain conditions the component redirects to page_two, then I 
notice that

session.parameter_one = None
session.parameter_two = None
session.parameter_three = None

is there some way to redirect to a page from a component where all session 
variables are kept intact?

-- 
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: migrating database and updating it

2017-10-23 Thread Vid Ogris
Hello

So as said I copied the whole app directory to my new server, also restored
my database on postgres.
First my settings for migrate and false_migrate are set to False and
immediately I get an error: relation of table auth_user already exists. I
set the migrate for this table (auth.define_tables(username=False,
signature=False, *migrate = False*) ) to False, then I get an error
relation of table scheduler already exists. So i set migrate = False for
that table also in my scheduler.py file. And afterwards the app itself
works.

I already find this kind of behavior strange since I copied "stuff" and
things don't work --> I would appreciate guidance for further migrations
already here. I need to keep my auth_user table data etc.

Now I want to use my new db.py file and if I set migrate to True - I get an
error immediately that table xyz already exists.

Any suggestions

2017-10-18 16:48 GMT+02:00 Anthony :

> On Wednesday, October 18, 2017 at 10:37:17 AM UTC-4, Yebach wrote:
>>
>> I am trying to keep my production db with all its data but update the
>> structure with the new web2py db code
>>
>
> Yes, then as noted below, just update the web2py code, make sure
> migrations are on, and do *not* touch the production /databases folder
> (the *.table files there provide a record of the current state of the
> production database, so web2py knows what migrations to run to make the
> database match the new model code).
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/opmKbIW-7LA/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.
>



-- 
Lep pozdrav

Vid Ogris

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

2017-10-23 Thread Kiran Subbaraman
Yes, I suggested the OP configure one for their specific app, using the 
example app's config as a template.
Need not configure this in the code, for every request ... as they are 
doing so now.



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

On 23-Oct-17 3:01 PM, Dave S wrote:



On Sunday, October 22, 2017 at 9:19:02 PM UTC-7, Kiran Subbaraman wrote:

configuring the logger for every thread (`current.logger =
logger`), and this seems unnecessary.
Take a look at this logging configuration:

https://github.com/web2py/web2py/blob/0d646fa5e7c731cb5c392adf6a885351e77e4903/examples/logging.example.conf

,
and set one up for your app.


Doesn't the OP already have that file as part of the web2py 
distribution?  It ships in the example app, no?


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


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

2017-10-23 Thread Dave S


On Sunday, October 22, 2017 at 9:19:02 PM UTC-7, Kiran Subbaraman wrote:
>
> configuring the logger for every thread (`current.logger = logger`), and 
> this seems unnecessary.
> Take a look at this logging configuration: 
> https://github.com/web2py/web2py/blob/0d646fa5e7c731cb5c392adf6a885351e77e4903/examples/logging.example.conf,
>  
> and set one up for your app. 
>
>
Doesn't the OP already have that file as part of the web2py distribution?  
It ships in the example app, no?

/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: Custom maintenance message

2017-10-23 Thread Dave S


On Saturday, October 21, 2017 at 12:17:53 AM UTC-7, 黄祥 wrote:
>
> learn from anthony respond in stackoverflow it is in routes.py in web2py 
> root folder not in app root folder (tested using routes.py in app root 
> folder is not work, no error occured but the result is not expected)
>

I'm not sure that that is what Anthony said in the SO reply.

But as I understand it, the app/routes.py doesn't work if you don't have 
the base routes.py set up.
 

> *e.g. *(replace web2pyapp with your web2py application name)
> cd ~/web2py/
> cp examples/routes.parametric.example.py ./routes.py
> echo "routes_onerror = [('web2pyapp/404', '/web2pyapp/static/404.html') ]" 
> >> routes.py
>
> you can choose either : 
> routes.parametric.example.py
> routes.patterns.example.py
> to put in web2py root folder tested both work fine
>
> *ref:*
>
> https://stackoverflow.com/questions/17351528/web2py-custom-404-page-when-i-raise-the-404-myself?noredirect=1
>
> thanks and best regards,
> stifan
>

/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] Re: maybe too many db connections todb on pythonanywhere

2017-10-23 Thread Manuele Pesenti

Thanks Alex,

that's what I get from the db engine about my maximum number of connections:

psql (9.4.11, server 9.4beta3)
Type "help" for help.
postgres=# SHOW max_connections;
 max_connections
-
 20
(1 row)

reading the suggested wiki page I found this: "PostgreSQL on good 
hardware can support *a few hundred connections*. If you want to have 
thousands instead..." so it seams something can be done on the side of 
the db configuration... if permitted from the service (maybe paying 
something more).


Cheers

    Manuele


On 21/10/2017 00:20, Alex Glaros wrote:
there are a lot of fixes if search on your error string, plus 
max_connections parm info is at 
Postgres https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server


what is your max_connections set to now?

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.


--
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] Open a form (form=SQLFORM(db.marks)) for a selected person by clicking on a link of their name

2017-10-23 Thread mostwanted
Thanks alot Javier, it worked

On Sunday, October 22, 2017 at 4:16:57 PM UTC+2, Javier Pepe wrote:
>
> Hi 
>
> You can fill the record before SQLFORM
>
> def marks_entry():
> stu=db.student(request.args(0))
>
> *db.marks.students.default = stu.id *
> form=SQLFORM(db.marks)
> return locals();
>
> 2017-10-22 8:59 GMT-03:00 mostwanted :
>
>> Hi guys, i need help, I'm creating a simple results management system for 
>> a school and I've hit a stumbling block, what i wanna do is be able to open 
>> a form to make detail entries of a specific individual and this is how i 
>> want to do it, i wanna click on the specific individual's name and have 
>> that form open up with the name of that person pre-selected so i don't have 
>> to go through a large list of too many students looking for one student & 
>> have other fields empty and all i have to do is fill up those fields, 
>> fields like marks for the subjects. PLEASE HELP, I'M REALLY STUCK!
>>
>> My application is straight forward and to the point and so is its code:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *MODELSdb.define_table('student_class',
>> Field('class_name', requires=IS_NOT_EMPTY()),
>> Field('teacher', 'reference teacher'),
>> format='%(class_name)s')db.define_table('student',
>> Field('surname', requires=IS_NOT_EMPTY()),Field('name', 
>> requires=IS_NOT_EMPTY()),Field('photo', 'upload', 
>> requires=IS_NOT_EMPTY()),Field('class_name', 'reference 
>> student_class'),Field('dob', 'date', 
>> requires=IS_NOT_EMPTY()),
>> format='%(surname)s')db.define_table('subject',
>> Field('subject_name', requires=IS_NOT_EMPTY()),
>> format='%(subject_name)s')#I WANT THIS TABLE TO BE OPEN WHEN I CLICK ON A 
>> NAME BUT WITH THAT NAME AND PRE-SELECTED WITH ONLY SOME FIELDS LEFT EMPTY 
>> SO I DONT #HAVE TO GO THROUGH A LIST OF 100 LOOKING FOR ONE 
>> STUDENT.db.define_table('marks',Field('student', 'reference 
>> student'),Field('subject', 'reference 
>> subject'),Field('term', 
>> requires=IS_NOT_EMPTY()),Field('marks', 'integer', 
>> requires=IS_NOT_EMPTY()),Field('total', 'integer', 
>> requires=IS_NOT_EMPTY()),
>> Field('comments',type='text',requires=IS_NOT_EMPTY()),   
>> )CONTROLLERdef student_class():
>> classes=db.student_class(request.args(0))
>> student=db(db.student.class_name==classes.id 
>> ).select(orderby=db.student.surname)
>> head=db(db.letter_head).select(db.letter_head.ALL)return 
>> locals()VIEWCLASS: 
>> {{=classes.class_name}}> style="margin-left: 15px;">SURNAMES (A-E){{letters=['A', 'B', 
>> 'C', 'D', 'E', 'F']for stu in student:if stu.surname[0] in 
>> letters:stu.surname}}{{=A('Report', _href=URL('genrate_report', 
>> args=stu.id ))}} | > class="name">{{=stu.surname}} | {{=A('Marks', 
>> _href=URL('marks_entry', args=stu.id ))}}> />{{pass}}{{pass}}CONTROLLER*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *#I DO NOT KNOW WHAT TO ENTER IN THE BELOW FUNCTION TO MAKE IT DO WHAT I 
>> WANT IT TO DOdef marks_entry():form=SQLFORM(db.marks)return 
>> locals();VIEW{{extend 'layout.html'}}{{=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+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.