Okay, done :)
(Assuming that Python code in {{...}} can't access anything from Javascript
on the page - and here encode URI came into play, as per your earlier
advice)
var id = $('#CurrentCartId').text();
var description = $(this).text();
var
Oops, I still don't know how to achieve it. Here is why:
This is from the javascript code on the page:
var description = $(this).text();
var
url='{{=URL('cart','description'),args=[id],vars=[dict(description=description)]}}';
So, the variable description belongs to
Here is a test I've just run:
def test():
url = URL('cart','test2',args=['a b c 1 3 2 $ % ( ) !'],vars={'oops':'1
3 5 a s i t ! @ # $ %'})
redirect(url)
def test2():
str1 = request.args[0]
str2 = request.vars['oops']
return locals()
Here is what it displays as a result:
On Friday, May 17, 2019 at 5:17:09 PM UTC-4, Vlad wrote:
>
> Also, I think it would be nice if URL helper would have ability to handle
> this, without a need to figure out the encoding/decoding subject...
>
You don't need the encoding -- just put the values in the query string.
Anthony
--
Also, I think it would be nice if URL helper would have ability to handle
this, without a need to figure out the encoding/decoding subject...
On Fri, May 17, 2019, 5:03 PM Eliezer (Vlad) Tseytkin <
westgate6...@gmail.com> wrote:
> Okay, I got it :)
>
> Very embarrassing. There were some prior
Okay, I got it :)
Very embarrassing. There were some prior entries in the database that
weren't converted to begin with, so when they were pulled over, the
exception was raised. I totally forgot about them, and on top of that the
one that caused the trouble was just one character different from
On Friday, May 17, 2019 at 12:20:37 PM UTC-4, Vlad wrote:
>
> It works almost, but not 100% :)
>
> with encodeURIComponent :
>
> abc def (test)
> comes back as
> abc_def__test_
>
Please show your exact code. Doesn't sound like you are using the query
string.
Anthony
--
Resources:
-
I'll try to simplify it, hoping that I'll figure it out, but it's really
very puzzling:
this works perfect:
var encodedDescription = $("#CurrentCartDescription").text();
$("#CurrentCartDescription").html(atob(encodedDescription));
it decodes it back just exactly from what it
It works almost, but not 100% :)
with encodeURIComponent :
abc def (test)
comes back as
abc_def__test_
a;slkdjf;l -239i4-29i23la'skfj(()))9012? <>,. =
comes back as
a_slkdjf_l_-239i4-29i23la_skfj_9012__.__=
This wouldn't help me, because I want it to be exactly whatever they
On Thursday, May 16, 2019 at 3:43:58 PM UTC-4, Vlad wrote:
>
> I have the following javascript in the view:
>
> var id = $('#CurrentCartId').text();
> var description = $(this).text();
> var url='{{=URL('cart','description')}}';
> url += '/' + id +
Make sure that your jQuery loading and browser up to date...
Simplify the page to something like below. Get that working. Add back
your complexity afterwards:
Q29va2llcyBvbmU=
$(".EncodedDescriptionField").each( function(index, element ){
var hereWeAre = $(this).text();
Typo: I meant atob
On Fri, May 17, 2019, 8:21 AM Eliezer (Vlad) Tseytkin <
westgate6...@gmail.com> wrote:
> Those are span elements inside inside in a table.
>
> But the values themselves are fine - I can print them out, and they are
> correct. It's only a problem when I try to apply btoa
Those are span elements inside inside in a table.
But the values themselves are fine - I can print them out, and they are
correct. It's only a problem when I try to apply btoa function to it.
On Fri, May 17, 2019, 8:09 AM villas wrote:
> Hmm, not sure.
> Are you getting the values from
Hmm, not sure.
Are you getting the values from elements?
Try:
var hereWeAre = $(this).val();
On Friday, 17 May 2019 12:13:03 UTC+1, Vlad wrote:
>
> I thought so and tried:
>
> $(".EncodedDescriptionField").each( function(index, element ){
> var hereWeAre =
I thought so and tried:
$(".EncodedDescriptionField").each( function(index, element ){
var hereWeAre = $(this).text();
var decodedString = atob(hereWeAre);
console.error(hereWeAre);
console.error(decodedString);
});
Maybe you need to iterate through the class elements. See this:
https://stackoverflow.com/questions/4735342/jquery-to-loop-through-elements-with-the-same-class
On Thursday, 16 May 2019 23:58:28 UTC+1, Vlad wrote:
>
> Just to clarify:
>
> the following works perfect for one field by ID
Just to clarify:
the following works perfect for one field by ID (decrypts it back):
var encodedDescription = $("#CurrentCartDescription").text()
$("#CurrentCartDescription").html(atob(encodedDescription));
However, when I try to do it for a bunch of fields at once using class
(instead of
I had no clue about it - I mean never heard the terms :)
Thank you very much for point to the direction. After some googling, it is
almost working.
Encoding is just fine (using btoa).
When I read it back and want to decode - it's not yet behaving right. I'm
suspecting my javascript is a
Have you considered base64 encoding/decoding?
quinta-feira, 16 de Maio de 2019 às 20:43:58 UTC+1, Vlad escreveu:
>
> I have the following javascript in the view:
>
> var id = $('#CurrentCartId').text();
> var description = $(this).text();
> var
19 matches
Mail list logo