[web2py] Blockquote in markmin

2017-06-28 Thread Martin Weissenboeck
I have run the markmin2html.py file. The results of blockquotes are not as
expected, e.g.:

​This is a blockquote with a list with tables in it:

This is a paragraph before list. You can continue paragraph on the next
lines. This is an ordered list with tables: + Item 1 + Item 2 + 
aa|bb|cc 11|22|33 :tableclass1[tableid1] + Item 4 --- T1|
T2| t3 === aaa|bbb|ccc ddd|fff|ggg 123|0 |5.0
---:tableclass1

This this a new paragraph with a followed table. Table has header, footer,
sections, odd and even rows:​



​The same problem is with the other blockquote exaples.
What is wrong?

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] Totally app-internal routing

2017-06-28 Thread Brendan Barnwell
Looking at the routing discussion in the docs, it seems that any kind of 
custom routing has to be defined at the global level of the entire web2py 
install.  Is that correct?  This seems awkward if I want to write an app 
that carries with it its own knowledge of how it wants to route its 
internal URLs, so that it can be dropped into an existing web2py install 
without requiring extra global config (as web2py apps usually can be).

Given that the usual web2py URL scheme is 
host/app/controller/function/extra , what I'm wondering is, is there a way 
for an application to hook into ONLY the /controller/function/extra part?  
What I would like is to be able to get in AFTER web2py decides which app is 
being accessed, but BEFORE it decides which controller file to load.  This 
way I could, for instance, do URL rewrite rules that change /myapp/somepage 
to /myapp/somecontroller/somepage --- again, without requiring any changes 
to code outside the application's own folder.  Is this possible?

-- 
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: function lazy_user at ...

2017-06-28 Thread Anthony
In auth.signature, the "created_by" field has a "default" attribute, which 
is a function (called "lazy_user") that returns auth.user_id. At the point 
at which the value of the compute field is computed, the row object passed 
to the compute function simply includes the "lazy_user" function as the 
value of the "created_by" field -- the function has not been called and 
returned the auth.user_id value yet (that doesn't happen until after the 
compute fields are computed). In other words, compute field values are 
calculated *before* default functions are called, so compute functions 
should not depend on the values of other fields whose defaults are set via 
a function.

In this case, you have two alternatives:

ret.append(record["created_by"]()) # This calls the lazy_user function, 
which returns auth.user_id

or:

ret.append(auth.user_id) # Just use auth.user_id directly.

Anthony

On Wednesday, June 28, 2017 at 12:30:22 PM UTC-4, Ramos wrote:
>
> Hello i added an authors and readers  computed fields to my table  
>
> db.define_table(
> 'entities',
>...
> Field('authors',compute= lambda r:authors(r)),
> ...
> )
>
> when i save a record i get this 
> : 
> authors : 
> [**]
> created_by : 
> 4L
> created_on : 
> datetime.datetime(2017, 6, 28, 16, 16, 24)
> delete_record : 
> 
> description : 
> entity : 
> saw
> event : 
> 1903
> id : 
> 401L
> is_active : 
> True
> last_error : 
> modified_by : 
> 4L
> modified_on : 
> datetime.datetime(2017, 6, 28, 16, 16, 24)
> readers : 
> [2L, 1L, 5L, 4L,* *]
> status : 
> 8L
> type : 
> 1L
> update_record : 
> 
> uuid : 
> c12ecf01-0d7b-4334-81c9-b7808c8cf7f9
>
> if i go to admin and edit the record and save again the fuction lazy_user 
> goes away..
> Why is this and how to make it save properly in my code?
>
>
> my code...  
>
> def *authors*(record):
> ret=[]
> row=db.status(id=record["status"])
> rule=db.rules(workflow=row["workflow"],step=record["status"])
> users=get_userIds(rule)
> for user in users:
> if not user in ret:
> ret.append(user)   
> if ret==[]:
> ret.append(record["created_by"])
> return str(ret)
>
> def get_userIds(rule):
> ret=[]
> for membership in rule["authors"]:
> temp=db(db.auth_membership.group_id==membership).select()
> for r in temp:
> ret.append(r["id"])
> return ret
>
>
> 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.


Re: [web2py] Re: FPDF "ne commence pas par '%PDF-' "

2017-06-28 Thread Ovidio Marinho
Publish this in http://www.web2pyslices.com/home, everyone always asks for
this problem.





   [image: http://itjp.net.br] 
 http://itjp.net.b r
  *Ovidio Marinho Falcao Neto*
 ovidio...@gmail.com
Brasil


2017-06-26 7:01 GMT-03:00 J-Michel Angers :

> SUPER !
> With thiw, it works exactly as I wish.
>  => A message appears "Do you want to open/save/saveAs ?", and after the
> choice "Open", I see my PDF in the "Acrobat" tool.
> Thank you very much for this advice :-) :-)
>
> Le lundi 26 juin 2017 07:12:49 UTC+2, Peter a écrit :
>
>>
>> Have been outputting pdfs for a while and this is what works for me ...
>>
>> note, I don't close the pdfpdf.close? but this allows the user to
>> either open or save the file anywhere on their machine (Linux and Windows)
>>
>>
>> 
>> s_io = pdf.output(dest='S')
>> response.headers['Content-Type']='application/pdf'
>> response.headers['Content-Disposition'] = 'attachment;
>> filename="%s"' % invc_filename
>> raise HTTP(200, s_io, **response.headers)
>>
>>>
>>>
>>> --
> 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] function lazy_user at ...

2017-06-28 Thread António Ramos
Hello i added an authors and readers  computed fields to my table

db.define_table(
'entities',
   ...
Field('authors',compute= lambda r:authors(r)),
...
)

when i save a record i get this
:
authors :
[**]
created_by :
4L
created_on :
datetime.datetime(2017, 6, 28, 16, 16, 24)
delete_record :

description :
entity :
saw
event :
1903
id :
401L
is_active :
True
last_error :
modified_by :
4L
modified_on :
datetime.datetime(2017, 6, 28, 16, 16, 24)
readers :
[2L, 1L, 5L, 4L,* *]
status :
8L
type :
1L
update_record :

uuid :
c12ecf01-0d7b-4334-81c9-b7808c8cf7f9

if i go to admin and edit the record and save again the fuction lazy_user
goes away..
Why is this and how to make it save properly in my code?


my code...

def *authors*(record):
ret=[]
row=db.status(id=record["status"])
rule=db.rules(workflow=row["workflow"],step=record["status"])
users=get_userIds(rule)
for user in users:
if not user in ret:
ret.append(user)
if ret==[]:
ret.append(record["created_by"])
return str(ret)

def get_userIds(rule):
ret=[]
for membership in rule["authors"]:
temp=db(db.auth_membership.group_id==membership).select()
for r in temp:
ret.append(r["id"])
return ret


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] Re: FPDF "ne commence pas par '%PDF-' "

2017-06-28 Thread Peter

Usually I'm the one getting the help J-Michel, 

So I'm very happy to have helped someone out for a change!

Regards
Peter

-- 
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: datetime or timestamp ?

2017-06-28 Thread Richard Vézina
I think it not working and have been removed from trunk...

On Wed, Jun 28, 2017 at 6:14 AM, Dave S  wrote:

>
>
> On Tuesday, June 27, 2017 at 4:08:25 AM UTC-7, Leonel Câmara wrote:
>>
>> Always store everything in UTC, seriously just have request.now =
>> request.utcnow as the first line in all your applications.
>>
>> It's very easy to get a user's UTC offset using javascript:
>>
>> (new Date()).getTimezoneOffset()/60
>>
>> Then you can store it in session or something like that and use it to
>> adapt queries and the way you display stuff.
>>
>
>
> Also see  aCElqdLiBwAJ> ... Niphlod has a github link that is relevant.
>
> /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] Re: web2py_component does not work with https...

2017-06-28 Thread Dave S


On Tuesday, June 27, 2017 at 10:21:24 AM UTC-7, Richard wrote:
>
> Hmm... Google CDN is not always on the cutting edge... 
>

Sometimes that's a good thing  (like web2py stable versions).
 

> You should use the same version as the one ship with web2py if you want to 
> avoid any issues... 
>

And that would be even less cutting edge, which can be a good thing.
 

> You have to conduct your on due diligence testing if you upgrade it...
>
> Richard
>

Automated testing, if you can.

/dps
 

>
> On Mon, Jun 26, 2017 at 6:39 AM, António Ramos  > wrote:
>
>> Upgraded jquery to latest... working now...
>> Also i´m not using jquery shipped with web2py
>> I am using the latest from google CDN
>> Will i have problems with  this ?
>>
>> Regards
>>
>> 2017-06-22 15:33 GMT+01:00 Anthony :
>>
>>> Not sure how this would be related to things working over http vs. 
>>> https, but:
>>>
>>> typeof jQuery !== strundefined
>>>
>>> should be:
>>>
>>> typeof jQuery != 'undefined'
>>>
>>> Are you checking http vs. https in two different browsers, where the 
>>> https browser has the above Javascript code cached, but the http browser 
>>> does not?
>>>
>>> Anthony
>>>
>>>
>>>
>>> On Thursday, June 22, 2017 at 6:01:09 AM UTC-4, Ramos wrote:

 I think i know why no console errors nor admin tickets

 this is the last line that is executed and comes from jquery

 [image: Imagem inline 1]

 after this line i get

 [image: Imagem inline 2]

 any ideas ?


 2017-06-21 19:17 GMT+01:00 Leonel Câmara :

> Can visit your website using https, then open a browser console go to 
> the network tab, and show me what appears there when you click the button?
>
> -- 
> 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+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+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: saving PDF documents in my database and displaying them

2017-06-28 Thread Dave S


On Wednesday, June 28, 2017 at 1:24:06 AM UTC-7, mostwanted wrote:
>
> Hi guys can you please help me, i need assistance saving PDF documents in 
> my database and displaying those PDF documents at the click of a link.
>
> Thank you
>


Basically, you need an upload field in your model, and to download the 
selected file (that was already uploaded).  See

for a similar example.

/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: datetime or timestamp ?

2017-06-28 Thread Dave S


On Tuesday, June 27, 2017 at 4:08:25 AM UTC-7, Leonel Câmara wrote:
>
> Always store everything in UTC, seriously just have request.now = 
> request.utcnow as the first line in all your applications. 
>
> It's very easy to get a user's UTC offset using javascript:
>
> (new Date()).getTimezoneOffset()/60
>
> Then you can store it in session or something like that and use it to 
> adapt queries and the way you display stuff.
>


Also see 
 ... 
Niphlod has a github link that is relevant.

/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: datetime or timestamp ?

2017-06-28 Thread António Ramos
Thank you
Very helpfull

-- 
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] Advice needed on complex SQL operation

2017-06-28 Thread Karoly Kantor
I am hoping someone more experienced could give me some advice on how best 
to proceed with this:

I have a large table with columns C1, C2, C3,  Cx

I have a user defined filter, e.g. select those where C1 = "active" and C2 
> 2017.01.01. I have already implemented this, based on user input, i am 
dynamically building my query.

Now I would like to enable users to build dynamic reports with grouping, 
counting, etc, e.g.

1. User specifies C3 to be grouped on
2. User also specifies C4 to be grouped on
3. User wants to see count on those
4. User also wants, for each group and sub-group, the sum of C5

Example output would be:

C3C4   Count Sum_of_C5
Italy Verona   3 145
Italy Palermo  12230
FranceToulon   1 2
FranceParis102   240

(Meaning, there are 3 items from Verona, Italy, and the sum of column C5 
for those 3 items is 145, etc.)

Remember all of this is dynamically user specified: what columns to group 
on (C3 and C4, and what columns to sum, in this case, C5)

I am sure there are several ways of achieving this. I am hoping someone has 
some idea on how to make this as easy as possible.

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] saving PDF documents in my database and displaying them

2017-06-28 Thread mostwanted
Hi guys can you please help me, i need assistance saving PDF documents in 
my database and displaying those PDF documents at the click of a link.

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: How to force browser to cache css and js ?

2017-06-28 Thread Niphlod
we have a section on the book on static asset management

http://web2py.com/books/default/chapter/29/04/the-core#Static-asset-management

On Sunday, June 25, 2017 at 10:01:27 PM UTC+2, Ramos wrote:
>
> I´m using this 
> https://github.com/mjbeller/web2py-starter
> but i noticed that with only me as the single user so far it occupies 
> daily from 200Mb to 300Mb bandwidth 
>
> How can i tweek it to lower this value before going to production and 
> explode my paid webfaction hosting ?
>
> 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: Suddenly my task scheduler stopped working

2017-06-28 Thread Niphlod
it's normal if the execution timeoutted.

On Tuesday, June 27, 2017 at 7:11:12 PM UTC+2, Ramos wrote:
>
> this is the error i see in task_run table record with status failed
>
> Traceback (most recent call last):
>   File "/.../new2py/web2py/gluon/scheduler.py", line 293, in executor
> _env = env(a=a, c=c, import_models=True)
>   File "/home/ramstein74/webapps/new2py/web2py/gluon/shell.py", line 166, 
> in env
> sys.exit(1)
> SystemExit: 1
>
>
> What can this be ?
>

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