[web2py] Re: admin IDE for general use

2018-11-18 Thread Val K
Glad to help you, Lucas!
 $35 for the server with pg is really cool!

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


[web2py] Re: Cannot see web2py applications behind apache, only see Apache default page

2018-11-18 Thread 黄祥
there's a lot of discussion in this forum about this, that apache is not 
recommended, there are another solution for that:
- pls use another web server, e.g. nginx, gunicorn, etc
- use apache as an proxy to 'another' web server

best regards,
stifan

-- 
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: Web server with support for chunked transfer encoding

2018-11-18 Thread icodk
Hi
 I Trier
data = request.body.read()
But it returned nothing
You can easily test it with curl and Chunked transfer encoding header
If it works for you let me know
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: Dynamic url masking with routes.py?

2018-11-18 Thread Martin Weissenboeck
ok, thank you.
I'll try it.
Regards Martin

Am So., 18. Nov. 2018 um 19:50 Uhr schrieb Massimo Di Pierro <
massimo.dipie...@gmail.com>:

> If I assume you have full control of both domains, I would use nginx to map
>
> domain1.com/$anything ->
> domain2/yourapp/yourcontroller/somefunction/$anything
>
> and then handle the mapping into somefunction.
>
>
> On Saturday, 3 November 2018 13:17:56 UTC-7, mweissen wrote:
>>
>>
>> I need a dynamic url masking
>>
>> (1) The user calls www.domain1.com/abcd
>> (2) abcd will be translated by a table lookup to xyz
>> (3) Now www.domain2.com/xyz should be called.
>> (4) The user sees the content of www.domain2.com/xyz, but with the
>> address www.domain1.com/abcd
>>
>> Is it possible to use routes.py for this purpose? Or someting else?
>>
>> Regards, Martin
>>
>>
>>
>>
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


[web2py] Re: Is it possible to share cache between two differente web2py applications?

2018-11-18 Thread Massimo Di Pierro
approved! :-)

On Wednesday, 14 November 2018 08:02:07 UTC-8, Lisandro wrote:
>
> I've created a pull request to achieve this:
> https://github.com/web2py/web2py/pull/2055
>
> If it's not accepted (which is totally ok with me), I would like to know 
> if I have some other alternative.
> Thanks!
>
> El lunes, 23 de enero de 2017, 17:29:22 (UTC-3), Lisandro escribió:
>>
>> I'm using RedisCache, and I've seen that web2py adds a prefix to all the 
>> keys I store in the cache.
>> For example, if I have an application called "master" and I do this:
>>
>> config = cache.redis('config', lambda: initialize_config(), time_expire=
>> 999)
>>
>> ... then the actual key used to store the data is "w2p:master:config"
>>
>> But, what about if I have two applications that need to share the config?
>> How can I tell web2py to use the same cache prefix for two specific 
>> applications?
>>
>>

-- 
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: Web server with support for chunked transfer encoding

2018-11-18 Thread Massimo Di Pierro
I think rocket works fine for this. It is just that you may uploading the 
content in the body and not in a variable therefore web2py does not know 
how to parse it. try look into

data = request.body.read()

On Thursday, 8 November 2018 08:18:41 UTC-8, icodk wrote:
>
> Tried with Rocket  No error but request.args and request.vars are empty
> The client sends:
>
> POST /controller/statdata HTTP/1.1
> Host: myserver.com:8082
> Content-Type:application/json
> Transfer-Encoding: chunked
>
> and then sends the chunked data
>
> Rokets log shows:
> 192.168.1.3, 2018-11-08 16:46:57, POST, /controller/statdata, HTTP/1.1, 
> 200, 0.017997
>
> Any idea on the subject are welcome
>
>
>
>
>
>

-- 
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: Dynamic url masking with routes.py?

2018-11-18 Thread Massimo Di Pierro
If I assume you have full control of both domains, I would use nginx to map

domain1.com/$anything -> 
domain2/yourapp/yourcontroller/somefunction/$anything

and then handle the mapping into somefunction.


On Saturday, 3 November 2018 13:17:56 UTC-7, mweissen wrote:
>
>
> I need a dynamic url masking
>
> (1) The user calls www.domain1.com/abcd
> (2) abcd will be translated by a table lookup to xyz
> (3) Now www.domain2.com/xyz should be called.
> (4) The user sees the content of www.domain2.com/xyz, but with the 
> address www.domain1.com/abcd
>
> Is it possible to use routes.py for this purpose? Or someting else?
>
> Regards, Martin
>
>
>
>
>
>

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


[web2py] PostgreSQL log flooded with "could not receive data from client: Connection reset by peer" messages;

2018-11-18 Thread Tadas U
Web2py version: Version 2.14.6-stable+timestamp.2016.05.10.00.21.47

AFAIK, the scheduler is responsible, e.x.:

SETUP (e.x.):

scheduler.queue_task(
'test__task_insert', application_name='app', repeats=0, period=60, 
timeout=3600, retry_failed=-1)

def task_insert():
db.table.insert(title='abc')
db.commit()
# db.close()  -- same problem, doesn't matter

scheduler = Scheduler(db, {
'test__task_insert': task_insert
})


log output, when taks runs:

2018-11-13 13:14:11 EET LOG:  duration: 0.029 ms  statement: BEGIN
2018-11-13 13:14:11 EET LOG:  duration: 0.340 ms  statement: SELECT  
scheduler_worker.id, scheduler_worker.worker_name, 
scheduler_worker.first_heartbeat, scheduler_worker.last_heartbeat, 
scheduler_worker.status, scheduler_worker.is_ticker, 
scheduler_worker.group_names, scheduler_worker.worker_stats FROM 
scheduler_worker WHERE (scheduler_worker.worker_name = 'web2py#8228');
2018-11-13 13:14:11 EET LOG:  duration: 0.305 ms  statement: UPDATE 
scheduler_worker SET status='ACTIVE',last_heartbeat='2018-11-13 
13:14:11',worker_stats='{"status": "RUNNING", "errors": 0, "workers": 1, 
"queue": 1, "empty_runs": 0, "sleep": 3, "distribution": {"main": 
{"workers": [{"c": 1, "name": "web2py#8228"}]}}, "total": 1}' WHERE 
(scheduler_worker.worker_name = 'web2py#8228');
2018-11-13 13:14:11 EET LOG:  duration: 1.890 ms  statement: COMMIT
2018-11-13 13:14:11 EET LOG:  duration: 0.067 ms  statement: BEGIN
2018-11-13 13:14:11 EET LOG:  duration: 0.046 ms  statement: SET 
CLIENT_ENCODING TO 'UTF8'
2018-11-13 13:14:11 EET LOG:  duration: 0.020 ms  statement: SET 
standard_conforming_strings=on;
2018-11-13 13:14:11 EET LOG:  duration: 0.047 ms  statement: COMMIT
2018-11-13 13:14:12 EET LOG:  duration: 0.029 ms  statement: BEGIN
2018-11-13 13:14:12 EET LOG:  duration: 2.413 ms  statement: INSERT INTO 
table(title) VALUES ('abc');
2018-11-13 13:14:12 EET LOG:  duration: 2.594 ms  statement: COMMIT
2018-11-13 13:14:12 EET LOG:  could not receive data from client: 
Connection reset by peer
2018-11-13 13:14:12 EET LOG:  duration: 0.029 ms  statement: BEGIN
2018-11-13 13:14:12 EET LOG:  duration: 0.285 ms  statement: DELETE FROM 
scheduler_run WHERE (scheduler_run.id = 967703);
2018-11-13 13:14:12 EET LOG:  duration: 0.306 ms  statement: UPDATE 
scheduler_task SET status='QUEUED',next_run_time='2018-11-13 
13:15:11',times_run=93796,times_failed=0 WHERE (scheduler_task.id = 371);
2018-11-13 13:14:12 EET LOG:  duration: 2.426 ms  statement: COMMIT
2018-11-13 13:14:12 EET LOG:  duration: 0.024 ms  statement: BEGIN


PROBLEM:  "2018-11-13 13:14:12 EET LOG:  could not receive data from 
client: Connection reset by peer"
We have ~20 ish active schedulers, so the log gets flooded a lot, basically:

2018-11-13 09:21:00 EET LOG:  could not receive data from client: 
Connection reset by peer
2018-11-13 09:21:00 EET LOG:  could not receive data from client: 
Connection reset by peer
2018-11-13 09:21:00 EET LOG:  could not receive data from client: 
Connection reset by peer
2018-11-13 09:21:16 EET LOG:  could not receive data from client: 
Connection reset by peer
2018-11-13 09:21:46 EET LOG:  could not receive data from client: 
Connection reset by peer
2018-11-13 09:22:00 EET LOG:  could not receive data from client: 
Connection reset by peer
2018-11-13 09:22:00 EET LOG:  could not receive data from client: 
Connection reset by peer
2018-11-13 09:22:01 EET LOG:  could not receive data from client: 
Connection reset by peer

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


[web2py] Re: Problem with wsgihandler.py Apache/Python3

2018-11-18 Thread Dave
I'm having the same troubles after upgrading to python3 using Apache 
with libapache2-mod-wsgi-py3 4.5.17-1 on Ubuntu.

I did delete all session files, and I am using fresh source code of web2py 
(R-2.17.2).

I'm running several applications in web2py, and when i restart Apache they 
work for a while. Then at some point later, and I haven't figured out what 
initiates the problem, I am getting:

Traceback (most recent call last):
  File "/home/ubuntu/mnt/web2py/gluon/main.py", line 445, in wsgibase
serve_controller(request, response, session)
  File "/home/ubuntu/mnt/web2py/gluon/main.py", line 207, in 
serve_controller
raise HTTP(response.status, page, **response.headers)
gluon.http.HTTP: 200 OK
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "/home/ubuntu/mnt/web2py/gluon/main.py", line 472, in wsgibase
BaseAdapter.close_all_instances('commit')
  File "/home/ubuntu/mnt/web2py/gluon/packages/dal/pydal/connection.py", 
line 121, in close_all_instances
db._adapter.close(action)
  File "/home/ubuntu/mnt/web2py/gluon/packages/dal/pydal/connection.py", 
line 98, in close
if len(pool) < self.pool_size:
TypeError: '<' not supported between instances of 'int' and 'str'


In my apache error log I see this:

[Thu Nov 15 04:02:26.546712 2018] [wsgi:error] [pid 9117] [client 
XXX.XXX.XXX.AA:56599] Timeout when reading response headers from daemon 
process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
[Thu Nov 15 04:08:52.161152 2018] [wsgi:error] [pid 9111] [client 
XXX.XXX.XXX.AB:40713] Timeout when reading response headers from daemon 
process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
[Thu Nov 15 04:26:51.746340 2018] [wsgi:error] [pid 8081] [client 
XXX.XXX.XXX.AC:2960] Timeout when reading response headers from daemon 
process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
[Thu Nov 15 04:38:41.429260 2018] [wsgi:error] [pid 8081] [client 
XXX.XXX.XXX.AD:48360] Timeout when reading response headers from daemon 
process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
[Thu Nov 15 04:44:56.502509 2018] [wsgi:error] [pid 7466] [remote 
XXX.XXX.XXX.AE:7339] mod_wsgi (pid=7466): Exception occurred processing 
WSGI script '/home/ubuntu/mnt/web2py/wsgihandler.py'.
[Thu Nov 15 04:44:56.502575 2018] [wsgi:error] [pid 7466] [remote 
XXX.XXX.XXX.AE:7339] TypeError: sequence of byte string values expected, 
value of type str found
[Thu Nov 15 04:50:20.030220 2018] [wsgi:error] [pid 8081] [client 
XXX.XXX.XXX.AF:33766] Timeout when reading response headers from daemon 
process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
[Thu Nov 15 05:00:40.384970 2018] [ssl:warn] [pid 9665] AH01909: 
XXX.XXX.XXX.AG:443:0 server certificate does NOT include an ID which 
matches the server name
[Thu Nov 15 05:00:40.407686 2018] [ssl:warn] [pid 9667] AH01909: 
XXX.XXX.XXX.AG:443:0 server certificate does NOT include an ID which 
matches the server name
[Thu Nov 15 05:03:10.875058 2018] [wsgi:error] [pid 9668] [remote 
XXX.XXX.XXX.AF:34126] 
/home/ubuntu/mnt/web2py/gluon/contrib/pymysql/cursors.py:166: Warning: 
(3090, "Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be 
removed in a future release.")
[Thu Nov 15 05:03:10.875093 2018] [wsgi:error] [pid 9668] [remote 
XXX.XXX.XXX.AF:34126]   result = self._query(query)

Is it possibly related to this?:

stackoverflow: TypeError: sequence of byte string values expected, value of 
type str found 




On Saturday, 8 September 2018 12:22:49 UTC-7, Peter wrote:
>
> Try to remove all session files. I think that problem is in pickle which 
> is different in python 2 and python 3 (data type is not same in python 2 
> and python 3).
>
> Use fresh source code of web2py with your application. Don't start web2py 
> with python 3 after use with python 2. 
>

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


[web2py] Web2py 2.27.2 missing pg8000 driver for postgresql databases

2018-11-18 Thread jonathan . clark
Hi,

In the past I have successfully used driver pg8000 to access postgresql 
databases via the DAL. I have a live application now using web2py 2.16.1 
and it works fine. I'm just trying to deploy a new application, and by 
default I used the latest version of web2py i.e. 2.17.2 and it fails with 
message "RuntimeError: No driver of supported ones ('psycopg2',) is 
available". Has there been some change between 2.16.1 and 2.17.2 in the 
area of postgresql drivers? I can't see any information about it in the 
change log.

I'm a bit limited in what changes I can make because this is a shared 
hosting environment. For example I don't have access to the 
'build-essential' tools, and "pip install psycopg2" isn't working. The 
hosting service people are quite good about installing extra software when 
I need it, but it's a hassle to go through and takes time. Before I go that 
route, should I assume pg8000 has been removed from web2py in the latest 
version.

Thanks,
Jonathan

-- 
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] machine learning

2018-11-18 Thread Devyansh Bansal
i want to run machine learning code written in jupyter converted in .py on 
my website as a face login any 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] Cannot see web2py applications behind apache, only see Apache default page

2018-11-18 Thread heisterm
I am trying to deploy web2py on Ubuntu 16.04 behind Apache.

For that purpose, I have followed the deployment recipe 
, or more 
specifically the Apache setup 
 
and the mod_wsgi 
 
setup. In that recipe,
I only made the following modifications:


   - Based on this post 
   

 
   at stackoverflow, I have renamed the config file from 
   /etc/apache2/sites-available/web2py to 
   /etc/apache2/sites-available/web2py.conf
   - In that config file, I changed the paths for error logging from 
   /private/var/log/apache2/access.log to /var/log/apache2/access.log, 
   otherwise Apache would not restart
   - I tried to enable web2py using sudo a2ensite web2py.conf

When I try to visit my http://myserver.xy, I only get the Apache2 Ubuntu 
Default Page. When I try http://myserver.xy/web2py or 
http://myserver.xy/welcome, I am getting a Not Found error. Any ideas?

Thanks in advance for taking the time for this request - I am a total 
newbie in this field.

Kind regards,
Maik

-- 
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: admin IDE for general use

2018-11-18 Thread lucas
oh, and btw, I have the whole server running off of a $35 Raspberry Pi 3b+, 
with PostGreSQL 9, Web2Py 2.17.2, and Nginx.  I tricked the wifi of my 
institution to let the raspberry access and even though its a local 
address, students can access their code and view their results from 
whatever device in the classroom.  cool, right?

-- 
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: admin IDE for general use

2018-11-18 Thread lucas
alright, thank you for your help.  I've broken it down to its most basic 
level and its damn working.  I'll post the essentials here.  remember this 
is for a class to teach them the basics of programming.  yeah, fun 
students...

under the DAL I setup a simple table to store the code:
NE = IS_NOT_EMPTY()
db.define_table('code',
Field('input_datetime', 'datetime', writable=False, readable=False, 
requires=NE, default=datetime.datetime.now()),
Field('modified_datetime', 'datetime', writable=False, readable=False, 
requires=NE, default=datetime.datetime.now()),
Field('user_id', db.auth_user, requires=IS_IN_DB(db, db.auth_user.id, 
'%(last_name)s, 
%(first_name)s (%(id)s)'), default=(auth.user.id if auth.is_logged_in() else 
None), label='User', writable=False, readable=False),
Field('title', length="36", requires=NE, comment="title of the project 
code"),
Field('description', length="256", requires=NE, comment="description of 
the project code"),
Field('source_code', 'text'),
Field('share_code', 'boolean', default=('T' if auth.has_membership(
'Administrator') else 'F')),
format = '%(input_datetime)s')



under the controller, I have two functions:
@auth.requires_login()
def project():
response.title = T("Python Project")
pid = mcp.request_to_int(request.args[0], None)
if (pid is None):
pid = db.code.insert(share_code=(True if auth.has_membership(
'Administrator') else False))
redirect(URL(c="default", f="project", args=[pid]))
else:
sCode = db(db.code.id==pid).select().first()
if (sCode.user_id <> auth.user.id):
return dict(form="Error: User can only edit their own code.")
frm = SQLFORM(db.code, record=pid, showid=True)
"""
if auth.has_membership('Administrator'):
e = frm.element('input#code_share_code')
e.update(_checked="checked")
"""
return dict(form=frm)

@auth.requires_login()
def ajaxSaveProject():
#return "%s" % request.vars
id = mcp.request_to_int(request.vars.id, None)
title = request.vars.title
description = request.vars.description
source_code = request.vars.source_code.strip()
share_code = mcp.request_to_boolean(request.vars.share_code)
#return "%s" % locals()
try:
modified_datetime = datetime.datetime.now()
db(db.code.id==id).update(**locals())
except:
return False
return response.json(locals())


AND, finally, under the view, which is the most important:
{{extend 'layout.html'}}

{{block head}}




div#form { border: 0px solid red; background-color: #fff; }
table { width: 100%; }
td { margin: 0px; padding: 0px; line-height: 24pt; border: 0px solid 
gray; }
input[type=text] { margin: 1px 0px; padding: 1px 4px; }
input[name=title] { max-width: 160px; }
input[type=checkbox] { position: relative; margin: 2px; padding: 0px; }
button#save { height: 20px; font-size: 10pt; font-weight: bold; 
line-height: 6px; }


var editor;
jQuery(function() {
jQuery('button#save').click(function(obj) {
obj.preventDefault();
console.log('button clicked');
doClickSave();
});
});

function doClickSave() {
var data = editor.getValue();
//console.log(data);
jQuery.post("{{=URL(c="default", f="ajaxSaveProject")}}", { 'id':jQuery(
'p#pid').html(), 'title':jQuery('input#code_title').val(), 'description':
jQuery('input#code_description').val(), 'source_code':data, 'share_code':
jQuery('input#code_share_code').prop('checked')}).done(function(t) {
console.log(t);
jQuery('td#msg').html('saved: '+t.modified_datetime);
});
}

jQuery(document).ready(function() {
console.log('('+jQuery(window).width()+','+jQuery(window).height()+') 
jQuery.version: '+jQuery.fn.jquery);
//console.log(jQuery('nav').height()+' ___ '+jQuery('footer').height());
editor = CodeMirror.fromTextArea(document.getElementById("code_i"), {
lineNumbers: true,
mode: { name: 'python', version: 2, singleLineStringErrors: false, 
},
indentUnit: 4,
indentWithTabs: false,
tabSize: 4,
lineWrapping: true
});
CodeMirror.commands.save = function() { doClickSave(); };
//console.log(jQuery(window).height()+" ___ 
"+jQuery('div#form').offset().top+" ___ "+jQuery('div#form').height()+" ___ 
"+jQuery('footer').height());
editor.setSize(jQuery(window).width() - 36, jQuery(window).height() - (
jQuery('div#form').offset().top + jQuery('div#form').height()) - jQuery(
'footer').height() - 12);
});

{{end}}

{{=form.custom.begin}}



Project Title:{{=form.custom.widget.title
}}Share Code?{{=form.custom.widget.
share_code}}Save All
Description:{{=form.custom.
widget.description}}


{{=form.custom.dspval.id}}
{{=form.custom.dspval.
source_code.strip() if (form.custom.dspval.source_code is not None) else "# 
-*- coding: utf-8 -*-\nimport mcp\n\ndef index():\n\treturn BODY(\"testing 
1 2 3\")"}}
{{=form.custom.end}}

and 

[web2py] How to debug views?

2018-11-18 Thread Ivan Gazzola
I'm writing my code with Pycharm and I like testing my code and debug with 
breakpoints.
Is there a way to debug python code in views?
I can't figure out how to do that, I just check errors in admin interface :(

Thx

Ivan 

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