From self at je77.com Mon Feb 1 19:26:27 2016 From: self at je77.com (J.F. Rick) Date: Mon Feb 1 19:26:40 2016 Subject: [Seaside] Anonymous Component In-Reply-To: References: <8D092197-4624-461F-938D-D9A681081522@inceptive.be> Message-ID: Finally got around to trying this in my code. It worked. You know you're doing something right when people guess how to do something and it would actually work. Cheers, Jeff On Thu, Jan 21, 2016 at 4:07 PM J.F. Rick wrote: > Too funny that I guessed something that would actually work. Awesome, > > Jeff > > On Wed, Jan 20, 2016 at 5:40 PM Johan Brichau wrote: > >> Jeff, >> >> As others have mentioned, this should work as you wrote it. >> The argument to replaceWith: is any renderable. This can be component but >> also a rendering block ( [:html | ?. ] ) >> >> Just one thing: >> >> It?s better style to write: >> >> (html tag: ?b?) with: [ ?. ] instead of html html: ?? >> >> cheers >> Johan >> >> > On 19 Jan 2016, at 19:11, J.F. Rick wrote: >> > >> > I'm using AJAX a decent amount with my Seaside application. One common >> thing is to replace an IDed element with a component using something like: >> > s << (s jQuery: #event) replaceWith: self. >> > inside a "html jQuery ajax script: [ :s | ]" block. >> > >> > Is there a way to do this replacement without using a component that >> implements the renderContentOn: message? For instance, what could I just do >> to replace the #event component with this HTML: 'Success'? I'm >> hoping there's something I can do along the lines of: >> > s << (s jQuery: #event) replaceWith: [ :html | >> > html html: ''. >> > html text: (self isSuccess >> > ifTrue: [ 'Success' ] >> > ifFalse: [ 'Failed' ]). >> > html html: '' ]. >> > >> > Thanks, >> > >> > Jeff >> > _______________________________________________ >> > seaside mailing list >> > seaside@lists.squeakfoundation.org >> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> >> _______________________________________________ >> seaside mailing list >> seaside@lists.squeakfoundation.org >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20160201/aeee27d2/attachment.htm From johan at inceptive.be Fri Feb 5 08:07:25 2016 From: johan at inceptive.be (Johan Brichau) Date: Fri Feb 5 08:07:29 2016 Subject: Upload large, was: Re: [Seaside] ZINC - Kom ... In-Reply-To: <9F573AA6-7E6B-4281-96A8-2F696934AD01@inceptive.be> References: <98771D4A-2BD7-4228-B765-DCDD891BBDAC@stfx.eu> <783FD498-A3B3-41CD-BAB3-807E5D33F9EB@inceptive.be> <8EDC2A54-0773-4999-8272-FAA3966177B0@inceptive.be> <8C07E94C-7FC2-49D1-A0CA-584C6BD2FCCD@inceptive.be> <19053A84-B692-4BF8-A798-2CDD991B6904@gmx.de> <9F573AA6-7E6B-4281-96A8-2F696934AD01@inceptive.be> Message-ID: <84A849F5-8706-4CD9-A264-67FEC05FE477@inceptive.be> Hey there, I did a round-up of the code and my text, so everything is here: http://jbrichau.github.io/blog/large-file-upload-in-seaside cheers Johan > On 31 Jan 2016, at 18:30, Johan Brichau wrote: > > Hi Tobias, all, > > I just added a first version Seaside-ExternalFileUpload package to the Seaside32 repository and currently writing up a blog post detailing the nginx configuration and all other steps for it. > > If I still have time tonight, I should have a first draft of the post online. > > Btw, we also have Ajax file uploads in Seaside 3.2 > >> On 18 Jan 2016, at 20:30, Tobias Pape > wrote: >> >> >> On 18.01.2016, at 19:58, Johan Brichau > wrote: >> >>> Actually, >>> >>> I was quickly trying to find Nick?s blog post on the wayback machine but it?s not archived :( >>> >>> I did find this: http://www.squeaksource.com/fileupload/ >>> >>> I did not check what?s in there but until I can take a look, here it is already ;) >>> >> >> :D >> >>> cheers >>> Johan >>> >>>> On 18 Jan 2016, at 19:45, Tobias Pape > wrote: >>>> >>>> >>>> On 18.01.2016, at 19:43, Johan Brichau > wrote: >>>> >>>>> >>>>>> On 18 Jan 2016, at 19:34, Tobias Pape > wrote: >>>>>> >>>>>> For ss3 on GS, thats right. It actually still works well that way, but we don't have many files >>>>>> over 6MB, and more and more packages are over at github so I don't see any need to >>>>>> implement upload improvements there. >>>>> >>>>> True. I was just going to say it would not really help there since you need the file inside the db anyway. >>>>> >>>>>> On the other system, however, we hat students trying to upload some 300 MB files. >>>>>> In principle that was fine, but Nginx+FCGI+Seaside took way too long, hence my desire >>>>>> to use nginx upload. >>>>> >>>>> Ok, I?m currently heads-down in some other things, so let me take a look tomorrow on this. >>>>> This will work for Robert as well, of course :) >>>>> >>>> >>>> Take your time :) >>>> And, thank you. >>>> >>>> Best regards >>>> -Tobias >>>> >>>>> Johan >>>>> _______________________________________________ >>>>> seaside mailing list >>>>> seaside@lists.squeakfoundation.org >>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >>>> >>>> _______________________________________________ >>>> seaside mailing list >>>> seaside@lists.squeakfoundation.org >>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >>> >>> _______________________________________________ >>> seaside mailing list >>> seaside@lists.squeakfoundation.org >>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> >> _______________________________________________ >> seaside mailing list >> seaside@lists.squeakfoundation.org >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20160205/42ec1119/attachment.htm From sven at stfx.eu Fri Feb 5 09:11:18 2016 From: sven at stfx.eu (Sven Van Caekenberghe) Date: Fri Feb 5 09:11:24 2016 Subject: Upload large, was: Re: [Seaside] ZINC - Kom ... In-Reply-To: <84A849F5-8706-4CD9-A264-67FEC05FE477@inceptive.be> References: <98771D4A-2BD7-4228-B765-DCDD891BBDAC@stfx.eu> <783FD498-A3B3-41CD-BAB3-807E5D33F9EB@inceptive.be> <8EDC2A54-0773-4999-8272-FAA3966177B0@inceptive.be> <8C07E94C-7FC2-49D1-A0CA-584C6BD2FCCD@inceptive.be> <19053A84-B692-4BF8-A798-2CDD991B6904@gmx.de> <9F573AA6-7E6B-4281-96A8-2F696934AD01@inceptive.be> <84A849F5-8706-4CD9-A264-67FEC05FE477@inceptive.be> Message-ID: > On 05 Feb 2016, at 09:07, Johan Brichau wrote: > > Hey there, > > I did a round-up of the code and my text, so everything is here: http://jbrichau.github.io/blog/large-file-upload-in-seaside Thanks a lot, Johan, very nice write up. One can only imagine what would happen, what we would learn, if you blogged more than once every two years ;-) Sven > cheers > Johan > >> On 31 Jan 2016, at 18:30, Johan Brichau wrote: >> >> Hi Tobias, all, >> >> I just added a first version Seaside-ExternalFileUpload package to the Seaside32 repository and currently writing up a blog post detailing the nginx configuration and all other steps for it. >> >> If I still have time tonight, I should have a first draft of the post online. >> >> Btw, we also have Ajax file uploads in Seaside 3.2 >> >>> On 18 Jan 2016, at 20:30, Tobias Pape wrote: >>> >>> >>> On 18.01.2016, at 19:58, Johan Brichau wrote: >>> >>>> Actually, >>>> >>>> I was quickly trying to find Nick?s blog post on the wayback machine but it?s not archived :( >>>> >>>> I did find this: http://www.squeaksource.com/fileupload/ >>>> >>>> I did not check what?s in there but until I can take a look, here it is already ;) >>>> >>> >>> :D >>> >>>> cheers >>>> Johan >>>> >>>>> On 18 Jan 2016, at 19:45, Tobias Pape wrote: >>>>> >>>>> >>>>> On 18.01.2016, at 19:43, Johan Brichau wrote: >>>>> >>>>>> >>>>>>> On 18 Jan 2016, at 19:34, Tobias Pape wrote: >>>>>>> >>>>>>> For ss3 on GS, thats right. It actually still works well that way, but we don't have many files >>>>>>> over 6MB, and more and more packages are over at github so I don't see any need to >>>>>>> implement upload improvements there. >>>>>> >>>>>> True. I was just going to say it would not really help there since you need the file inside the db anyway. >>>>>> >>>>>>> On the other system, however, we hat students trying to upload some 300 MB files. >>>>>>> In principle that was fine, but Nginx+FCGI+Seaside took way too long, hence my desire >>>>>>> to use nginx upload. >>>>>> >>>>>> Ok, I?m currently heads-down in some other things, so let me take a look tomorrow on this. >>>>>> This will work for Robert as well, of course :) >>>>>> >>>>> >>>>> Take your time :) >>>>> And, thank you. >>>>> >>>>> Best regards >>>>> -Tobias >>>>> >>>>>> Johan >>>>>> _______________________________________________ >>>>>> seaside mailing list >>>>>> seaside@lists.squeakfoundation.org >>>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >>>>> >>>>> _______________________________________________ >>>>> seaside mailing list >>>>> seaside@lists.squeakfoundation.org >>>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >>>> >>>> _______________________________________________ >>>> seaside mailing list >>>> seaside@lists.squeakfoundation.org >>>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >>> >>> _______________________________________________ >>> seaside mailing list >>> seaside@lists.squeakfoundation.org >>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside >> > > _______________________________________________ > seaside mailing list > seaside@lists.squeakfoundation.org > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside From johan at inceptive.be Fri Feb 5 10:50:06 2016 From: johan at inceptive.be (Johan Brichau) Date: Fri Feb 5 10:50:12 2016 Subject: Upload large, was: Re: [Seaside] ZINC - Kom ... In-Reply-To: References: <98771D4A-2BD7-4228-B765-DCDD891BBDAC@stfx.eu> <783FD498-A3B3-41CD-BAB3-807E5D33F9EB@inceptive.be> <8EDC2A54-0773-4999-8272-FAA3966177B0@inceptive.be> <8C07E94C-7FC2-49D1-A0CA-584C6BD2FCCD@inceptive.be> <19053A84-B692-4BF8-A798-2CDD991B6904@gmx.de> <9F573AA6-7E6B-4281-96A8-2F696934AD01@inceptive.be> <84A849F5-8706-4CD9-A264-67FEC05FE477@inceptive.be> Message-ID: > On 05 Feb 2016, at 10:11, Sven Van Caekenberghe wrote: > > One can only imagine what would happen, what we would learn, if you blogged more than once every two years ;-) I probably would need to write a lot less interesting stuff :) Thanks for the appreciation. Before promising to blog more, I really want to get a new Seaside website out of the door. Next, we need all the help we can get updating the documentation. cheers Johan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20160205/850486e3/attachment.htm From goran at krampe.se Fri Feb 5 14:15:52 2016 From: goran at krampe.se (=?UTF-8?Q?G=c3=b6ran_Krampe?=) Date: Fri Feb 5 14:15:59 2016 Subject: Upload large, was: Re: [Seaside] ZINC - Kom ... In-Reply-To: References: <98771D4A-2BD7-4228-B765-DCDD891BBDAC@stfx.eu> Message-ID: <56B4AE98.8060101@krampe.se> On 01/18/2016 06:00 PM, Robert Kuszinger wrote: > *Usage*: An office need to receive large map / digital survey data files > from clients. Now they post it on CD or DVD disks, however the typical > amount is 100-200 Mb in one or two or more files (depending one who has > heard about ZIP and who hasn't :) - really! ). So we are trying to > create an upload portal where they could login and then upload files to > folders where folder name contains their ID and date. That's it. Interesting, I solved this bit in Kom waaay back: http://forum.world.st/Final-try-for-Kom-Seaside-file-upload-tuning-td98355.html regards, G?ran From heniart.thomas at gmail.com Sun Feb 7 20:54:47 2016 From: heniart.thomas at gmail.com (Thomas Heniart) Date: Sun Feb 7 20:54:49 2016 Subject: [Seaside] Bootstrap datepicker Message-ID: Hi all, For my needs, I wanted a bootstrap datepicker but I didn't found project with. So for a moment I was using the JQDatepicker which works well but is not really nice, so I made one and I just want to share it if someone else wants to use it For the moment this is in development and you won't have all options but I'm still working to improve it and already added all locales library for most of languages To load it you just have to load the configuration of this project: Bootstrap-AddOns and then load development version If you have any question or comment or critics about the code, tell me I really want to improve it ;) Cheers, Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20160207/397be1d6/attachment.htm From stormbyte at gmail.com Wed Feb 10 13:12:08 2016 From: stormbyte at gmail.com (David) Date: Wed Feb 10 13:12:09 2016 Subject: [Seaside] WAAnchor question Message-ID: <20160210141208.7c4f21d8@Zero.StormByte.org> I am trying to figure out how to make an anchor, with a callback, but with its url pointing to a page element id, so user do not have to scroll back again, for example #content I've tried several things, but can't get this to work. For the example: renderContentOn: html html div id: 'content'; with: [ "Code here" html anchor callback: [ 'example' explore ]; with: 'Clickable'. ] That will render the link in a standard format: /?_s=XXXXX&_k=YYYY&number but I'd need it to render the url with the hash also: Like: /?_s=XXXXX&_k=YYYY&number#content Is there any method I missed out for doing that? P.S. It works when no callback is specified if I say url: '#content', but I need both, the callback, and the page element id anchor. Thanks for your attention P.S.2. I am not subscribed to the list, please CC me in the answers From philippe.marschall at gmail.com Thu Feb 11 12:05:57 2016 From: philippe.marschall at gmail.com (Philippe Marschall) Date: Thu Feb 11 12:05:58 2016 Subject: [Seaside] WAAnchor question In-Reply-To: <20160210141208.7c4f21d8@Zero.StormByte.org> References: <20160210141208.7c4f21d8@Zero.StormByte.org> Message-ID: #fragment: is what you're looking for, something like html anchor callback: [ 'example' explore ]; fragment: 'content'; with: 'Clickable'. On Wed, Feb 10, 2016 at 2:12 PM, David wrote: > I am trying to figure out how to make an anchor, with a callback, but > with its url pointing to a page element id, so user do not have to > scroll back again, for example #content > > I've tried several things, but can't get this to work. > > For the example: > > renderContentOn: html > > html div id: 'content'; with: [ > "Code here" > html anchor callback: [ 'example' explore ]; with: > 'Clickable'. > ] > > That will render the link in a standard > format: /?_s=XXXXX&_k=YYYY&number but I'd need it to render the url > with the hash also: Like: /?_s=XXXXX&_k=YYYY&number#content > > Is there any method I missed out for doing that? > > P.S. It works when no callback is specified if I say url: '#content', > but I need both, the callback, and the page element id anchor. > > Thanks for your attention > > P.S.2. I am not subscribed to the list, please CC me in the answers > _______________________________________________ > seaside mailing list > seaside@lists.squeakfoundation.org > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside From stormbyte at gmail.com Thu Feb 11 14:26:04 2016 From: stormbyte at gmail.com (David) Date: Thu Feb 11 14:26:04 2016 Subject: [Seaside] WAAnchor question In-Reply-To: References: <20160210141208.7c4f21d8@Zero.StormByte.org> Message-ID: <20160211152604.5d6c11de@Zero.StormByte.org> El Thu, 11 Feb 2016 13:05:57 +0100 Philippe Marschall escribi?: > #fragment: is what you're looking for, something like > > > html anchor callback: [ 'example' explore ]; fragment: > 'content'; with: > 'Clickable'. > > On Wed, Feb 10, 2016 at 2:12 PM, David wrote: > > I am trying to figure out how to make an anchor, with a callback, > > but with its url pointing to a page element id, so user do not have > > to scroll back again, for example #content > > > > I've tried several things, but can't get this to work. > > > > For the example: > > > > renderContentOn: html > > > > html div id: 'content'; with: [ > > "Code here" > > html anchor callback: [ 'example' explore ]; with: > > 'Clickable'. > > ] > > > > That will render the link in a standard > > format: /?_s=XXXXX&_k=YYYY&number but I'd need it to render the url > > with the hash also: Like: /?_s=XXXXX&_k=YYYY&number#content > > > > Is there any method I missed out for doing that? > > > > P.S. It works when no callback is specified if I say url: > > '#content', but I need both, the callback, and the page element id > > anchor. > > > > Thanks for your attention > > > > P.S.2. I am not subscribed to the list, please CC me in the answers > > _______________________________________________ > > seaside mailing list > > seaside@lists.squeakfoundation.org > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > _______________________________________________ > seaside mailing list > seaside@lists.squeakfoundation.org > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside Oh thanks, didn't figured out what fragment method was From johan at inceptive.be Mon Feb 15 08:23:18 2016 From: johan at inceptive.be (Johan Brichau) Date: Mon Feb 15 08:23:23 2016 Subject: [Seaside] Re: [Seaside-dev] Re: Loading 3.2 in Pharo 4: In-Reply-To: <1F561B80-50BE-485B-AFF9-EF0AA0C86A2A@stfx.eu> References: <1F561B80-50BE-485B-AFF9-EF0AA0C86A2A@stfx.eu> Message-ID: <392AAD50-F7B1-44B0-A3C1-A27A68D0817E@inceptive.be> Hi, 3.2 is a ?release candidate?. The thing you hit is one of the reasons it?s still a release candidate. The Seaside-Security package does not work on Windows. I don?t know how you got the first error with WAServerManager though. When I load it the same way you do and start an adaptor, it works as intended. Do you have a bit more stack trace to know where that got sent? For the second error (WAError: no secure key generator availble because seeding failed), do not install ?Seaside-Security?. If you already did, you can ?uninstall? : WASecureKeyGenerator uninstall I think we will just remove it from the OneClick build. Unless Philippe has another idea to fix this? cheers Johan > On 14 Feb 2016, at 17:44, Sven Van Caekenberghe wrote: > > I don't know, is Seaside 3.2 even out ? Or is it just development ? > > https://ci.inria.fr/pharo-contribution/job/Seaside/ > >> On 14 Feb 2016, at 16:37, phil@highoctane.be wrote: >> >> As I saw the default was an instance of WAServerManager, I removed the contents / contents: and returned default. >> >> This got me the control panel back, I was able to add an adapter. >> >> When I asked for loading the default page, I got >> WAError: no secure key generator availble because seeding failed >> >> Your request could not be completed. An exception occurred. >> >> What's the proper way to load 3.2? Is 3.2 even supported in 4.0? Should I stick to 3.1.x ? >> >> TIA >> >> Phil >> >> >> On Sun, Feb 14, 2016 at 4:31 PM, phil@highoctane.be wrote: >> I tried to load the 3.2: >> >> (ConfigurationOfSeaside3 project version: #'release3.2') load: #('OneClick'). >> >> ... and when accessing the control panel, got an error: >> >> MNU: WAServerManager contents >> >> Version 3.1 loads nicely and control panel works. Just have to add an adapter and start it. >> >> Any idea of what is going south here? >> >> TIA >> Phil >> >> >> >> >> _______________________________________________ >> seaside-dev mailing list >> seaside-dev@lists.squeakfoundation.org >> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev > > _______________________________________________ > seaside-dev mailing list > seaside-dev@lists.squeakfoundation.org > http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev From recursive68 at gmail.com Fri Feb 19 22:58:10 2016 From: recursive68 at gmail.com (recursive68@gmail.com) Date: Fri Feb 19 22:58:11 2016 Subject: [Seaside] Reef Examples Message-ID: Hi, I'm trying to use REEF but can only find a few limited examples which aren't helping really. Does anyone know for example how I would update a RETextField value when a REButton is clicked ? I found this example someone answered to the query I had but it doesn't work: REForm subclass: #MyForm instanceVariableNames: 'textFieldContents' classVariableNames: '' poolDictionaries: '' category: 'ReefSample1-View'. textFieldContents ^textFieldContents textFieldContents: aString textFieldContents := aString initializeContents self add: (RETextField new on: #textFieldContents of: self). self add: (REButton new label: 'Try me!'; callback: [ self triggerThenDo: [ self inform: self textFieldContents ]]). All it does is generate a dialog box when the button is clicked. I don't know if the inform: method has changed since that was written but either way it doesn't update the textfield value when the button is clicked. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20160219/050e4cf3/attachment.htm From marianopeck at gmail.com Tue Feb 23 16:37:54 2016 From: marianopeck at gmail.com (Mariano Martinez Peck) Date: Tue Feb 23 16:37:56 2016 Subject: [Seaside] How to escape single quotes in generated JSON? Message-ID: Hi guys, I am trying to serialize a dictionary form Smalltalk with either NeoJSON or with Seaside's #asJson. Imagine something like this: | infoDict stream | stream := String new writeStream. infoDict := Dictionary new. * infoDict at: 'exception' put: 'a ''escape this'' aa'.* Note that the string of 'exception' may contain single quotes inside. Then, at some point I do: *self requestContext responseGenerator response nextPutAll: (infoDict asJson).* Problem is the string arrives without any escaping so....when I try to do this at client side from that string: jQuery.parseJSON(variableContainingThatString); I get an error as single quotes inside the double quotes do not seem allowed. I tried a lot of combinations of *"JSON.stringify*" or things like: variableContainingThatString*.replace(/[\\"'']/g, ''\\$&'').replace(/\u0000/g, ''\\0''); * but none work... So..I wonder...can I simply escape this from server side at the time I serialize to JSON? Any special way of doing this or I hack on the resulting string? Thanks in advance, -- Mariano http://marianopeck.wordpress.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20160223/57f498ae/attachment.htm From sven at stfx.eu Tue Feb 23 17:34:47 2016 From: sven at stfx.eu (Sven Van Caekenberghe) Date: Tue Feb 23 17:34:47 2016 Subject: [Seaside] How to escape single quotes in generated JSON? In-Reply-To: References: Message-ID: Hi Mariano, I am not sure what your specific problem is, but strings in JSON are delimited with double quotes and only double quotes should be escaped, not single quotes. https://tools.ietf.org/html/rfc7158#page-8 NeoJSONWriter toString: { 'exception' -> 'a ''escape this'' aa' } asDictionary. "'{""exception"":""a ''escape this'' aa""}'" STON uses single quoted strings (like Smalltalk), hence escapes them. STON toString: { 'exception' -> 'a ''escape this'' aa' } asDictionary. "'{''exception'':''a \''escape this\'' aa''}'" Note the confusing escaping done by Smalltalk, better inspect the results !! This won't solve your problem though, I know. Sven > On 23 Feb 2016, at 17:37, Mariano Martinez Peck wrote: > > Hi guys, > > I am trying to serialize a dictionary form Smalltalk with either NeoJSON or with Seaside's #asJson. Imagine something like this: > > | infoDict stream | > stream := String new writeStream. > infoDict := Dictionary new. > infoDict at: 'exception' put: 'a ''escape this'' aa'. > > Note that the string of 'exception' may contain single quotes inside. > > Then, at some point I do: > > self requestContext responseGenerator response nextPutAll: (infoDict asJson). > > > Problem is the string arrives without any escaping so....when I try to do this at client side from that string: > > jQuery.parseJSON(variableContainingThatString); > > I get an error as single quotes inside the double quotes do not seem allowed. > I tried a lot of combinations of "JSON.stringify" or things like: > > variableContainingThatString.replace(/[\\"'']/g, ''\\$&'').replace(/\u0000/g, ''\\0''); > > but none work... > > So..I wonder...can I simply escape this from server side at the time I serialize to JSON? Any special way of doing this or I hack on the resulting string? > > Thanks in advance, > > > -- > Mariano > http://marianopeck.wordpress.com > _______________________________________________ > seaside mailing list > seaside@lists.squeakfoundation.org > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside From marianopeck at gmail.com Mon Feb 29 00:03:26 2016 From: marianopeck at gmail.com (Mariano Martinez Peck) Date: Mon Feb 29 00:03:28 2016 Subject: [Seaside] [ANN] SeasideDynamicVariablesDebugger [WAS] Re: [ANN]: WADynamicVariablesErrorHandler (let me know if I should integrate this) Message-ID: Dear all, This is a quick email to let you know that I pushed the code into it's ow repository with all the needed documentation: https://github.com/marianopeck/SeasideDynamicVariablesDebugger Cheers, On Mon, Dec 7, 2015 at 3:36 PM, Mariano Martinez Peck wrote: > Dear all, > > For those that have used Seaside, and you try to debug with the Debugger, > you know that upon request processing seaside uses Exceptions mechanism to > always have access to the current request, error handler, etc. The way that > this is done is via subclasses of WADynamicVariable: > > WACurrentRequestContext use: self during: aBlock > > In that case, "self" is the request instance and "aBlock" the closure that > takes care of the request processing. So, inside that closure, everywhere > you do "WACurrentRequestContext value" you get the correct request instance. > > Once inside the debugger, things get complicated. While you can restart, > proceed, etc (because the process you are debugging is inside the scope of > the dynamic variables), you cannot evaluate any piece of code that at the > end use the session or request because you get a WARequestContextNotFound > kind of error. The reason is obvious: The evaluation, do-it, print-it, etc > etc you on a piece of text or via the debugger inspector, creates another > closure/context which is not in the scope of the dynamic variables. > > For a client, we also have custom subclasses of WADynamicVariable, for > example UserContextInformation. And that means that almost every time in > the debugger I really need access to that object. > > To solve that issue, I create a project which is actually a proof of > concept: Check package SeasidePharoDebugging from > http://smalltalkhub.com/#!/~marianopeck/MarianoPublic > It does work for me, and if you think this could be useful for Seaside > itself, I can commit it there. > > The idea is very simple. I have a WADynamicVariablesErrorHandler subclass > of WADebugErrorHandler. We reimplements there #handleException: in order to > simply iterate all values of all dynamic variables (all WADynamicVaraible > subclasses) and store those into a dictionary in a class variable of > WADynamicVariablesErrorHandler. > > Then, I simply override (this is the part that must be cleared if we > integrate this in Seaside) WADynamicVarible >> #defaultAction to be > something like this: > > WADynamicVarible >> #defaultAction > ^ (WADynamicVariablesErrorHandler storedDynamicVariable: self class) > ifNil: [ self class defaultValue ] > > That way... when we handle an exception, we save out all values into a > class side. And then, in the debugger, whenever we evaluate, inspect, print > etc anything that would do a #value over a WADynamicVariable subclass, it > ends up calling #defaultAction (because there will be no handler in the > stack) and there, we first check if the have the value for that dynamic > variable. If we do, we answer that, if not, the defaultValue :) > > There are tests too. There is WACurrentRequestDebuggingTest which you can > try from /tests/seasidepharodebugging > > For the user, there is almost nothing to do. All WADynamicVariable > subclasses are managed automatically. All you need is to register the > exception handler: > > app filter configuration at: #exceptionHandler put: > WADynamicVariablesErrorHandler. > > The only drawback here is that this doesn't work with multiple debuggers > as the last debugger will override the class variable values and hence the > OLD already opened debuggers will be getting a wrong (the latest) value for > the dynamic variables. > > What do you think? I think that while it might not be the best solution > and it has limits, it is every is extremely simple and does the job. > Maybe you see problems I am not seeing? > > Let me know if do you want this integrated or not. In the meanwhile, I am > loading it from my repo for my apps and keeping the override (I would like > to get rid of it!!!). > > Best, > > -- > Mariano > http://marianopeck.wordpress.com > -- Mariano http://marianopeck.wordpress.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20160228/465272e0/attachment-0001.htm