Re: [web2py] Re: reg expression use in web2py/dal?

2020-03-31 Thread Dave S


On Tuesday, March 31, 2020 at 3:38:34 AM UTC-7, Vlad wrote:
>
> Is there any example / doc on how to use regexp? It's just mentioned in 
> the book, but no details and no samples. 
>
>
It depends on your db backend and the adapter.  For sqlite and the 
inbox-adapter, there's a python file that wraps  calls to the standard 
python library, which works when the sq;ite engine is local (as it usually 
is).  For not-so-lite DBs, I haven't had to look yet.
 
/dps

On Tue, Mar 31, 2020, 3:35 AM Val K > wrote:
>
>> re.sub() is  invoked at python level not at db level. You should use 
>> db.field.regexp(pattern)
>>
>> -- 
>> 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/gZfpGe7EcSI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/9479f17a-0eae-449f-9d6c-b2b8bd974a3f%40googlegroups.com
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f5695a19-0af3-42ad-ae03-cb8b3c2b12bf%40googlegroups.com.


[web2py] jQuery not working with web2py

2020-03-31 Thread Maurice Waka
I have this code below that works well on the demo 
site: http://jsfiddle.net/Lhg914dc/


{{extend 'layout.html'}}

 
 
 
 
 /*QuickReset*/
 *{margin:0;box-sizing:border-box;} html,body{height:100%;font:14px/1.4 sans
-serif;}


 article {
   height: 150vh;
 }
 
 
 
 
 WELCOME (waits 3 sec)
 {{=me}}
 {{=work}}
 {{=love}}
 
 CONTACT TO TOP
 


 
https://code.jquery-3.4.1.min.js";>


 function goTo(selector, timeout, cb) {
 var $el = $(selector);
 if (!$el[0]) return;
 var $par = $el.parent();
 if ($par.is("body")) $par = $("html, body");
 setTimeout(() => {
 $par.stop().animate({scrollTop: $el.offset().top}, 1000, cb && cb.call($el[
0]));
 }, timeout || 0);
 }


 // USE LIKE:
 goTo("#testimonials", 3000, function() {
 // You can use `this` to reference #testimonials! yey
 $(this).append("
Going to #contact in 3sec!"); goTo("#contact", 3000); }); // Alternatively, without using callbacks you can do //goTo("#testimonials", 3000); //goTo("#contact", 6000); // Reuse function for elements click! $("[href^='#']").on("click", function(e) { e.preventDefault(); goTo($(this).attr("href")); }); When I try it on web2py I don't see any js/jQuery effects. I want to see the page scroll in stages down to specific DIVs, how can I do this? where could the error be? Kind 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/d4f3a374-998b-4d46-b01e-d9755c3b0e4b%40googlegroups.com.

Re: [web2py] Re: reg expression use in web2py/dal?

2020-03-31 Thread Eliezer (Vlad) Tseytkin
I mean, I understand how to use regexp for a simple pattern matching, but
here I need to use the "sub" feature. What am I missing?

On Tue, Mar 31, 2020, 6:38 AM Eliezer (Vlad) Tseytkin <
westgate6...@gmail.com> wrote:

> Is there any example / doc on how to use regexp? It's just mentioned in
> the book, but no details and no samples.
>
> On Tue, Mar 31, 2020, 3:35 AM Val K  wrote:
>
>> re.sub() is  invoked at python level not at db level. You should use
>> db.field.regexp(pattern)
>>
>> --
>> 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/gZfpGe7EcSI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/9479f17a-0eae-449f-9d6c-b2b8bd974a3f%40googlegroups.com
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCDZ0UPwwWSf3uL1vYFegEfp6OLuyRtznQu7SiYs1BVy0w%40mail.gmail.com.


[web2py] Embed youtube video in markmin (à la web2py book)

2020-03-31 Thread Jon Subscripted
Hi everyone,
I have a part of my website shaped as web2py book. In order to handle long
texts in different languages.

As you might know content is in *.markmin files that are reprocessed into
HTML to be served by a generic controller.

I'm trying to embed a youtube video in the *.markmin file. I tried the
following approaches, but none of them worked:

1) Enter HTML directly:
https://www.youtube.com/embed/pbIm1R_FBps; frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope;
picture-in-picture" allowfullscreen>

 2) Use the IFRAME helper:
{{=IFRAME(_src="https://www.youtube.com/embed/pbIm1R_FBps;)}}

 3) Use the link  wrapped in HTML5 tags directly:
https://www.youtube.com/embed/pbIm1R_FBps

 4) Use the format from (
http://fpl.cs.depaul.edu/jriely/360/extras/ractive-web2py/web2py/gluon/contrib/markmin/markmin.html
 ):
[[message https://www.youtube.com/embed/pbIm1R_FBps video]]

Option 4, does show a video frame, but then the video does not play o_O

How should I include the link inside the markmin files to make it work?

I know I do not fully understand the mechanics, so most probably there's
some conceptual error in my implementation.
Thanks, Jon.

PS. Another way to pose the question would be; what is the IFRAME format to
be used in *.markmin files inside the web2py book app to embed youtube
videos?

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAK8tz32-1vihqaipOYSvzvvvp288JWMisRGF-8grW_f2bzVEfw%40mail.gmail.com.


[web2py] Re: letsencrypt google appengine with web2py

2020-03-31 Thread Jacinto Parga
It is no longer necessary as Google appengine gives autogenerated ssl 
certificates if you want:

[image: settings-mereba.png]


 

El viernes, 7 de junio de 2019, 3:59:29 (UTC+2), Daniel Guilhermino 
escribió:
>
> Dude ... thanks a lot! After hours, this answer helped me a lot!
>
> Many... Many thanks!
>
> Em domingo, 6 de março de 2016 16:30:42 UTC-3, Jacinto Parga escreveu:
>>
>> With GAE deployed apps...
>>
>> The best solution I've found is using an error handler and a redirection 
>> to the static file with the letsencrypt response. Something like this:
>>
>> In routes.py:
>>
>> routes_onerror = [
>> ('myapp/*', '/myapp/default/error_handler')
>> ]
>>
>> In the error_handler controller:
>>
>> def error_handler():
>> ...
>>   requested_uri = request.vars.requested_uri
>>   if str(requested_uri)[:28] == "/.well-known/acme-challenge/" :
>> redirect("http://mysite/filewithaccesstoletsencrypt.txt;)
>> ...
>>
>>
>>
>>
>> El lunes, 7 de diciembre de 2015, 10:24:48 (UTC+1), Jacinto Parga 
>> escribió:
>>>
>>> Hi, 
>>>
>>> I want to use letsencrypt ssl certificates ( https://letsencrypt.org/ ) 
>>> in a web2py application deployed on GAE.
>>>
>>> There is a good explanation about how to get it:  
>>> http://blog.seafuj.com/lets-encrypt-on-google-app-engine
>>>
>>> But I don't know how to deploy a view like : http://
>>> www.example.com/.well-known/acme-challenge/[challenge] 
>>> 
>>>
>>> I have given all steps, I have created the certificates and the keys. 
>>> The only thing I need is to create a view to let letsencrypt to confirm the 
>>> proper response.
>>>
>>> In other words, I need to make this code work on web2py: 
>>> class LetsEncryptHandler(RequestHandler):
>>>
>>> def get(self, challenge):
>>> self.response.headers['Content-Type'] = 'text/plain'
>>> responses = {
>>> '[challenge 1]': '[response 1]'
>>> '[challenge 2]': '[response 2]'
>>> }
>>> self.response.write(responses.get(challenge, ''))
>>>
>>> application = WSGIApplication([
>>> ('/.well-known/acme-challenge/([\w-]+)', LetsEncryptHandler),
>>> ])...
>>>
>>> Any idea?
>>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/55d5ae88-f491-4465-a5a6-904a2c647ce9%40googlegroups.com.


Re: [web2py] Re: reg expression use in web2py/dal?

2020-03-31 Thread Eliezer (Vlad) Tseytkin
Is there any example / doc on how to use regexp? It's just mentioned in the
book, but no details and no samples.

On Tue, Mar 31, 2020, 3:35 AM Val K  wrote:

> re.sub() is  invoked at python level not at db level. You should use
> db.field.regexp(pattern)
>
> --
> 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/gZfpGe7EcSI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/9479f17a-0eae-449f-9d6c-b2b8bd974a3f%40googlegroups.com
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCAwvgTKWPXVsA2N3NicHVRGf%3D-afqRpgyNVaWEbYop_sw%40mail.gmail.com.


[web2py] Re: Python3 GAE 502 Error

2020-03-31 Thread Jacinto Parga
Is there any main.py example to deploy web2py in GAE with python 3.7 as it 
is in py4web?


El domingo, 21 de abril de 2019, 18:32:33 (UTC+2), Jacinto Parga escribió:
>
> Or may be what i need is just to know what is the entrypoint in the 
> app.yalm for my web2py application
>
>
> runtime: python37
> entrypoint: gunicorn -b :$PORT main:app
>
>
>
>
> El domingo, 21 de abril de 2019, 18:19:59 (UTC+2), Jacinto Parga escribió:
>>
>> The first issue (fatal:ambiguous argument'HEAD') solved just with git 
>> init. 
>>
>> The second one 'Bad Gateway' in google app engine with python3.7 not yet. 
>>
>> May be this solution valid for web2py) 
>> https://stackoverflow.com/questions/54565417/error-bad-gateway-502-when-opening-google-app-engine-python-domain
>>  
>>
>>
>>
>> El jueves, 18 de abril de 2019, 14:21:41 (UTC+2), Jacinto Parga escribió:
>>>
>>> Hi, 
>>>
>>> I'm trying to deploy my first python3 app in Google App Engine. I've 
>>> edited  app.yaml according to 
>>> https://cloud.google.com/appengine/docs/standard/python3/config/appref 
>>> . I have created .gcloudignore replacing skip files and I have deployed it 
>>> gcloud app deploy app.yaml --version  --promote
>>>
>>> But what I get is
>>>
>>> Beginning deployment of service [default]...
>>> fatal:ambiguous argument'HEAD': unknown revision or path outside the 
>>> working tree.
>>> Use '--' to separate the routes of the revisions, in this way:
>>> 'git  [...] -- [...]'
>>>
>>> I vhave checked that all the files are uploaded wrght to Google App 
>>> Engine, but when I access to the app:
>>>
>>> [image: bad-gateway-502.png]
>>> I dont know if it is an app.yaml mistale or there is somethin wrong in 
>>> web2py with python3 apps in GAE.
>>>
>>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/fd05f3f2-a158-43e6-8660-308c273984c5%40googlegroups.com.


[web2py] Error importing Russian characters from csv file

2020-03-31 Thread aabelyakov
When importing data (russian characters) from a .csv-file into a table, an 
error occurs:
 'ascii' codec can't decode byte 0xd0 in 
position 65: ordinal not in range(128).

Standalone PyDAL works fine!
=
import locale 
print('locale.getpreferredencoding(False) =', 
locale.getpreferredencoding(False))

db.import_from_csv_file(
open('applications/upoweron/databases/csv/all.csv'),
restore=True,
encoding="utf-8",
)

db.commit()
=
Result:
locale.getpreferredencoding(False) = ANSI_X3.4-1968

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/f7b13070-34b6-49f7-aa2c-1cedca02de86%40googlegroups.com.


[web2py] Re: reg expression use in web2py/dal?

2020-03-31 Thread Val K
Also you can pass raw sql string like db.field.on(raw_sql_string)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/dcedf30b-d77b-4615-87a5-8762e643f733%40googlegroups.com.


[web2py] Re: reg expression use in web2py/dal?

2020-03-31 Thread Val K
re.sub() is  invoked at python level not at db level. You should use 
db.field.regexp(pattern)

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/9479f17a-0eae-449f-9d6c-b2b8bd974a3f%40googlegroups.com.