The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2017-09-28

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:00 mib_rb3gst joined #mojo
02:51 noganex_ joined #mojo
03:38 karjala_ joined #mojo
03:38 esh joined #mojo
03:41 kamyl joined #mojo
03:52 nchelluri joined #mojo
03:57 aborazmeh joined #mojo
04:04 dboehmer joined #mojo
04:10 crab joined #mojo
04:13 bianca joined #mojo
04:18 jamesaxl joined #mojo
05:14 dod joined #mojo
05:21 dod joined #mojo
05:24 hesco joined #mojo
06:28 bianca joined #mojo
06:41 Vandal joined #mojo
06:42 inokenty-w joined #mojo
06:43 dod joined #mojo
06:44 AndrewIsh joined #mojo
07:04 ashimema joined #mojo
07:27 trone joined #mojo
07:36 leont_ joined #mojo
07:47 schelcj joined #mojo
08:02 petru_ joined #mojo
08:05 dod joined #mojo
08:21 n16gel joined #mojo
08:51 dod joined #mojo
08:53 rshadow joined #mojo
09:23 bianca joined #mojo
09:34 petru joined #mojo
09:51 kiwiroy joined #mojo
11:03 petru joined #mojo
11:14 tchaves joined #mojo
11:32 tchaves joined #mojo
11:45 pirateFinn joined #mojo
12:01 karjala_ joined #mojo
12:21 foursixnine joined #mojo
12:54 Pyritic joined #mojo
12:57 Pyritic joined #mojo
12:59 nchelluri joined #mojo
13:00 tcohen joined #mojo
13:04 zivester joined #mojo
13:16 gizmomathboy joined #mojo
13:33 gryphon joined #mojo
13:55 * sri yawns
14:06 foursixnine joined #mojo
14:09 coolo joined #mojo
14:12 nchelluri joined #mojo
14:20 * nchelluri is away - Automatically set away. - messages will be saved.
14:26 jberger I hope that doesn't become a thing ^^
14:33 genio I finally figured out what I can equate ST Discovery to: Expanse.
14:33 genio The Orville is Star Trek and Star Trek is The Expanse.
14:39 ChmEarl joined #mojo
14:41 nchelluri joined #mojo
14:43 nchelluri hello, I am using Mojolicious and EPRenderer, and am setting the escape callback on Mojo::Template via EPRender's template attr. Now it looks like everything I output including the raw templates is being escaped. Can someone explain this behavior? I only want expressions to be escaped.
14:44 nchelluri https://gist.github.com/nchelluri/ce4646ee499b49cdea6b7a1307b86608
14:48 marcus nchelluri: <%= %> is escaped by default, no need to do anything. To not escape, use <%== %>
14:49 nchelluri marcus: so I should just remove the xml_escape from my gist?
14:49 marcus nchelluri: yea
14:49 marcus afaict
14:49 nchelluri thanks
14:50 coolo joined #mojo
14:51 foursixnine joined #mojo
14:51 nchelluri I don't quite understand why everything outside of <%= is being escaped when I leave that in though marcus. I thought only expressions would be escaped, but everything is escaped
14:53 nchelluri marcus, I am trying to escape both XML entities *and* my additional curly braces. I thought what I did would be necessary because of https://github.com/kraih/mojo/blob/master/lib/Mojo/Template.pm#L18
15:07 Grinnz no, you need the escape routine to xml escape, or all your output will be unescaped
15:08 bianca joined #mojo
15:10 Grinnz how are you determining that "everything is escaped"?
15:16 zivester joined #mojo
15:44 maschine There's something satisfying about taking something simple like AutoLISP, and using it to open a Mojo app to do something really complex.. :)
15:45 maschine except maybe the 13 lines of code (and 3 hours of my time) I had to write to make it split a string that Perl could do in 1..
16:10 nchelluri Grinnz: Even my documents start with "&lt;!DOCTYPE html&gt;
16:20 Grinnz nchelluri: maybe it's because of using the EPRenderer plugin a second time so it runs through both handlers?
16:22 Grinnz you could try doing: delete $self->renderer->handlers->{ep}; before using the plugin again
16:22 Grinnz hmm, no add_handler should overwrite the old one
16:23 Grinnz no idea why that would happen
16:24 Grinnz ah, actually
16:25 Grinnz your s/// on $str is stringifying it, if it's a Mojo::ByteStream it's supposed to be ignored by xml_escape but the s/// strips that
16:25 Grinnz also, that should happen after xml_escape anyway
16:25 Grinnz otherwise you'll double-encode the {
16:25 dod joined #mojo
16:25 Grinnz so try: return xml_escape($str) =~ s/\{/&#123;/gr;
16:26 tchaves joined #mojo
16:26 Grinnz and maybe add before that line: return $str if ref $_[0] && ref $_[0] eq 'Mojo::ByteStream';
16:26 Grinnz (from xml_escape)
16:27 Grinnz er, ref $str && ref $str eq 'Mojo::ByteStream';
16:27 jberger but that still shouldn't be escaping the DOCTYPE line
16:28 Grinnz i dunno, just a guess that it's killing a Mojo::ByteStream somewhere that it shouldnt be
16:28 jberger does the ep rendered pass into the epl renderer?
16:29 jberger or maybe the other way ...
16:29 jberger I dunno, its been too long since I've had a deep dive into the renderer
16:34 nchelluri trying that out
16:40 coolo joined #mojo
16:40 foursixnine joined #mojo
16:41 ChmEarl joined #mojo
16:41 disputin joined #mojo
16:45 nchelluri Grinnz, now I'm back to not escaping the { at all. I have the following:                     return $str if ref $str && ref $str eq 'Mojo::ByteStream';
16:45 nchelluri return $str if ref $str && ref $str eq 'Mojo::ByteStream';
16:46 nchelluri return xml_escape($str) =~ s/\{/&#123;/gr;
16:46 Grinnz your { are in <%= %> tags right?
16:46 nchelluri correct
16:47 Grinnz how are you viewing the output?
16:47 nchelluri I believe I was wrong
16:48 nchelluri it is escaping the { now sorry
16:54 nchelluri now Grinnz I am finding when I use `text_field` from TagHelpers my value is not escaped using my escape function.
16:55 nchelluri i.e. the { is not escaped in a <input type="text" value="{{I AM HERE}}">
16:55 petru joined #mojo
16:56 Grinnz what version of Mojolicious are you using?
16:57 petru_ joined #mojo
16:57 nchelluri 7.46
16:58 leont_ joined #mojo
16:59 Grinnz still would like to know, how are you viewing the output :)
16:59 nchelluri sorry, in a web browser - Chrome -> View Source
17:00 Grinnz ok that should show it correctly, but inspect element might not
17:02 nchelluri afk a while - but will check this later - thank you!
17:13 rshadow joined #mojo
17:40 PopeFelix joined #mojo
17:55 bwf joined #mojo
18:21 bianca joined #mojo
18:28 Pyritic joined #mojo
18:37 disputin joined #mojo
18:42 petru_ joined #mojo
19:02 itaipu joined #mojo
19:06 bianca joined #mojo
19:19 karjala_ joined #mojo
19:34 nchelluri joined #mojo
19:43 bianca Hey, if I have a form where I call a controller function that, upon error, sends a flash and then redirects to the calling page, is there any way to set the status of the request to 400? For eg. on the login page, if the data is incorrect, I could redirect to login and set a flash, but the error code is 302 because of the redirect and I need to signal a bad request
20:04 trone joined #mojo
20:15 beyondcreed joined #mojo
20:26 preaction if it's not 302, the browser will not redirect
20:28 jberger rather than 302, why not just rerender the page?
20:29 disputin joined #mojo
20:46 bianca joined #mojo
21:35 gryphon joined #mojo
21:47 stomper joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary