[web2py] Re: Intersection of rows

2018-02-06 Thread Dave S


On Tuesday, February 6, 2018 at 1:57:29 PM UTC-8, Dave S wrote:
>
> [...] 
>
I think this is on 2.14.6; I may be able to test newer web2py's tonight.  
> Am I doing something wrong, or was there a hiccup in intersection?
>
>
Downloading 2.16.1 and blindly copying my 2.14.6 copy to the new 
environment, I get

Traceback (most recent call last):
  File "C:\Users\Dave\web2py_win\web2py_win -2.16\web2py\gluon\restricted.py", 
line 219, in restricted
exec(ccode, environment)
  File "C:/Users/Dave/web2py_win/web2py_win 
-2.16/web2py/applications/shortcuts/controllers/default.py" 
, 
line 275, in 
  File "C:\Users\Dave\web2py_win\web2py_win -2.16\web2py\gluon\globals.py", 
line 419, in 
self._caller = lambda f: f()
  File "C:/Users/Dave/web2py_win/web2py_win 
-2.16/web2py/applications/shortcuts/controllers/default.py" 
, 
line 198, in fromto
runs1 = db((db.run.id == db.segment.partof) & segq1).select("run.id", 
"run.description", "run.distance","run.duration", orderby = 
db.run.id|db.run.duration, distinct=True)
  File "C:\Users\Dave\web2py_win\web2py_win 
-2.16\web2py\gluon\packages\dal\pydal\objects.py", line 2250, in select
return adapter.select(self.query, fields, attributes)
  File "C:\Users\Dave\web2py_win\web2py_win 
-2.16\web2py\gluon\packages\dal\pydal\adapters\sqlite.py", line 82, in select
return super(SQLite, self).select(query, fields, attributes)
  File "C:\Users\Dave\web2py_win\web2py_win 
-2.16\web2py\gluon\packages\dal\pydal\adapters\base.py", line 762, in select
return self._select_aux(sql, fields, attributes, colnames)
  File "C:\Users\Dave\web2py_win\web2py_win 
-2.16\web2py\gluon\packages\dal\pydal\adapters\base.py", line 741, in 
_select_aux
return processor(rows, fields, colnames, cacheable=cacheable)
  File "C:\Users\Dave\web2py_win\web2py_win 
-2.16\web2py\gluon\packages\dal\pydal\adapters\base.py", line 305, in parse
for row in rows
  File "C:\Users\Dave\web2py_win\web2py_win 
-2.16\web2py\gluon\packages\dal\pydal\adapters\base.py", line 231, in _parse
value = self.parse_value(value, fit, ft, blob_decode)
  File "C:\Users\Dave\web2py_win\web2py_win 
-2.16\web2py\gluon\packages\dal\pydal\adapters\base.py", line 198, in 
parse_value
return self.parser.parse(value, field_itype, field_type)
  File "C:\Users\Dave\web2py_win\web2py_win 
-2.16\web2py\gluon\packages\dal\pydal\parsers\__init__.py", line 101, in parse
return self.registered[field_itype](value, field_type)
  File "C:\Users\Dave\web2py_win\web2py_win 
-2.16\web2py\gluon\packages\dal\pydal\parsers\__init__.py", line 76, in __call__
return self.call(value, field_type)
  File "C:\Users\Dave\web2py_win\web2py_win 
-2.16\web2py\gluon\packages\dal\pydal\parsers\__init__.py", line 70, in 
_call_with_extras
return self.f(self.parser, value, **extras)
  File "C:\Users\Dave\web2py_win\web2py_win 
-2.16\web2py\gluon\packages\dal\pydal\parsers\sqlite.py", line 19, in _decimal
value = ('%.' + decimals + 'f') % value

ValueError: unsupported format character ' ' (0x20) at index 2

/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: scheduler question

2018-02-06 Thread Dave S
On Tuesday, February 6, 2018 at 12:10:18 PM UTC-8, Andrea Fae' wrote:
>
> I created like in the book. It's a model. I'm scheduling from the database 
> administrative interface. 2 days ago worked perfectly! I don't know!
>
>
I've never tried that.  The production system I run the scheduler on 
doesn't have a GUI to run a browser from, and I don't often set up SSL port 
forwarding to run appadmin from my client system.  I schedule either 
through a web page (exposed controller function) or through using -S on the 
command line (non-exposed controller function.

See


(The online copy of the book hasn't been synched with github for a while, 
it seems, so I can't point you at a pretty copy.)

/dps

 

> Il 06 feb 2018 9:05 PM, "Dave S"  ha 
> scritto:
>
>>
>>
>> On Tuesday, February 6, 2018 at 7:58:15 AM UTC-8, Andrea Fae' wrote:
>>>
>>> Hello, days ago I started to use scheduler and all was working very 
>>> well. I could see db.scheduler_run.task_id lines in the db with all the 
>>> results and console.
>>>
>>> Now the scheduler works very well but I don't see nothing in the 
>>> table db.scheduler_run.task_id. Why? Talk completed without problems...
>>>
>>
>> I don't know.  My scheduler_run rows all show a task_id.  I have more 
>> than 2500 runs since switching to 2.15.4 (minimum of 3 runs a day).  I had 
>> 1900+ runs under 2.14.6.
>>
>>
>>> This is my routine (from the moment I tried to use AppConfig - now is 
>>> commented - I noted no lines in the table above...)
>>>
>>>
>> Where does this code live?  In a model file, a module, or ??
>>
>> How do you schedule it?
>>
>>  
>>
>>> def chiusura_automatica_ticket():
>>> esito = False
>>> # questa è la data odierna
>>> todate = datetime.date.today()
>>> # print 'todate = ', todate
>>> 
>>> # carico da appconfig.ini il numero di giorni lavorativi in cui lo 
>>> scehdulature chiude in automatico le richieste di intervento
>>> # mycustom_conf = AppConfig()
>>> # questo è il delta in giorni lavorativi indietro
>>> # giorni_da_apertura = 
>>> mycustom_conf.get('custom.automatic_ticket_closing')
>>> giorni_da_apertura = 30
>>> print giorni_da_apertura
>>> 
>>> # questa è la data di partenza
>>> fromdate = date_by_subtract_business_days(todate,giorni_da_apertura)
>>> # print 'fromdate = ',fromdate
>>>
>>> # seleziono i ticket prima della data "fromdate" che non siano 
>>> ancora chiusi
>>> query = (db.ticket.created_on < fromdate) & (db.ticket.chiuso == 
>>> False)
>>> db(query).update(chiuso = True, risoluzione = 'CHIUSO 
>>> AUTOMATICAMENTE')
>>> # commit necessaria
>>> esito = db.commit()
>>> return esito
>>>
>>
>>
>> /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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/Xjtf3rRBZyU/unsubscribe.
>> To unsubscribe from this group and all its topics, 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: POST api return 405

2018-02-06 Thread Leonel Câmara
Your controller function where you used the request.restful decorator 
probably doesn't have a "def POST" function inside it to deal with the post 
method.

-- 
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] query to match if boolean field is not True

2018-02-06 Thread David Zejda
Hi :)

Intuitively I would expect that these queries are equivalent ways to match 
if boolean_field is not True:

~(db.mytable.boolean_field == True)

(db.mytable.boolean_field != True)

((db.mytable.boolean_field == None) | (db.mytable.boolean_field == False))

But only the last one works as expected.

David

-- 
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: Downloading ALL images in a table at once

2018-02-06 Thread Jim S
Based on my experience and simple web protocols, you can't do what you 
want.  You could however combine all the images into one file (a zip file) 
and download that zip file.  In your controller you could do something like 
this:

import os
import StringIO
import zipfile

tempfile = StringIO.StringIO()
ziph = zipfile.ZipFile(tempfile, 'w', zipfile.ZIP_DEFLATED)

#  psuedo code here
loop through all the picture files you want to download:
ziph.write(file)  # add the file to the zip file - 'file' needs to be 
full path of the file

ziph.close()
response.headers['Content-Disposition'] = 'attachment;filename=images.zip'
response.headers['Content-Type'] = 'application/zip'
rtn = tempfile.getvalue()
tempfile.close()

return rtn

Hope this helps.

If you truly want to download multiple files at once I think you're going 
to have to go with some javascript magic.  Since it is a bit of 
non-standard way of doing things I've never attempted...

-Jim


On Sunday, February 4, 2018 at 4:00:13 PM UTC-6, mostwanted wrote:
>
> I have a table which stores different images of different places, what i 
> want is for the site users to be able to download all the images of a 
> selected place
> by clicking the download button without having to download the images one 
> at a time. How can i achieve this??
>
> I tried this below:
>
> *MODEL:*db.define_table('location',
> Field('Image', 'upload'),
> Field('formTitle', requires=IS_NOT_EMPTY()), 
> Field('place', 'reference 
> area'),migrate=False,fake_migrate=True)
>
>
> *CONTROLLER*def areas():
> form=db.place(request.args(0))
> images=db(db.location.place==form.id).select(db.location.ALL)
> return dict(images=images, form=form)
>
>
> *VIEW*{{extend 'layout.html'}}
> 
> {{for pics in images:}}
>   href="{{=URL('download',args=pics.Image)}}">Download
>  {{pass}}
> 
>
> Unfortunately the above attempts do not give me what i want, please assist.
> Thank you.
>

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


[web2py] Re: Update Web2Py from admin page > Error - from version 2.14.6

2018-02-06 Thread Jim S
Can you try here?

https://github.com/web2py/web2py/tree/master/scripts/setup-web2py-ubuntu.sh

I believe web2py moved their hosting to github a year or so back.  

-Jim

On Sunday, February 4, 2018 at 11:48:28 AM UTC-6, Mamisoa Andriantafika 
wrote:
>
>
> Hi,
>
> I tried to upgrade the easy way from the admin screen but now I get a 
> ticket that I cannot read. At one point I get: 
>
> Requires web2py 2.15.5 or newer
>
> I installed previously for the one step install (Linux).
>
> I tried again but I get a 404 error from:
>
> wget http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh
>
> Any ideas?
>
> Mike
>

-- 
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] Intersection of rows

2018-02-06 Thread Dave S
I have an application (used for comparing routes) with 2 tables relevant to 
this question.  (Paraphrasing; code is at home,
where the router jammed.)

db.define_table('run',
   Field('when', 'date'),
   Field('description', 'string))

db.define_table('segment',
   Field('waypoint', 'string'),
Field('timeofday', 'time'),
   Field('odometer', 'decimal'),
   Field('partof', 'reference run'))

I wanted to find the runs that had X as a waypoint and also had Y as a 
waypoint, so I looked at

and wrote:

def fromto():
# not shown -- X and Y from request.vars
q1 = db.segment.waypoint = X
q2 = db.segment.waypoint = Y
runs1 = db(run.id == segment.partof & q1).select(...,distinct=True)
runs2 = db(run.id == segment.partof & q2).select(...,distinct=True)
theruns = runs1 & runs2
print len(runs1) + len(runs2) + len(theruns)
return ("runs" = theruns)

For the first waypoints I tried, the print produced counts of 111 10  121
which is clearly NOT the intersection.  (I have verified that theruns 
includes  runs where Y is not included,
and the page shows the Y runs at the end of the X runs (that is, appended).)

If I go for union ('|' in line 7), the counts are 111 10 112.
(1 Y run did not go through X).

I add the "distinct=True" after the first attempt, in case multiple 
appearances of a row was confusing things.   It made no apparent difference.

I think this is on 2.14.6; I may be able to test newer web2py's tonight.  
Am I doing something wrong, or was there a hiccup in intersection?

Dave S
/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: not authorised flash message when I used SQLFORM.grid, but worked fine with SQLFORM.smartgrid

2018-02-06 Thread dave . liotta
Just ran into and fixed this problem after much trial and error. In short, 
the URL that links to this controller method needs to have the 
user_signature=True attribute: In our case this was a link from another 
form grid:

...
links=[
dict(
header='Manage', 
body=lambda row: A(SPAN(' Members', _class='fa 
fa-user-circle'),
 _href=URL('membership', args=[row.id], 
user_signature=True), 
 _class='btn btn-primary btn-sm'
)
)
],
...

We noticed that if we switched the URL *args* to *vars* it also worked. We 
wanted the pretty URL though so found that the user_signature worked. One 
other thing to note: If you plan to use *args* like we did here the 
SQLform.grid on the recipient page will need the *args=request.args[:1] *or 
similar attrbute so all of its automatically generated links will include 
the *args* as well.

grid = SQLFORM.grid(
...
args=request.args[:1],
...
)

Dave

On Saturday, April 22, 2017 at 3:19:15 AM UTC-5, Rudy wrote:
>
> Hi there,
>
> It feels really strange to me that when i used SQLFORM.grid(), I got a 
> flash message "not authorised", but when i used smartgrid(), it worked just 
> fine (in both cases i had logged in already). I tried to removed 
> @auth.requires_login(), but same behaviour happened. I seem to miss some 
> very fundamental knowledge using SQLFORM.grid(). Below is the simplified 
> code. Any help is much appreciated.
>
> @auth.requires_login()
> def list_items2():
> response.view='accounting/list_items.html'
> grid = SQLFORM.grid(db.auth_user)
> return locals()
>

-- 
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: Upload an image from front-end

2018-02-06 Thread Πέτρος Χατζηλάμπρος
So, I did the following:

   - I created a controller and I put the following code inside

# Example of a form that sends a valid POST request to changeAvatar()
@auth.requires_login()
def showChangeAvatarForm():
return locals()

# use /showChangeAvatarForm from browser for testing
@auth.requires_login()
def changeAvatar():
if not request.env.request_method == 'POST': 
raise HTTP(405, json(dict(status='failure', msg='POST request is 
needed')))

try: image=request.vars['image']
except: image=None

if image == None or image == "":
raise HTTP(400, json(dict(status='failure', msg='No image provided'
))) 

if type(image)==type(str()):
raise HTTP(400, json(dict(status='failure', msg='Only the finename 
of the image was provided, not the image itself. Try to copy the browser 
behavior of /user/showChangeAvatarForm when submiting a file')))
db(db.auth_user.id==auth.user.id).update(avatar=image)
filename=db(db.auth_user.id==auth.user.id).select(db.auth_user.avatar).
first().avatar
return json(dict(status='success', msg='Avatar has been changed', 
filename=filename))

   - Also I created view showChangeAvatarForm.html and I put the following 
   code inside:

 

 
This a demo to change avatar
 
 




   - So I proved that web2py is able to accept and store images. Now I am 
   expecting from the front-end developer to develop an appropriate POST 
   request. In case that he does not know how to do it he can use this library 
   http://malsup.com/jquery/form/  . I have used it and I can say that it is 
   able to POST files that have been chosen using a 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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: scheduler question

2018-02-06 Thread andfae
I created like in the book. It's a model. I'm scheduling from the database
administrative interface. 2 days ago worked perfectly! I don't know!

Il 06 feb 2018 9:05 PM, "Dave S"  ha scritto:

>
>
> On Tuesday, February 6, 2018 at 7:58:15 AM UTC-8, Andrea Fae' wrote:
>>
>> Hello, days ago I started to use scheduler and all was working very well.
>> I could see db.scheduler_run.task_id lines in the db with all the results
>> and console.
>>
>> Now the scheduler works very well but I don't see nothing in the
>> table db.scheduler_run.task_id. Why? Talk completed without problems...
>>
>
> I don't know.  My scheduler_run rows all show a task_id.  I have more than
> 2500 runs since switching to 2.15.4 (minimum of 3 runs a day).  I had 1900+
> runs under 2.14.6.
>
>
>> This is my routine (from the moment I tried to use AppConfig - now is
>> commented - I noted no lines in the table above...)
>>
>>
> Where does this code live?  In a model file, a module, or ??
>
> How do you schedule it?
>
>
>
>> def chiusura_automatica_ticket():
>> esito = False
>> # questa è la data odierna
>> todate = datetime.date.today()
>> # print 'todate = ', todate
>>
>> # carico da appconfig.ini il numero di giorni lavorativi in cui lo
>> scehdulature chiude in automatico le richieste di intervento
>> # mycustom_conf = AppConfig()
>> # questo è il delta in giorni lavorativi indietro
>> # giorni_da_apertura = mycustom_conf.get('custom.auto
>> matic_ticket_closing')
>> giorni_da_apertura = 30
>> print giorni_da_apertura
>>
>> # questa è la data di partenza
>> fromdate = date_by_subtract_business_days(todate,giorni_da_apertura)
>> # print 'fromdate = ',fromdate
>>
>> # seleziono i ticket prima della data "fromdate" che non siano ancora
>> chiusi
>> query = (db.ticket.created_on < fromdate) & (db.ticket.chiuso ==
>> False)
>> db(query).update(chiuso = True, risoluzione = 'CHIUSO
>> AUTOMATICAMENTE')
>> # commit necessaria
>> esito = db.commit()
>> return esito
>>
>
>
> /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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/Xjtf3rRBZyU/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.


[web2py] Re: scheduler question

2018-02-06 Thread Dave S


On Tuesday, February 6, 2018 at 7:58:15 AM UTC-8, Andrea Fae' wrote:
>
> Hello, days ago I started to use scheduler and all was working very well. 
> I could see db.scheduler_run.task_id lines in the db with all the results 
> and console.
>
> Now the scheduler works very well but I don't see nothing in the 
> table db.scheduler_run.task_id. Why? Talk completed without problems...
>

I don't know.  My scheduler_run rows all show a task_id.  I have more than 
2500 runs since switching to 2.15.4 (minimum of 3 runs a day).  I had 1900+ 
runs under 2.14.6.


> This is my routine (from the moment I tried to use AppConfig - now is 
> commented - I noted no lines in the table above...)
>
>
Where does this code live?  In a model file, a module, or ??

How do you schedule it?

 

> def chiusura_automatica_ticket():
> esito = False
> # questa è la data odierna
> todate = datetime.date.today()
> # print 'todate = ', todate
> 
> # carico da appconfig.ini il numero di giorni lavorativi in cui lo 
> scehdulature chiude in automatico le richieste di intervento
> # mycustom_conf = AppConfig()
> # questo è il delta in giorni lavorativi indietro
> # giorni_da_apertura = 
> mycustom_conf.get('custom.automatic_ticket_closing')
> giorni_da_apertura = 30
> print giorni_da_apertura
> 
> # questa è la data di partenza
> fromdate = date_by_subtract_business_days(todate,giorni_da_apertura)
> # print 'fromdate = ',fromdate
>
> # seleziono i ticket prima della data "fromdate" che non siano ancora 
> chiusi
> query = (db.ticket.created_on < fromdate) & (db.ticket.chiuso == False)
> db(query).update(chiuso = True, risoluzione = 'CHIUSO AUTOMATICAMENTE')
> # commit necessaria
> esito = db.commit()
> return esito
>


/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] Demo site pointed from About page is not working

2018-02-06 Thread Marcelo Huerta
The about page of the main web2py site 
(http://web2py.com/init/default/what) points to a demo page at 
http://www.web2py.com/demo_admin, but the demo is not working, it fails 
attempting to create a ticket but the "ticket number" is "unknown".

Either the demo or the page should be fixed...

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


[web2py] scheduler question

2018-02-06 Thread Andrea Fae'
Hello, days ago I started to use scheduler and all was working very well. I 
could see db.scheduler_run.task_id lines in the db with all the results and 
console.

Now the scheduler works very well but I don't see nothing in the 
table db.scheduler_run.task_id. Why? Talk completed without problems...

This is my routine (from the moment I tried to use AppConfig - now is 
commented - I noted no lines in the table above...)

def chiusura_automatica_ticket():
esito = False
# questa è la data odierna
todate = datetime.date.today()
# print 'todate = ', todate

# carico da appconfig.ini il numero di giorni lavorativi in cui lo 
scehdulature chiude in automatico le richieste di intervento
# mycustom_conf = AppConfig()
# questo è il delta in giorni lavorativi indietro
# giorni_da_apertura = 
mycustom_conf.get('custom.automatic_ticket_closing')
giorni_da_apertura = 30
print giorni_da_apertura

# questa è la data di partenza
fromdate = date_by_subtract_business_days(todate,giorni_da_apertura)
# print 'fromdate = ',fromdate

# seleziono i ticket prima della data "fromdate" che non siano ancora 
chiusi
query = (db.ticket.created_on < fromdate) & (db.ticket.chiuso == False)
db(query).update(chiuso = True, risoluzione = 'CHIUSO AUTOMATICAMENTE')
# commit necessaria
esito = db.commit()
return esito

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

2018-02-06 Thread Simona Chovancová
solved, ran worker in different application than the task was sent from

On Tuesday, February 6, 2018 at 2:34:24 PM UTC+1, Simona Chovancová wrote:
>
> Hello,
>
> I'm having trouble using the scheduler. I have managed to set it up to 
> queue tasks and successfully complete them. Although, that only works if I 
> do not use database. If I include db in function that is tasked, I get this:
>
> Traceback (most recent call last):
>   File "/srv/www/web2py/gluon/shell.py", line 273, in run
> exec(python_code, _env)
>   File "", line 1, in 
>   File "/srv/www/web2py/gluon/scheduler.py", line 735, in loop
> self.wrapped_report_task(task, self.async(task))
>   File "/srv/www/web2py/gluon/scheduler.py", line 889, in 
> wrapped_report_task
> db.rollback()
>   File "/srv/www/web2py/gluon/packages/dal/pydal/base.py", line 956, in 
> rollback
> self._adapter.rollback()
>   File "/srv/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
> 1342, in rollback
> return self.connection.rollback()
>   File "/srv/www/web2py/gluon/contrib/pg8000/core.py", line 1429, in 
> rollback
> self.execute(self._cursor, "rollback", None)
>   File "/srv/www/web2py/gluon/contrib/pg8000/core.py", line 1626, in 
> execute
> self.handle_messages(cursor)
>   File "/srv/www/web2py/gluon/contrib/pg8000/core.py", line 1774, in 
> handle_messages
> raise self.error
> ProgrammingError: ('ERROR', '42P05', 'prepared statement 
> "pg8000_statement_13" already exists')
>
> Also, if I do just simple inserts like db.table.insert(something="abc"), I 
> also include db.commit(), I get this error:
>
> Database drivers available: sqlite3, imaplib, pymysql, pg8000
> starting single-scheduler for "myapp"...
> ERROR:web2py.scheduler.servername#3711:error storing result
>
>
> Can someone please point me to the right direction?
> Thanks
>

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


[web2py] Web2py scheduler

2018-02-06 Thread Simona Chovancová
Hello,

I'm having trouble using the scheduler. I have managed to set it up to 
queue tasks and successfully complete them. Although, that only works if I 
do not use database. If I include db in function that is tasked, I get this:

Traceback (most recent call last):
  File "/srv/www/web2py/gluon/shell.py", line 273, in run
exec(python_code, _env)
  File "", line 1, in 
  File "/srv/www/web2py/gluon/scheduler.py", line 735, in loop
self.wrapped_report_task(task, self.async(task))
  File "/srv/www/web2py/gluon/scheduler.py", line 889, in 
wrapped_report_task
db.rollback()
  File "/srv/www/web2py/gluon/packages/dal/pydal/base.py", line 956, in 
rollback
self._adapter.rollback()
  File "/srv/www/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
1342, in rollback
return self.connection.rollback()
  File "/srv/www/web2py/gluon/contrib/pg8000/core.py", line 1429, in 
rollback
self.execute(self._cursor, "rollback", None)
  File "/srv/www/web2py/gluon/contrib/pg8000/core.py", line 1626, in execute
self.handle_messages(cursor)
  File "/srv/www/web2py/gluon/contrib/pg8000/core.py", line 1774, in 
handle_messages
raise self.error
ProgrammingError: ('ERROR', '42P05', 'prepared statement 
"pg8000_statement_13" already exists')

Also, if I do just simple inserts like db.table.insert(something="abc"), I 
also include db.commit(), I get this error:

Database drivers available: sqlite3, imaplib, pymysql, pg8000
starting single-scheduler for "myapp"...
ERROR:web2py.scheduler.servername#3711:error storing result


Can someone please point me to the right direction?
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.