[web2py] Re: Push Notifications

2016-11-08 Thread Dave S


On Tuesday, November 8, 2016 at 4:45:48 AM UTC-8, Michael Beller wrote:
>
> I've been thinking about trying https://pusher.com/
>
>
They use servers running on an Amazon cluster?

/dps

 

>
> On Wednesday, November 2, 2016 at 6:32:54 PM UTC-4, David wrote:
>>
>> Hello, 
>>
>> My website allows users to send messages to one another; however, the 
>> only way to see their new messages is to refresh the page. Is there any way 
>> to notify the user via any method? 
>>
>> Thanks for your time
>>
>>

-- 
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: Push Notifications

2016-11-08 Thread Dave S


On Wednesday, November 2, 2016 at 7:37:52 PM UTC-7, Anthony wrote:
>
> [...] You can also use various realtime messaging services (e.g., Fanout 
> ), or something like Pushpin  
> (an open source proxy server used by Fanout), which is probably a bit more 
> robust and full-featured than websocket_messaging.py.
>
>
Pushpin looks pretty easy to set up.  For the client side, they seem to 
recommend the Pollymer ajax library.

/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] About web2py_component and redirect

2016-11-08 Thread Marco Mansilla
Hi, since my previous email hasn't got any response, I'm still trying
to find a solution to my problem.

The problem is this, I have a form loaded via ajax into a modal, so
far, so good, it gets called for creating a new form as well as
edition, with SQLFORM in the respective controller, but when I fill the
data for new record or modify existing records, data never gets to the
database.

So, fixed it partially with web2py_component in the view, the web2py
component calls the form in the modal-body, and a few lines of js
toggle the modal, in this case the info is submited, but the modal
doesn't close and I would like to know if there's some way to catch the
web2py_component after de post event.

My bad previous email wasn't specifically web2py, but since I'm trying
to find out a solution with a web2py component I would really
appreciate some help.

PS: I'm calling web2py_component like this

  

thanks in advance.

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


[web2py] Re: Memory leak in standalone DAL

2016-11-08 Thread Sukhmeet Toor
Hi Massimo,

Thanks for looking into this. I just ran a few tests and I can confirm that 
the leak does repro on Mac OS X El Capitan (10.11.6 (15G1004)) with the 
latest version of pyDAL (16.9) and the HEAD and latest tags for web2py repo 
(https://github.com/web2py/web2py/releases). The leak did not repro from 
the last pypi version of web2py (2.1.1). I ran the program I listed in 
PyCharm on Mac OSX and watched the memory usage using htop installed on the 
Mac using Homebrew.

Here are the detailed results:
1. pyDAL 16.9

from pydal import DAL

def open_close_dal():
   sql = DAL()
   sql.close()

if __name__ == '__main__':
   while True:
  open_close_dal()


Memory usage at ~4 mins: 193M 
(https://www.dropbox.com/s/vj5v6hqya4mot2v/Screenshot%202016-11-08%2011.43.28.png?dl=0)
Memory usage at ~11 mins: 432M 
(https://www.dropbox.com/s/hac3monmy134b8f/Screenshot%202016-11-08%2011.50.51.png?dl=0)

2. web2py 2.1.1 (pip install web2py==2.1.1)

from gluon import DAL

def open_close_dal():
   sql = DAL()
   sql.close()

if __name__ == '__main__':
   while True:
  open_close_dal()


Memory usage at ~5 mins: 16.7M 
(https://www.dropbox.com/s/yjy8vv7fy7i79b0/Screenshot%202016-11-08%2012.14.52.png?dl=0)
Memory usage at ~11 mins: 16.7M 
(https://www.dropbox.com/s/49laoi3tk74qhvp/Screenshot%202016-11-08%2012.21.32.png?dl=0)

3. web2py cloned @latest tag from https://github.com/web2py/web2py.git and 
copied the gluon directory to my project in PyCharm.

from gluon import DAL

def open_close_dal():
   sql = DAL()
   sql.close()

if __name__ == '__main__':
   while True:
  open_close_dal()


Memory usage at ~4 mins: 187M 
(https://www.dropbox.com/s/5hx01xve1mpemg5/Screenshot%202016-11-08%2012.32.54.png?dl=0)
Memory usage at ~11 mins: 398M 
(https://www.dropbox.com/s/wcnpz15cor4g698/Screenshot%202016-11-08%2012.40.32.png?dl=0)

Thanks,
Sukhmeet



On Monday, November 7, 2016 at 5:52:17 PM UTC-8, Massimo Di Pierro wrote:
>
> I run your code on a Mac and I was unable to reproduce the leak. I invite 
> others to try with different OSes and DAL version. It will help debug it.
>
> On Monday, 7 November 2016 19:48:35 UTC-6, Massimo Di Pierro wrote:
>>
>> Thank you for your help. We will investigate
>> Any chance you can try if the leak exists with the DAL in web2py stable?
>>
>> On Friday, 4 November 2016 21:34:52 UTC-5, Sukhmeet Toor wrote:
>>>
>>> Hi web2py-users,
>>>
>>> I have an application that runs on CherryPy (v8.1.2) on Ubuntu (14.04.5 
>>> LTS) and python 2.7.6. I use standalone pyDAL (v16.09) to connect to my 
>>> MySQL DB on AWS RDS. I'm seeing a constant memory leak on my servers which 
>>> causes the process to use up 100% of RAM in a few hours and eventual die a 
>>> painful death (no SWAP enabled; enabling SWAP pushes back certain death a 
>>> little). 
>>>
>>> I have managed to reproduce the leak with a very small loop that 
>>> repeatedly opens and closes the DAL object. I confirmed that memory 
>>> continues to grow using htop and will eventually end up using 100% of RAM. 
>>> I thought it was an MySQL adapter specific problem but I was able to repro 
>>> it with the default sqlite adapter as well. 
>>>
>>> from pydal import DAL
>>>
>>> def open_close_dal():
>>>sql = DAL()
>>>sql.close()
>>>
>>> if __name__ == '__main__':
>>>while True:
>>>   open_close_dal()
>>>
>>>
>>> I read some really old threads on this issue that suggested calling 
>>> sql._adapter.close() or sql._adapter.close_all_instances() or del sql but 
>>> it doesn't seem to make a difference. I've tried tracking down the memory 
>>> leak and managed to confirm that it is the guts of the DAL that are 
>>> leaking. One iteration of the loop, with pympler.tracker enabled reports 
>>> these objects created:
>>>
>>>
>>>types |   # objects |   total size
>>>  | === | 
>>> dict | 672 |423.38 KB
>>> list |3525 |354.35 KB
>>>  str |2851 |162.49 KB
>>>  >> code | 585 | 73.12 KB
>>>   >> >> type |  16 | 14.12 KB
>>>   >>tuple | 168 | 12.85 KB
>>>   >>  weakref |  89 |  7.65 KB
>>>  int | 258 |  6.05 KB
>>>  >>  function (wrap) |  25 |  2.93 KB
>>>
>>>
>>> Is this a known issue? I've been pulling out my hair with this for a few 
>>> days now and would love any insight into it. 
>>>
>>>
>>> Thanks in advance,
>>>
>>> Sukhmeet
>>>
>>>
>>> p.s. Older threads on this topic, which no solution that worked for me: 
>>>
>>> https://groups.g

[web2py] Re: Copy and insert a row in a database

2016-11-08 Thread Anthony

>
> Here is some code:
>
> def copy():
> import os
> a = db.name(db.name.id== request.args(0))
> filepath = os.path.join(request.folder, 'uploads', a.file)
> stream = open(filepath, 'rb')
> db.name.insert(title= '%s_copy' % (a.title),
> file_up = db.name.file.store(stream, filepath
> ),
>
>
The second argument to .store() should be the original filename (which will 
then be encoded again), not a full file path. To get the original filename, 
use the .retrieve() method instead of manually constructing the file path 
and opening the file:

filename, stream = db.name.file.retrieve(a.file)
db.name.insert(..., file=db.name.file.store(stream, filename))

Also, your use of a.file implies the upload field is named "file", but in 
your insert code, you use "file_up" -- not sure which is correct.

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: web2py with DB2/Os400

2016-11-08 Thread António Ramos
solved...
http://ochiba77.blogspot.pt/2011/09/how-to-connect-db2-with-python-pyodbc.html

2016-11-08 15:28 GMT+00:00 António Ramos :

> Any guidelines working with os400/db2 ?
> regards
>

-- 
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] DAL with db2 on ISeries/OS400 table names converted to AUTH_0000x

2016-11-08 Thread António Ramos
Hello just found that auth_membership and auth_permissions are created as
AUTH_1 and AUTH_2

Those who know a litle of working with AS400/db2 know that table names are
max 10 char long.

So i think we have a problem...

Regards
António

-- 
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: Non-users getting permissions by setting auth.settings.everybody_group_id?

2016-11-08 Thread Anthony
On Monday, November 7, 2016 at 8:37:43 AM UTC-5, Horst Horst wrote:
>
> Thanks for the explanation, Anthony! It seems I had different expectations 
> regarding the definition of "everybody", but I guess either way makes sense.
>

In this context "everybody" means all registered users. What else would it 
mean?

-- 
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] web2py with DB2/Os400

2016-11-08 Thread António Ramos
Any guidelines working with os400/db2 ?
regards

-- 
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] Copy and insert a row in a database

2016-11-08 Thread Simon Andersson
Hi guys, I'm making a function to copy and insert a row of a database.

I want to copy and rename a file but the automatic b16 renaming becomes too 
long and breaks when you make a copy of a copy.

It also breaks some of my later processing of the file.

Here is some code:

def copy():
import os
a = db.name(db.name.id== request.args(0))
filepath = os.path.join(request.folder, 'uploads', a.file)
stream = open(filepath, 'rb')
db.name.insert(title= '%s_copy' % (a.title),
file_up = db.name.file.store(stream, filepath),

-- 
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: data processing conditional on form input

2016-11-08 Thread Simon Andersson
Solution was: 

def processing():
if db.dbname(db.dbname.id == request.args(0)).file == 'file1':
pathDir = /path/to/file1
else:
pathDir = /path/to/file2

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

2016-11-08 Thread Michael Beller
The online web2py book is a great place to start:
http://web2py.com/book

Web2py will "automatically" generate a form (with dropdowns, radio buttons, 
etc.) and the form field validation based on the database model (along with 
the create, read, and edit forms).

The forms chapter I think provides everything you need:
http://web2py.com/books/default/chapter/29/07/forms-and-validators


On Monday, November 7, 2016 at 8:46:06 PM UTC-5, Tom Schuerlein wrote:
>
> I am new to Web2Pyl. I am looking for a help building a custom form. 
>  Specifically how to pass db fields to the HTML View when building the 
> code.  I've been looking for a tutorial on building custom forms with no 
> luck.  I need to be able to have several input fields on one row; with a 
> mixture of radio buttons, pull downs and text fields.  Any direction would 
> be greatly appreciated. 
>

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


[web2py] Re: Push Notifications

2016-11-08 Thread Michael Beller
I've been thinking about trying https://pusher.com/


On Wednesday, November 2, 2016 at 6:32:54 PM UTC-4, David wrote:
>
> Hello, 
>
> My website allows users to send messages to one another; however, the only 
> way to see their new messages is to refresh the page. Is there any way to 
> notify the user via any method? 
>
> Thanks for your time
>
>

-- 
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: strange behavior of $@ bash parameter expansion

2016-11-08 Thread Niphlod
the error you've seen has nothing to do with either $@ or "$@". it just 
signalled that you had a migration error. once you deleted both metadata 
and the underlying tables, everything was fixed.

On Monday, November 7, 2016 at 6:28:22 PM UTC+1, Mirek Zvolský wrote:
>
> I use Debian (testing), Postgres 9.4,
> and Web2py 2.14.6 (with current trunk is problem the same)
>
> I use such command (assigned to an alias) for long time to start my 
> application
> python web2py.py -K codex2020 -X $@
>
> Today I received strange behaviour, errors like
> web2py.scheduler TICKER: error assigning tasks
> or such something (with no effect if I have deleted scheduler_* tables and 
> their databases/ metadata earlier)
> starting scheduler for "codex2020"... 
> Currently running 1 scheduler processes 
> Traceback (most recent call last): 
>  File "/home/mirek/mz/web2py/gluon/restricted.py", line 227, in restricted 
>exec ccode in environment 
>  File "applications/codex2020/models/scheduler.py", line 80, in  
>scheduler = Scheduler(db) 
>  File "/home/mirek/mz/web2py/gluon/scheduler.py", line 567, in __init__ 
>self.define_tables(db, migrate=migrate) 
>  File "/home/mirek/mz/web2py/gluon/scheduler.py", line 659, in 
> define_tables 
>migrate=self.__get_migrate('scheduler_worker', migrate) 
>  File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/base.py", line 834, 
> in define_table 
>table = self.lazy_define_table(tablename,*fields,**args) 
>  File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/base.py", line 873, 
> in lazy_define_table 
>polymodel=polymodel) 
>  File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/base.py", 
> line 510, in create_table 
>fake_migrate=fake_migrate 
>  File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/base.py", 
> line 623, in migrate_table 
>self.execute(sub_query) 
>  File 
> "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
> 362, in execute 
>return BaseAdapter.execute(self, *a, **b) 
>  File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/base.py", 
> line 1388, in execute 
>return self.log_execute(*a, **b) 
>  File "/home/mirek/mz/web2py/gluon/packages/dal/pydal/adapters/base.py", 
> line 1382, in log_execute 
>ret = self.get_cursor().execute(command, *a[1:], **b) 
> ProgrammingError: column "worker_stats__tmp" is of type json but 
> expression is of type text 
> LINE 1: UPDATE scheduler_worker SET worker_stats__tmp=worker_stats; 
>  ^ 
> HINT:  You will need to rewrite or cast the expression.
>
> Then I decided then if I run without $@, all will start well:
> python web2py.py -K codex2020 -X
>
> After testing of everything I went back to:
> python web2py.py -K codex2020 -X $@
> or
> python web2py.py -K codex2020 -X "$@"
>
> and I have now no more the previous problem. All works well.
>
> Has somebody any idea about the reason of problems
> and can you explain me the difference between $@ and "$@". Which one is 
> more safe to use? Is there a difference?
>
> Thanks...
>

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


Re: [web2py] Re: pydal bug or odd behaviour

2016-11-08 Thread Manuele Pesenti
Il 08/11/16 02:55, Massimo Di Pierro ha scritto:
> Please open a pydal issue.

Ok done https://github.com/web2py/pydal/issues/428

Thank Massimo :)

M.

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