[Lift] Re: SHtml.a not active when used via innerHtml

2009-09-25 Thread KP

David,

This works like a charm. Thanks. There is essentially zero chance I
would have figured this out on my own.

KP


On Sep 24, 7:13 pm, David Pollak 
wrote:
> There is a trait in JsCommands:
>
> trait HtmlFixer {
>   def fixHtml(uid: String, content: NodeSeq): String =
>   AltXML.toXML(Group(S.session.map(s =>
> s.fixHtml(s.processSurroundAndInclude("JS SetHTML id: "+uid,
> content))).openOr(content)),
>                false, true, S.ieMode).encJs
>
> }
>
> What this trait does it it rewrites the content such that it is ready to be
> displayed.  This means updating any links based on the context path,
> rewriting any  tags, running snippets and generally making the
> XHTML clean.
>
> I would suggest running your intermediate XHTML through this method and
> it'll come out working as you expect it to.
>
>
>
>
>
> On Tue, Sep 22, 2009 at 9:46 PM, KP  wrote:
>
> > Hello,
>
> > Doing that appears not to help the issue. The thing I called
> > customJSStr above now looks like
>
> > document.getElementById('foo').innerHTML = ' > key="F859002372055OWM">bar';
>
> > (with "'s properly handled by encJs), and the behavior appears to be
> > unchanged. Is there some sort of setup of the  that doesn't
> > get to take place when I update the page like this, perhaps?
>
> > Thanks much,
> > KP
>
> > On Sep 22, 9:55 pm, David Pollak 
> > wrote:
> > > On Tue, Sep 22, 2009 at 7:49 PM, KP 
> > wrote:
>
> > > > Hi all.
>
> > > > I have essentially the following setup in a website:
>
> > > > class AjaxTest {
> > > >   def render =
> > > >      
> > > >         foo
> > > >         {getAjaxForm}
> > > >      
>
> > > >   def getAjaxForm = SHtml.ajaxForm(
> > > >         SHtml.submit("submit", () => ()),
> > > >         Run(customJSStr))
>
> > > >   def customJSStr = "document.getElementById('foo').innerHTML = '" +
> > > > aStr + "';"
>
> > > If aStr contains a single or double quote or a non-printable or non-ascii
> > > character, your expression will fail (it will be invalid JavaScript).
>
> > > I would suggest:
>
> > > def customJSStr = "document.getElementById('foo').innerHTML = "
> > +aStr.encJs
> > > + ";"
>
> > > That will properly escape the string as a JavaScript string.
>
> > > >   val aStr = SHtml.a(() => SetHtml("foo", Text("baz")), Text
> > > > ("bar")).toString
> > > > }
>
> > > > when aStr is displayed (with text 'bar'), the link is inactive.
>
> > > > I'm using Run(customJSStr) instead of SetHtml as, in the actual app,
> > > > the situation is slightly more complicated (and the RHS of the
> > > > assignment operator in the javascript expression has some more stuff
> > > > fetched from the document).
>
> > > > Note also that if the ajaxForm uses SetHtml() instead of Run() it
> > > > works as expected.
>
> > > > So the question is -- is there a straightforward explanation for
> > > > what's going on here (I'm still kinda cargo-culting lift).
>
> > > > And, unconditional upon the answer to the last question, is there a
> > > > way to make aStr a valid, active link (or, I guess, string
> > > > representing one) while retaining the ability to have an arbitrarily
> > > > complex javascript expression in customJSStr (this would actually be
> > > > defined in a separate js file, of course).
>
> > > > Thanks much,
> > > > KP
>
> > > --
> > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > Follow me:http://twitter.com/dpp
> > > Git some:http://github.com/dpp
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Surf the harmonics

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Code Plugability in Lift

2009-09-25 Thread Timothy Perrett
Are you feeling OK david? For a moment I thought you said *runtime*  
bytecode generation?!

Cheers, Tim

On 25 Sep 2009, at 23:06, David Pollak wrote:

> I've been thinking about vomitting (I mean creating) bytecode at  
> runtime that creates a mock class for Hibernate consumption.
>
> On Fri, Sep 25, 2009 at 3:01 PM, Derek Chen-Becker  > wrote:
> I've been thinking about it in the back of my head. I may be able to  
> get something working that's vendor specific (e.g. Hibernate) by  
> using their internal API to have the Record+JPA driver wire up the  
> entities at runtime based on Record metadata. Feels kinda dirty, but  
> if it works that would be great.
>
> Derek
>
>
> On Mon, Sep 21, 2009 at 4:29 PM, Timothy Perrett  > wrote:
>
> I know we've discussed this before, but ultimately we'd like to wrap
> JPA with a Record front end somehow...
>
> Cheers, Tim
>
> On Sep 21, 10:42 pm, David Pollak 
> wrote:
> > On Mon, Sep 21, 2009 at 2:03 PM, glenn  wrote:
> >
> > > David,
> >
> > > Does this mean you could write an entity class, like so:
> >
> > > class User(val firstName: String, val lastName: String, val  
> userName:
> > > String, val email: String, val password: String) with myTrait  
> {...}
> >
> > > and it would be useable in either a JPA or mapper or record
> > > implementation?
> >
> > No.  Mapper/Record require a richer representation of fields than  
> Pojos.
> >  The reason for this can be found 
> > athttp://blog.lostlake.org/index.php?/archives/19-Keeping-the-meaning-w 
> ...
> >
> >
> >
> >
> >
> >
> >
> > > That would be the ticket.
> >
> > > Glenn
> >
> > > On Sep 21, 12:47 pm, David Pollak 
> > > wrote:
> > > > This is an impedance mis-match between POJOs (what JPA  
> expects) and the
> > > > richer fields that Mapper and Record have.
> > > > I'm working on an interface (
> > >http://github.com/dpp/liftweb/blob/master/lift-util/src/main/ 
> scala/ne...)
> > > > that should be a base trait on everything in Lift that's  
> gettable or
> > > > gettable/settable.
> >
> > > > Then you could write a trait that looks like:
> >
> > > > trait MyThing {  def name: PSettableValueHolder[String]
> > > > *
> > > > *
> > > > * def getName(): String = name.is*
> > > > * def setName(in: String) = name.set(in)*
> > > > *
> > > > *
> > > > * *
> >
> > > > }
> >
> > > > Such a trait should be able to bridge a JPA implementation and  
> a Lift
> > > mapper
> > > > implementation.
> >
> > > > If you've got a better solution, please code it up and let's  
> talk about
> > > it.
> >
> > > > On Mon, Sep 21, 2009 at 9:31 AM, glenn  wrote:
> >
> > > > > Forgive me. I'm bringing up the subject of modularization in  
> Lift
> > > > > under a new heading, but the last discussion was, sadly, all  
> over the
> > > > > map and only served to emphasize the problem. So let me  
> narrow it
> > > > > down, a bit, here, and ask:
> >
> > > > > How is it possible to create two different snippet  
> implementations, or
> > > > > two different models, one JPA and one not, or one using the  
> mapper
> > > > > framework and another the record, and replace one with the  
> other
> > > > > without having to recompile the application?
> >
> > > > > We're not talking here about interface design - you still  
> have to deal
> > > > > with boot.  And traits, as has been suggested by  
> others...well, you'd
> > > > > better not expose them to the world outside your  
> implementation, as
> > > > > any changes would require recompilation. In other words, you  
> can't
> > > > > really use traits for your interface.
> >
> > > > > To use Lift in the enterprise does require that teams be  
> able to work
> > > > > independently, doesn't it.
> >
> > > > > Glenn
> >
> > > > --
> > > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > > Follow me:http://twitter.com/dpp
> > > > Git some:http://github.com/dpp
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Git some:http://github.com/dpp
>
>
>
>
>
>
>
> -- 
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Surf the harmonics
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Code Plugability in Lift

2009-09-25 Thread David Pollak
I've been thinking about vomitting (I mean creating) bytecode at runtime
that creates a mock class for Hibernate consumption.

On Fri, Sep 25, 2009 at 3:01 PM, Derek Chen-Becker wrote:

> I've been thinking about it in the back of my head. I may be able to get
> something working that's vendor specific (e.g. Hibernate) by using their
> internal API to have the Record+JPA driver wire up the entities at runtime
> based on Record metadata. Feels kinda dirty, but if it works that would be
> great.
>
> Derek
>
>
> On Mon, Sep 21, 2009 at 4:29 PM, Timothy Perrett 
> wrote:
>
>>
>> I know we've discussed this before, but ultimately we'd like to wrap
>> JPA with a Record front end somehow...
>>
>> Cheers, Tim
>>
>> On Sep 21, 10:42 pm, David Pollak 
>> wrote:
>> > On Mon, Sep 21, 2009 at 2:03 PM, glenn  wrote:
>> >
>> > > David,
>> >
>> > > Does this mean you could write an entity class, like so:
>> >
>> > > class User(val firstName: String, val lastName: String, val userName:
>> > > String, val email: String, val password: String) with myTrait {...}
>> >
>> > > and it would be useable in either a JPA or mapper or record
>> > > implementation?
>> >
>> > No.  Mapper/Record require a richer representation of fields than Pojos.
>> >  The reason for this can be found athttp://
>> blog.lostlake.org/index.php?/archives/19-Keeping-the-meaning-w...
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > That would be the ticket.
>> >
>> > > Glenn
>> >
>> > > On Sep 21, 12:47 pm, David Pollak 
>> > > wrote:
>> > > > This is an impedance mis-match between POJOs (what JPA expects) and
>> the
>> > > > richer fields that Mapper and Record have.
>> > > > I'm working on an interface (
>> > >
>> http://github.com/dpp/liftweb/blob/master/lift-util/src/main/scala/ne...)
>> > > > that should be a base trait on everything in Lift that's gettable or
>> > > > gettable/settable.
>> >
>> > > > Then you could write a trait that looks like:
>> >
>> > > > trait MyThing {  def name: PSettableValueHolder[String]
>> > > > *
>> > > > *
>> > > > * def getName(): String = name.is*
>> > > > * def setName(in: String) = name.set(in)*
>> > > > *
>> > > > *
>> > > > * *
>> >
>> > > > }
>> >
>> > > > Such a trait should be able to bridge a JPA implementation and a
>> Lift
>> > > mapper
>> > > > implementation.
>> >
>> > > > If you've got a better solution, please code it up and let's talk
>> about
>> > > it.
>> >
>> > > > On Mon, Sep 21, 2009 at 9:31 AM, glenn  wrote:
>> >
>> > > > > Forgive me. I'm bringing up the subject of modularization in Lift
>> > > > > under a new heading, but the last discussion was, sadly, all over
>> the
>> > > > > map and only served to emphasize the problem. So let me narrow it
>> > > > > down, a bit, here, and ask:
>> >
>> > > > > How is it possible to create two different snippet
>> implementations, or
>> > > > > two different models, one JPA and one not, or one using the mapper
>> > > > > framework and another the record, and replace one with the other
>> > > > > without having to recompile the application?
>> >
>> > > > > We're not talking here about interface design - you still have to
>> deal
>> > > > > with boot.  And traits, as has been suggested by others...well,
>> you'd
>> > > > > better not expose them to the world outside your implementation,
>> as
>> > > > > any changes would require recompilation. In other words, you can't
>> > > > > really use traits for your interface.
>> >
>> > > > > To use Lift in the enterprise does require that teams be able to
>> work
>> > > > > independently, doesn't it.
>> >
>> > > > > Glenn
>> >
>> > > > --
>> > > > Lift, the simply functional web frameworkhttp://liftweb.net
>> > > > Beginning Scalahttp://www.apress.com/book/view/1430219890
>> > > > Follow me:http://twitter.com/dpp
>> > > > Git some:http://github.com/dpp
>> >
>> > --
>> > Lift, the simply functional web frameworkhttp://liftweb.net
>> > Beginning Scalahttp://www.apress.com/book/view/1430219890
>> > Follow me:http://twitter.com/dpp
>> > Git some:http://github.com/dpp
>>
>>
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Code Plugability in Lift

2009-09-25 Thread Derek Chen-Becker
I've been thinking about it in the back of my head. I may be able to get
something working that's vendor specific (e.g. Hibernate) by using their
internal API to have the Record+JPA driver wire up the entities at runtime
based on Record metadata. Feels kinda dirty, but if it works that would be
great.

Derek

On Mon, Sep 21, 2009 at 4:29 PM, Timothy Perrett wrote:

>
> I know we've discussed this before, but ultimately we'd like to wrap
> JPA with a Record front end somehow...
>
> Cheers, Tim
>
> On Sep 21, 10:42 pm, David Pollak 
> wrote:
> > On Mon, Sep 21, 2009 at 2:03 PM, glenn  wrote:
> >
> > > David,
> >
> > > Does this mean you could write an entity class, like so:
> >
> > > class User(val firstName: String, val lastName: String, val userName:
> > > String, val email: String, val password: String) with myTrait {...}
> >
> > > and it would be useable in either a JPA or mapper or record
> > > implementation?
> >
> > No.  Mapper/Record require a richer representation of fields than Pojos.
> >  The reason for this can be found athttp://
> blog.lostlake.org/index.php?/archives/19-Keeping-the-meaning-w...
> >
> >
> >
> >
> >
> >
> >
> > > That would be the ticket.
> >
> > > Glenn
> >
> > > On Sep 21, 12:47 pm, David Pollak 
> > > wrote:
> > > > This is an impedance mis-match between POJOs (what JPA expects) and
> the
> > > > richer fields that Mapper and Record have.
> > > > I'm working on an interface (
> > >http://github.com/dpp/liftweb/blob/master/lift-util/src/main/scala/ne..
> .)
> > > > that should be a base trait on everything in Lift that's gettable or
> > > > gettable/settable.
> >
> > > > Then you could write a trait that looks like:
> >
> > > > trait MyThing {  def name: PSettableValueHolder[String]
> > > > *
> > > > *
> > > > * def getName(): String = name.is*
> > > > * def setName(in: String) = name.set(in)*
> > > > *
> > > > *
> > > > * *
> >
> > > > }
> >
> > > > Such a trait should be able to bridge a JPA implementation and a Lift
> > > mapper
> > > > implementation.
> >
> > > > If you've got a better solution, please code it up and let's talk
> about
> > > it.
> >
> > > > On Mon, Sep 21, 2009 at 9:31 AM, glenn  wrote:
> >
> > > > > Forgive me. I'm bringing up the subject of modularization in Lift
> > > > > under a new heading, but the last discussion was, sadly, all over
> the
> > > > > map and only served to emphasize the problem. So let me narrow it
> > > > > down, a bit, here, and ask:
> >
> > > > > How is it possible to create two different snippet implementations,
> or
> > > > > two different models, one JPA and one not, or one using the mapper
> > > > > framework and another the record, and replace one with the other
> > > > > without having to recompile the application?
> >
> > > > > We're not talking here about interface design - you still have to
> deal
> > > > > with boot.  And traits, as has been suggested by others...well,
> you'd
> > > > > better not expose them to the world outside your implementation, as
> > > > > any changes would require recompilation. In other words, you can't
> > > > > really use traits for your interface.
> >
> > > > > To use Lift in the enterprise does require that teams be able to
> work
> > > > > independently, doesn't it.
> >
> > > > > Glenn
> >
> > > > --
> > > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > > Follow me:http://twitter.com/dpp
> > > > Git some:http://github.com/dpp
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Git some:http://github.com/dpp
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: ANNOUNCE: New functionality for Mapper logging with breaking changes

2009-09-25 Thread Derek Chen-Becker
I would vote in favor of deprecation/removal. Vote?

On Sat, Sep 19, 2009 at 11:35 PM, Vassil  wrote:

>
> Hello,
>
> Shouldn't S.logQuery and S.queryLog be updated as well or deprecated
> if they're not going to be used the way they were as parameters to
> DB.addLogFun?
>
> Thanks,
> Vassil
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Speaking at Developer Day in Boulder

2009-09-25 Thread Derek Chen-Becker
I don't think so, but I'll check.

On Sat, Sep 19, 2009 at 11:08 PM, marius d.  wrote:

>
> coool! ... will be taped ?
>
> br's,
> Marius
>
> On Sep 19, 2:45 pm, Derek Chen-Becker  wrote:
> > FYI, for anyone in the Denver/Boulder area, I'll be giving an intro talk
> > on Scala at the Developer Day, Boulder event on October 10th:
> >
> > http://developer-day.com/events/2009-boulder.html
> >
> > There will be a pretty wide variety of presentations there, so I hope
> > this will help spread the word on Scala to a wider audience!
> >
> > Cheers,
> >
> > Derek
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Struggling with mapping a list of objects

2009-09-25 Thread ben

I must apologise ... I've been an idiot.
I did read the wiki article on how to do the OneToMany thing, but
rather than cu't'n'paste the example, and get it working, and then
refactor for my domain, I took the bits I thought I needed to make it
work, and then ran into these compiler issues.

I've now realised (thanks to the post about the object must extend
OneToMany) that I missed the mixin OneToMany, and was just using IdPK.
I've now got it compiling.

Thanks again to all your replies,  I do appreciate your time.

Ben
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Struggling with mapping a list of objects

2009-09-25 Thread Naftoli Gugenheim

Did you read the wiki article? MappedOneToMany is only available inside a class 
that extends OneToMany, so your Mapper should extend it.

-
ben wrote:


Just an update ...

I did manage to get maven to pull down 1.1-M5, not sure what was up
with it before, but it worked in the morning.
I couldn't resolve the class MappedOneToMany, or Owned, even though I
can see them in the lift-mapper-1.1-M5.jar . Used the import import
net.liftweb.mapper._

Oh well, I got around it in a horrible way by in effect serializing
the list of objects I wanted to save as XML and storing them in a
MappedText field. It works, but its grim.

Thanks for your help though everyone, the support on this list is
great, and lift is a breath of fresh air.

Cheers,
Ben


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Struggling with mapping a list of objects

2009-09-25 Thread Thomas Rampelberg

Are you extending your table class with OneToMany[Long, ClassName] ?
Both of those are included in the OneToMany trait itself. ex:

class Foo extends LongKeyedMapper[Foo] with OneToMany[Long, Foo]

Sorry about forgetting to include that in my previous post =/

On Fri, Sep 25, 2009 at 11:11 AM, ben  wrote:
>
> Just an update ...
>
> I did manage to get maven to pull down 1.1-M5, not sure what was up
> with it before, but it worked in the morning.
> I couldn't resolve the class MappedOneToMany, or Owned, even though I
> can see them in the lift-mapper-1.1-M5.jar . Used the import import
> net.liftweb.mapper._
>
> Oh well, I got around it in a horrible way by in effect serializing
> the list of objects I wanted to save as XML and storing them in a
> MappedText field. It works, but its grim.
>
> Thanks for your help though everyone, the support on this list is
> great, and lift is a breath of fresh air.
>
> Cheers,
> Ben
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Struggling with mapping a list of objects

2009-09-25 Thread David Pollak
On Fri, Sep 25, 2009 at 11:11 AM, ben  wrote:

>
> Just an update ...
>
> I did manage to get maven to pull down 1.1-M5, not sure what was up
> with it before, but it worked in the morning.
> I couldn't resolve the class MappedOneToMany, or Owned, even though I
> can see them in the lift-mapper-1.1-M5.jar . Used the import import
> net.liftweb.mapper._
>
> Oh well, I got around it in a horrible way by in effect serializing
> the list of objects I wanted to save as XML and storing them in a
> MappedText field. It works, but its grim.
>

Personally, I like that approach and use it quite frequently.

If the data is not part of a query, then putting it into the RDBMS as a blob
makes a lot of sense.


>
> Thanks for your help though everyone, the support on this list is
> great, and lift is a breath of fresh air.
>
> Cheers,
> Ben
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: redirectTo throwing net.liftweb.http.ResponseShortcutException: Shortcut

2009-09-25 Thread Naftoli Gugenheim

Try calling registerThisSnippet in the redirect function.

-
David wrote:


Thank you, that mostly worked!

I forgot to mention that I'm using StatefulSnippet, and the place
where the redirect is happening should redirect to a different url,
but the different url is backed by the same StatefulSnippet instance.
So when I use JsCmds.RedirectTo I'm not getting the same
StatefulSnippet instance.  Is there a way to redirect that will
preserve my StatefulSnippet instance?

url/a(StatefulSnippet)
  -> links to url/b(StatefulSnippet) using super.link()
  url/b - redirects back to url/a

url/a is a grid, with a starting 'page' number, and url/b is a edit
form.  When the user is done with url/b they click 'save' which sends
them back to url/a, hopefully at the same place in the grid.  When
returning to the grid from the edit page, the grid is reloading from
the beginning.   I need a way to preserve the original StatefulSnippet
instance.

Thanks, Dave

On Sep 25, 4:26 am, Timothy Perrett  wrote:
> Just realised your using ajaxForm... in that case you need to do  
> RedirectTo JsCmd which will effectively send a window.location.href to  
> the browser.
>
> Cheers, Tim
>
> On 24 Sep 2009, at 21:49, David wrote:
>
>
>
> > Hello lifters,
> > I have the following form and bind:
> >    SHtml.ajaxForm(
> >      bind("ajax", xhtml,
> >           "view" -> doView _,
> >           "save" -> SHtml.ajaxButton(
> >             "Save",
> >             {() =>
> >               Log.info("Got a 'save' AJAX call")
> >              this.redirectTo("/redirect1") //workflow/index2
> >            }, ("class", "ui-state-default ui-corner-all"
>
> > When the 'Save' ajax button is called, the redirect should be invoked,
> > that is working.  However I get the exception below.   Based on what
> > I've read, this exception should be handled by lift.  I don't have any
> > explicit exception handling in my code.
>
> > Is there a bug here, is my redirect correct?  I've also tried adding
> > this to my Boot.scala:
> >    LiftRules.dispatch.prepend {
> >      case Req("redirect1" :: _, _, _) => () =>
> >        Full(RedirectWithState("/workflow/index2",
> >                               RedirectState(() => println("Called on
> > redirect!"),
> >                                             "My error" ->
> > NoticeType.Error)))
>
> > Thanks for any suggestions or help.
>
> > -Dave
> > 16:44:14.097 [12569...@qtp-1983971-5] WARN  lift.warn:114 - Request
> > for /ajax_request/F664660567847L4N/ failed Shortcut
> > net.liftweb.http.ResponseShortcutException: Shortcut
> >    at net.liftweb.http.ResponseShortcutException$.redirect
> > (ResponseShortcutException.scala:31) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.ResponseShortcutException$.redirect
> > (ResponseShortcutException.scala:35) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.S$.redirectTo(S.scala:759) [lift-webkit-1.1-
> > SNAPSHOT.jar:na]
> >    at net.liftweb.http.StatefulSnippet$class.redirectTo(Stateful.scala:
> > 77) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at snippet.Workflow.redirectTo(Workflow.scala:31) [classes/:na]
> >    at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:151)
> > [classes/:na]
> >    at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:149)
> > [classes/:na]
> >    at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala:
> > 1843) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala:
> > 1843) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na]
> >    at net.liftweb.http.S$NFuncHolder.apply(S.scala:1843) [lift-
> > webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftSession$$anonfun$buildFunc$1$2.apply
> > (LiftSession.scala:323) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply
> > (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply
> > (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na]
> >    at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala:
> > 338) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala:
> > 327) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at scala.List.flatMap(List.scala:1132) [scala-library-2.7.5.jar:na]
> >    at net.liftweb.http.LiftSession.runParams(LiftSession.scala:327)
> > [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftServlet.handleAjax(LiftServlet.scala:286)
> > [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftServlet.net$liftweb$http$LiftServlet$
> > $dispatchStatefulRequest(LiftServlet.scala:253) [lift-webkit-1.1-
> > SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala:
> > 172) [lift-we

[Lift] Re: Struggling with mapping a list of objects

2009-09-25 Thread ben

Just an update ...

I did manage to get maven to pull down 1.1-M5, not sure what was up
with it before, but it worked in the morning.
I couldn't resolve the class MappedOneToMany, or Owned, even though I
can see them in the lift-mapper-1.1-M5.jar . Used the import import
net.liftweb.mapper._

Oh well, I got around it in a horrible way by in effect serializing
the list of objects I wanted to save as XML and storing them in a
MappedText field. It works, but its grim.

Thanks for your help though everyone, the support on this list is
great, and lift is a breath of fresh air.

Cheers,
Ben
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: redirectTo throwing net.liftweb.http.ResponseShortcutException: Shortcut

2009-09-25 Thread David

Thank you, that mostly worked!

I forgot to mention that I'm using StatefulSnippet, and the place
where the redirect is happening should redirect to a different url,
but the different url is backed by the same StatefulSnippet instance.
So when I use JsCmds.RedirectTo I'm not getting the same
StatefulSnippet instance.  Is there a way to redirect that will
preserve my StatefulSnippet instance?

url/a(StatefulSnippet)
  -> links to url/b(StatefulSnippet) using super.link()
  url/b - redirects back to url/a

url/a is a grid, with a starting 'page' number, and url/b is a edit
form.  When the user is done with url/b they click 'save' which sends
them back to url/a, hopefully at the same place in the grid.  When
returning to the grid from the edit page, the grid is reloading from
the beginning.   I need a way to preserve the original StatefulSnippet
instance.

Thanks, Dave

On Sep 25, 4:26 am, Timothy Perrett  wrote:
> Just realised your using ajaxForm... in that case you need to do  
> RedirectTo JsCmd which will effectively send a window.location.href to  
> the browser.
>
> Cheers, Tim
>
> On 24 Sep 2009, at 21:49, David wrote:
>
>
>
> > Hello lifters,
> > I have the following form and bind:
> >    SHtml.ajaxForm(
> >      bind("ajax", xhtml,
> >           "view" -> doView _,
> >           "save" -> SHtml.ajaxButton(
> >             "Save",
> >             {() =>
> >               Log.info("Got a 'save' AJAX call")
> >              this.redirectTo("/redirect1") //workflow/index2
> >            }, ("class", "ui-state-default ui-corner-all"
>
> > When the 'Save' ajax button is called, the redirect should be invoked,
> > that is working.  However I get the exception below.   Based on what
> > I've read, this exception should be handled by lift.  I don't have any
> > explicit exception handling in my code.
>
> > Is there a bug here, is my redirect correct?  I've also tried adding
> > this to my Boot.scala:
> >    LiftRules.dispatch.prepend {
> >      case Req("redirect1" :: _, _, _) => () =>
> >        Full(RedirectWithState("/workflow/index2",
> >                               RedirectState(() => println("Called on
> > redirect!"),
> >                                             "My error" ->
> > NoticeType.Error)))
>
> > Thanks for any suggestions or help.
>
> > -Dave
> > 16:44:14.097 [12569...@qtp-1983971-5] WARN  lift.warn:114 - Request
> > for /ajax_request/F664660567847L4N/ failed Shortcut
> > net.liftweb.http.ResponseShortcutException: Shortcut
> >    at net.liftweb.http.ResponseShortcutException$.redirect
> > (ResponseShortcutException.scala:31) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.ResponseShortcutException$.redirect
> > (ResponseShortcutException.scala:35) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.S$.redirectTo(S.scala:759) [lift-webkit-1.1-
> > SNAPSHOT.jar:na]
> >    at net.liftweb.http.StatefulSnippet$class.redirectTo(Stateful.scala:
> > 77) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at snippet.Workflow.redirectTo(Workflow.scala:31) [classes/:na]
> >    at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:151)
> > [classes/:na]
> >    at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:149)
> > [classes/:na]
> >    at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala:
> > 1843) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala:
> > 1843) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na]
> >    at net.liftweb.http.S$NFuncHolder.apply(S.scala:1843) [lift-
> > webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftSession$$anonfun$buildFunc$1$2.apply
> > (LiftSession.scala:323) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply
> > (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply
> > (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na]
> >    at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala:
> > 338) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala:
> > 327) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at scala.List.flatMap(List.scala:1132) [scala-library-2.7.5.jar:na]
> >    at net.liftweb.http.LiftSession.runParams(LiftSession.scala:327)
> > [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftServlet.handleAjax(LiftServlet.scala:286)
> > [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftServlet.net$liftweb$http$LiftServlet$
> > $dispatchStatefulRequest(LiftServlet.scala:253) [lift-webkit-1.1-
> > SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala:
> > 172) [lift-webkit-1.1-SNAPSHOT.jar:na]
> >    at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala:
> > 172) [l

[Lift] Re: Concurrent Web Service Requests?

2009-09-25 Thread Timothy Perrett
Looks great :-) can't wait to see this in master.

Cheers, Tim

Sent from my iPhone

On 25 Sep 2009, at 18:02, David Pollak   
wrote:

>
>
> On Thu, Sep 24, 2009 at 11:33 AM, Naftoli Gugenheim  > wrote:
>
> If you like the idea of having them all as attributes but don't like  
> the idea of using a single attribute ('xx:eager_eval="true"  
> xx:parallel="true"' rather than 'xx:eval="eager parallel"' as I  
> suggested, where xx is the prefix to be chosen) then maybe the  
> prefix should be 'eval'.
>
> I've changed the code to:
> liftx:eager_eval="true"
> liftx:par="true" | liftx:parallel="true"
>
> The reasons for not combining them:
> They are evaluated in different parts of the code, thus eager/ 
> parallel doesn't make sense from a code path perspective
> I am reserving the value of liftx:par for future implementation to  
> allow farming the snippet evaluation to another mechanism.  Right  
> now, it's hard-coded to use LiftActors.  I can see a time when it  
> would work with Akka actors or some other parallelization mechanism
>
>
>
> As far as "ajax evaluation" I'm not sure I'm understanding. Could  
> you show me what you're thinking?
> If I have a snippet
> 
> what would be the syntax to have it inserted via ajax?
>
>  
>   
> 
>
>
> -
> Ross Mellgren wrote:
>
> My 2 cents,
>
> I'm not sure I'm a fan of do: namespace, though I agree it would be
> nice to have a common one. Maybe snippet:parallel, snippet:eager_eval?
>
> -Ross
>
> On Sep 24, 2009, at 12:46 PM, David Pollak wrote:
>
> >
> >
> > On Wed, Sep 23, 2009 at 11:43 AM, Naftoli Gugenheim  > > wrote:
> >
> > What do you mean by "as a normal snippet"?
> >
> > The parallel snippet processing is implemented deep inside
> > LiftSession.  It's not a snippet.  All the  tags, even
> > those with defaults built into Lift, are implemented as snippets and
> > are invoked with normal snippet invocation mechanisms.
> >
> > That you will nest your snippet inside a special snippet?
> >
> > There is no special snippet.  I used the word "normal" to highlight
> > that it's functionality that doesn't require a change to LiftSession
> > or other parts of Lift to function correctly.
> >
> > To me it seems worthwhile to have a consistency between the two
> > syntax-wise, since they have some common denominator semantics-wise.
> > Actually, maybe throw in eager_eval to the mix. Maybe we could have
> > one eval or lift:eval or liftx:eval or whatever attribute, which can
> > contain a space separated list of specifiers--eager, ajax, parellel.
> >
> > Anything that's prefixed with lift: is a snippet.  I'm open to
> > unifying eager_eval and do:lazy (or do:par or do:parallel) into a
> > unified namespace.
> >
> >
> >
> > -
> > David Pollak wrote:
> >
> > On Wed, Sep 23, 2009 at 10:40 AM, Naftoli Gugenheim  > >wrote:
> >
> > >
> > > A snippet attribute can be invoked with something other than
> > > lift:snippet="Class.method"? There's a short syntax? What is it?
> > >
> >
> > There may be a short syntax (e.g., lift:Class.method) in the future.
> >
> >
> > > What was used for the feature that inserts a snippet
> > asynchronously via
> > > Ajax?
> > >
> >
> > That feature isn't done yet, but that feature is likely to be done
> > as a
> > normal snippet.
> >
> >
> > > My concern is that as more features are thought up and added they
> > shouldn't
> > > all end up with different prefixes.
> > > Also, if the prefix is nothing special I would go with the more
> > verbose
> > > "parallel" because otherwise it's not obvious what it does. If
> > it's prefixed
> > > with "lift:" at least you know it's a lift tag and you can look it
> > up
> > > somewhere or ask on the list etc. But if you come back to some old
> > template
> > > that says "do:par" you may be left clueless.
> > >
> > >
> > > -
> > > David Pollak wrote:
> > >
> > > On Wed, Sep 23, 2009 at 3:59 AM, Naftoli Gugenheim  > > >wrote:
> > >
> > > >
> > > > Could that be changed to lift:concurrent or lift:par etc. (see
> > email on
> > > > scala-user from Marting Odersky mentioned the future use of
> > 'seq' and
> > > 'par'
> > > > in concurrent collections)?
> > > > Why use a different prefix than everything else built in to
> > lift? And
> > > > 'lazy' is arguably not what's happening.
> > > >
> > >
> > >
> > > We're using a different prefix because if we use a lift:xxx
> > prefix, the
> > > snippet execution machinery will be invoked on the attribute and
> > we don't
> > > want that.
> > >
> > > I'm cool with do:par unless anyone has a better suggestion.
> > >
> > > Thanks,
> > >
> > > David
> > >
> > >
> > > > Thanks.
> > > >
> > > >
> > > > -
> > > > Jeppe Nejsum Madsen wrote:
> > > >
> > > >
> > > > David Pollak  writes:
> > > >
> > > > > I've added code (it's in review board right now) that will
> > > automatically
> > > > > farm any snippet with the "do:lazy='true'" attrib

[Lift] Re: How can I replace SHtml.a with a Loc

2009-09-25 Thread glenn

David,

In this case, I was trying to see if there was a way to use the
standard Lift
menu generator to create a link with a callback for ajax handling,
similar to SHtml.a.
I don't know about menu generation from SiteMap. Perhaps that's what I
really
need. What would that look like?

Glenn

On Sep 25, 8:22 am, David Pollak 
wrote:
> On Fri, Sep 25, 2009 at 8:13 AM, glenn  wrote:
>
> > David,
>
> > Thanks for the reply. The Loc, itself, though. How do I write that
> > to create the Ajax link. I want to be able to modify an html element
> > when the link is clicked, as in SetHtml("item-save", edit(item)).
>
> Sorry... didn't quite understand.
>
> Are you using your own menu generator or the standard Lift menu generator?
>
> I'm thinking that we have to uniquely identify (put a knowable id on) each
>  that is generated.  If you're doing your own menu generation from
> SiteMap, you can probably get your code to work by using the name of the Loc
> as the id.  If you're using the standard Lift Menu snippet to create your
> menus, you'll have to open a ticket, I'll prioritize the ticket, then we'll
> wait for review board and then you'll get your change.
>
>
>
>
>
> > Glenn
>
> > On Sep 24, 5:05 pm, David Pollak 
> > wrote:
> > > val myLoc: Loc[_] = ...
>
> > > bind("item", xhtml, "addNew" ->  > href={myLoc.createDefaultLink}>Hello)
>
> > > On Wed, Sep 23, 2009 at 11:25 AM, glenn  wrote:
>
> > > > I have a snippet that creates a Ajax link.
>
> > > > bind("item", xhtml,
> > > >                "addNew" -> {SHtml.a({ ()=>
> > > >                  SetHtml("item-save", edit(item))},
> > > >              Text(MenuTitle_Add)
> > > >                  )}
> > > >                 )
>
> > > > How would I, instead, create the same or similar link using a Loc?
>
> > > > Glenn
>
> > > --
> > > Lift, the simply functional web frameworkhttp://liftweb.net
> > > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > > Follow me:http://twitter.com/dpp
> > > Surf the harmonics
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Surf the harmonics
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Concurrent Web Service Requests?

2009-09-25 Thread David Pollak
On Thu, Sep 24, 2009 at 11:33 AM, Naftoli Gugenheim wrote:

>
> If you like the idea of having them all as attributes but don't like the
> idea of using a single attribute ('xx:eager_eval="true" xx:parallel="true"'
> rather than 'xx:eval="eager parallel"' as I suggested, where xx is the
> prefix to be chosen) then maybe the prefix should be 'eval'.
>

I've changed the code to:
liftx:eager_eval="true"
liftx:par="true" | liftx:parallel="true"

The reasons for not combining them:

   - They are evaluated in different parts of the code, thus eager/parallel
   doesn't make sense from a code path perspective
   - I am reserving the value of liftx:par for future implementation to
   allow farming the snippet evaluation to another mechanism.  Right now, it's
   hard-coded to use LiftActors.  I can see a time when it would work with Akka
   actors or some other parallelization mechanism




>
> As far as "ajax evaluation" I'm not sure I'm understanding. Could you show
> me what you're thinking?
> If I have a snippet
> 
> what would be the syntax to have it inserted via ajax?
>

 
  



>
> -
> Ross Mellgren wrote:
>
> My 2 cents,
>
> I'm not sure I'm a fan of do: namespace, though I agree it would be
> nice to have a common one. Maybe snippet:parallel, snippet:eager_eval?
>
> -Ross
>
> On Sep 24, 2009, at 12:46 PM, David Pollak wrote:
>
> >
> >
> > On Wed, Sep 23, 2009 at 11:43 AM, Naftoli Gugenheim <
> naftoli...@gmail.com
> > > wrote:
> >
> > What do you mean by "as a normal snippet"?
> >
> > The parallel snippet processing is implemented deep inside
> > LiftSession.  It's not a snippet.  All the  tags, even
> > those with defaults built into Lift, are implemented as snippets and
> > are invoked with normal snippet invocation mechanisms.
> >
> > That you will nest your snippet inside a special snippet?
> >
> > There is no special snippet.  I used the word "normal" to highlight
> > that it's functionality that doesn't require a change to LiftSession
> > or other parts of Lift to function correctly.
> >
> > To me it seems worthwhile to have a consistency between the two
> > syntax-wise, since they have some common denominator semantics-wise.
> > Actually, maybe throw in eager_eval to the mix. Maybe we could have
> > one eval or lift:eval or liftx:eval or whatever attribute, which can
> > contain a space separated list of specifiers--eager, ajax, parellel.
> >
> > Anything that's prefixed with lift: is a snippet.  I'm open to
> > unifying eager_eval and do:lazy (or do:par or do:parallel) into a
> > unified namespace.
> >
> >
> >
> > -
> > David Pollak wrote:
> >
> > On Wed, Sep 23, 2009 at 10:40 AM, Naftoli Gugenheim <
> naftoli...@gmail.com
> > >wrote:
> >
> > >
> > > A snippet attribute can be invoked with something other than
> > > lift:snippet="Class.method"? There's a short syntax? What is it?
> > >
> >
> > There may be a short syntax (e.g., lift:Class.method) in the future.
> >
> >
> > > What was used for the feature that inserts a snippet
> > asynchronously via
> > > Ajax?
> > >
> >
> > That feature isn't done yet, but that feature is likely to be done
> > as a
> > normal snippet.
> >
> >
> > > My concern is that as more features are thought up and added they
> > shouldn't
> > > all end up with different prefixes.
> > > Also, if the prefix is nothing special I would go with the more
> > verbose
> > > "parallel" because otherwise it's not obvious what it does. If
> > it's prefixed
> > > with "lift:" at least you know it's a lift tag and you can look it
> > up
> > > somewhere or ask on the list etc. But if you come back to some old
> > template
> > > that says "do:par" you may be left clueless.
> > >
> > >
> > > -
> > > David Pollak wrote:
> > >
> > > On Wed, Sep 23, 2009 at 3:59 AM, Naftoli Gugenheim <
> naftoli...@gmail.com
> > > >wrote:
> > >
> > > >
> > > > Could that be changed to lift:concurrent or lift:par etc. (see
> > email on
> > > > scala-user from Marting Odersky mentioned the future use of
> > 'seq' and
> > > 'par'
> > > > in concurrent collections)?
> > > > Why use a different prefix than everything else built in to
> > lift? And
> > > > 'lazy' is arguably not what's happening.
> > > >
> > >
> > >
> > > We're using a different prefix because if we use a lift:xxx
> > prefix, the
> > > snippet execution machinery will be invoked on the attribute and
> > we don't
> > > want that.
> > >
> > > I'm cool with do:par unless anyone has a better suggestion.
> > >
> > > Thanks,
> > >
> > > David
> > >
> > >
> > > > Thanks.
> > > >
> > > >
> > > > -
> > > > Jeppe Nejsum Madsen wrote:
> > > >
> > > >
> > > > David Pollak  writes:
> > > >
> > > > > I've added code (it's in review board right now) that will
> > > automatically
> > > > > farm any snippet with the "do:lazy='true'" attribute set.
> > > > >
> > > > > So,  will execute the foo snippet inline.
> > > > >
> > > 

[Lift] Re: access to raw HttpServletRequest/Response

2009-09-25 Thread David Pollak
On Wed, Sep 23, 2009 at 9:03 AM, harryh  wrote:

>
> > You can do it today like this:
> >
> > S.containerRequest.map(r => (r.asInstanceOf[HTTPRequestServlet]).req)
>
> eh?  I'm getting this error:
>
> [error] value req is not a member of
> net.liftweb.http.provider.servlet.HTTPRequestServlet
> [error] val request: HttpServletRequest = S.containerRequest.map(r =>
> (r.asInstanceOf[HTTPRequestServlet]).req).open_!
>

Once this review-board change is accepted, the above code will work:
http://reviewboard.liftweb.net/r/12/


>
> -harryh
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] ProtoUser superUser versus Role

2009-09-25 Thread Juan M Uys

Hello,

I'm implementing a Role in my model to ultimately replace the
functionality provided by ProtoUser.superUser

Please let me know what the argument against having this functionality
in Lift is, and if you'd like to see this implemented, I'd gladly
commit my changes.

Please also suggest sensible defaults. I would imagine initial roles like:
0=super
1=normal
...and then setting new User instances to role=1.

Thanks,
Juan

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: How can I replace SHtml.a with a Loc

2009-09-25 Thread David Pollak
On Fri, Sep 25, 2009 at 8:13 AM, glenn  wrote:

>
> David,
>
> Thanks for the reply. The Loc, itself, though. How do I write that
> to create the Ajax link. I want to be able to modify an html element
> when the link is clicked, as in SetHtml("item-save", edit(item)).
>

Sorry... didn't quite understand.

Are you using your own menu generator or the standard Lift menu generator?

I'm thinking that we have to uniquely identify (put a knowable id on) each
 that is generated.  If you're doing your own menu generation from
SiteMap, you can probably get your code to work by using the name of the Loc
as the id.  If you're using the standard Lift Menu snippet to create your
menus, you'll have to open a ticket, I'll prioritize the ticket, then we'll
wait for review board and then you'll get your change.


>
> Glenn
>
> On Sep 24, 5:05 pm, David Pollak 
> wrote:
> > val myLoc: Loc[_] = ...
> >
> > bind("item", xhtml, "addNew" ->  href={myLoc.createDefaultLink}>Hello)
> >
> >
> >
> > On Wed, Sep 23, 2009 at 11:25 AM, glenn  wrote:
> >
> > > I have a snippet that creates a Ajax link.
> >
> > > bind("item", xhtml,
> > >"addNew" -> {SHtml.a({ ()=>
> > >  SetHtml("item-save", edit(item))},
> > >  Text(MenuTitle_Add)
> > >  )}
> > > )
> >
> > > How would I, instead, create the same or similar link using a Loc?
> >
> > > Glenn
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Surf the harmonics
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: How can I replace SHtml.a with a Loc

2009-09-25 Thread glenn

David,

Thanks for the reply. The Loc, itself, though. How do I write that
to create the Ajax link. I want to be able to modify an html element
when the link is clicked, as in SetHtml("item-save", edit(item)).

Glenn

On Sep 24, 5:05 pm, David Pollak 
wrote:
> val myLoc: Loc[_] = ...
>
> bind("item", xhtml, "addNew" -> Hello)
>
>
>
> On Wed, Sep 23, 2009 at 11:25 AM, glenn  wrote:
>
> > I have a snippet that creates a Ajax link.
>
> > bind("item", xhtml,
> >                "addNew" -> {SHtml.a({ ()=>
> >                  SetHtml("item-save", edit(item))},
> >              Text(MenuTitle_Add)
> >                  )}
> >                 )
>
> > How would I, instead, create the same or similar link using a Loc?
>
> > Glenn
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Surf the harmonics
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: XML -> JSON converter?

2009-09-25 Thread Thomas Rampelberg

This is really great, making XML as easy to generate as JSON was
something I thought I'd never see.

On Fri, Sep 25, 2009 at 7:27 AM, David Pollak
 wrote:
>
>
> On Fri, Sep 25, 2009 at 6:19 AM, Timothy Perrett 
> wrote:
>>
>> Sorry Dave, but the brevity of your reply left me somewhat confused...
>> "yes it makes sense to do that" or "yes, we'll be replacing everything with
>> lift-json" ?
>
> Eventually, we'll be integrating all of lift-json into the existing Lift
> JavaScript infrastructure.
>
>>
>> Cheers, Tim
>> On 25 Sep 2009, at 14:07, David Pollak wrote:
>>
>> On Fri, Sep 25, 2009 at 1:21 AM, Timothy Perrett 
>> wrote:
>>>
>>> Are there any plans to supersede the JsObj stuff with what is in lift-
>>> json ? Seems like that would make a lot more sense, no?
>>
>> Yes.
>>
>>>
>>> Cheers, Tim
>>>
>>> On 24 Sep 2009, at 22:13, Indrajit Raychaudhuri wrote:
>>>
>>> >
>>> >
>>> > On 24/09/09 2:34 PM, Timothy Perrett wrote:
>>> >>
>>> >> Nice stuff Joni!
>>> >
>>> > Indeed. That this module gets lots of love shows.
>>> > Everything nice and tidy in a neat little package.
>>> >
>>> > Did I mention that it's test cases serve as docs too?
>>> >
>>> > /Indrajit
>>> >
>>> >>
>>> >> Cheers, Tim
>>> >>
>>> >> On 24 Sep 2009, at 08:24, Joni Freeman wrote:
>>> >>
>>> >>>
>>> >>> Hi,
>>> >>>
>>> >>> There is now improved XML support in lift master. See a short
>>> >>> section
>>> >>> in README:
>>> >>> http://github.com/dpp/liftweb/tree/master/lift-json/
>>> >>>
>>> >>> and some executable examples:
>>> >>>
>>> >>> http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala
>>> >>>
>>> >>> Cheers Joni
>>> >>>
>>> >>> On Sep 2, 9:27 pm, harryh  wrote:
>>>  Is there anything built into lift that will doXML->  JSON
>>>  conversion?  For example:
>>> 
>>>  
>>>    
>>>      1
>>>      Harry
>>>    
>>>    
>>>      2
>>>      David
>>>    
>>>  
>>> 
>>>  to:
>>> 
>>>  {
>>>    "foos": {
>>>      "foo": [{
>>>          "id": 1,
>>>          "name": "Harry"
>>>       },
>>>       {
>>>          "id": 2,
>>>          "name": "David"
>>>       }
>>>      ]
>>> 
>>>  }
>>> 
>>>  Just checking to see if there was something Lift friendly to do
>>>  this
>>>  before writing my own (or picking a java library to use).
>>> 
>>>  -harryh
>>> 
>>> >>>
>>> >>
>>> >>
>>> >>>
>>> >
>>> > >
>>> >
>>>
>>>
>>>
>>
>>
>>
>> --
>> Lift, the simply functional web framework http://liftweb.net
>> Beginning Scala http://www.apress.com/book/view/1430219890
>> Follow me: http://twitter.com/dpp
>> Git some: http://github.com/dpp
>>
>>
>>
>>
>>
>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Surf the harmonics
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: XML -> JSON converter?

2009-09-25 Thread David Pollak
On Fri, Sep 25, 2009 at 6:19 AM, Timothy Perrett wrote:

> Sorry Dave, but the brevity of your reply left me somewhat confused... "yes
> it makes sense to do that" or "yes, we'll be replacing everything with
> lift-json" ?
>

Eventually, we'll be integrating all of lift-json into the existing Lift
JavaScript infrastructure.


>
> Cheers, Tim
>
> On 25 Sep 2009, at 14:07, David Pollak wrote:
>
> On Fri, Sep 25, 2009 at 1:21 AM, Timothy Perrett 
> wrote:
>
>>
>> Are there any plans to supersede the JsObj stuff with what is in lift-
>> json ? Seems like that would make a lot more sense, no?
>>
>
> Yes.
>
>
>>
>> Cheers, Tim
>>
>> On 24 Sep 2009, at 22:13, Indrajit Raychaudhuri wrote:
>>
>> >
>> >
>> > On 24/09/09 2:34 PM, Timothy Perrett wrote:
>> >>
>> >> Nice stuff Joni!
>> >
>> > Indeed. That this module gets lots of love shows.
>> > Everything nice and tidy in a neat little package.
>> >
>> > Did I mention that it's test cases serve as docs too?
>> >
>> > /Indrajit
>> >
>> >>
>> >> Cheers, Tim
>> >>
>> >> On 24 Sep 2009, at 08:24, Joni Freeman wrote:
>> >>
>> >>>
>> >>> Hi,
>> >>>
>> >>> There is now improved XML support in lift master. See a short
>> >>> section
>> >>> in README:
>> >>> http://github.com/dpp/liftweb/tree/master/lift-json/
>> >>>
>> >>> and some executable examples:
>> >>>
>> http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala
>> >>>
>> >>> Cheers Joni
>> >>>
>> >>> On Sep 2, 9:27 pm, harryh  wrote:
>>  Is there anything built into lift that will doXML->  JSON
>>  conversion?  For example:
>> 
>>  
>>    
>>  1
>>  Harry
>>    
>>    
>>  2
>>  David
>>    
>>  
>> 
>>  to:
>> 
>>  {
>>    "foos": {
>>  "foo": [{
>>  "id": 1,
>>  "name": "Harry"
>>   },
>>   {
>>  "id": 2,
>>  "name": "David"
>>   }
>>  ]
>> 
>>  }
>> 
>>  Just checking to see if there was something Lift friendly to do
>>  this
>>  before writing my own (or picking a java library to use).
>> 
>>  -harryh
>> 
>> >>>
>> >>
>> >>
>> >>>
>> >
>> > >
>> >
>>
>>
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
>
>
>
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Canceling a ActorPing.scheduleAtFixedRate task

2009-09-25 Thread marius d.

Hi,

When you call scheduleAtFixedRate that actor is sending your actor a
Scheduled message, hence you can capture the correct sender. You don't
need to create a different actor.

David's points are quite valid regarding the correct Scala actors'
state.

Br's,
Marius

On Sep 23, 4:17 pm, Xavi Ramirez  wrote:
> I think I figured out a way to get around this:
>
> class SomeCometActor extends CometActor {
>   private var tempActor: Actor = null
>
>   override def localSetup() {
>     val cometActor = this
>     var tempActor = actor{ loop { react {
>        case TaskMessage => cometActor ! TaskMessage
>        case UnSchedule => exit
>     } } }
>     ActorPing.scheduleAtFixedRate(tempActor, TaskMessage, 15 seconds,
> 15 seconds)
>   }
>
>   override def lowPriority = {
>     case TaskMessage =>
>       DoSomething()
>       if(someCondition) { tempActor ! UnSchedule }
>   }
>
> }
>
> Instead of registering the comet actors for the scheduled task, I
> register a temporary actor.  During its execution, scheduleAtFixedRate
> creates an actor. Let's call this the Scheduled Task Actor.  The
> scheduled task actor is then 
> linked(seehttp://www.scala-lang.org/docu/files/api/scala/actors/Actor.html#link...)
> to the temporary actor i passed in.  So now, when I need to stop the
> scheduled task actor, I can shutdown the temporary actor.  This works
> because when an actor is shutdown, all actors it's linked to are shut
> down as well.
>
> This is kinda nuts, but I guess it works.
>
> I'm just sharing in case someone else runs into this problem.
>
> Thanks,
> Xavi
>
> On Wed, Sep 23, 2009 at 4:13 PM, Xavi Ramirez  wrote:
> > There isn't much to show... but maybe an example clarify things.
>
> > class SomeCometActor extends CometActor {
> >  override def localSetup() {
> >    ActorPing.scheduleAtFixedRate(this, TaskMessage, 15 seconds, 15 seconds)
> >  }
>
> >  override def lowPriority = {
> >    case TaskMessage =>
> >      DoSomething()
> >      if(someCondition) { /* stop the scheduled task... What do I put 
> > here?*/ }
> >  }
> > }
>
> > If scheduleAtFixedRate returned either the Future or the Actor it
> > creates, then stopping the scheduled task would be fairly straight
> > forward.  Then again, I might be missing something.
>
> > Thanks,
> > Xavi
>
> > On Wed, Sep 23, 2009 at 3:54 PM, Timothy Perrett
> >  wrote:
>
> >> Xavi,
>
> >> Can you show some code? There might be a way of doing it depending
> >> what you have...
>
> >> Cheers, Tim
>
> >> Sent from my iPhone
>
> >> On 23 Sep 2009, at 20:50, Xavi Ramirez  wrote:
>
> >>> Hello,
>
> >>> Is there any way to cancel a task created with a
> >>> ActorPing.scheduleAtFixedRate?
>
> >>> From looking at the source
> >>> (http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/util/ActorPi...
> >>> )
> >>> it seem that scheduleAtFixedRate creates an actor which accepts an
> >>> UnSchedule message.  Unfortunately this actor is not returned to the
> >>> caller.
>
> >>> Thanks in advance,
> >>> Xavi
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Canceling a ActorPing.scheduleAtFixedRate task

2009-09-25 Thread marius d.

So why not keep the method for the Lift-Actors branch? ... because
there is no concept of linking actors there?

Br's,
Marius

On Sep 24, 6:52 pm, David Pollak 
wrote:
> I strongly recommend against using scheduleAtFixedRate because:
>
>    - Internally, it creates an actor that's linked to your actor and that
>    leads one of the Scala Actor memory problems
>    - The turning off issue that you've identified
>    - On the Scala-Actor-free branch of Lift, I've removed the method.
>
> Instead, I'd suggest scheduling a new actorping each time you receive one.
>
>
>
> On Wed, Sep 23, 2009 at 2:17 PM, Xavi Ramirez  wrote:
>
> > I think I figured out a way to get around this:
>
> > class SomeCometActor extends CometActor {
> >  private var tempActor: Actor = null
>
> >  override def localSetup() {
> >    val cometActor = this
> >    var tempActor = actor{ loop { react {
> >       case TaskMessage => cometActor ! TaskMessage
> >       case UnSchedule => exit
> >    } } }
> >    ActorPing.scheduleAtFixedRate(tempActor, TaskMessage, 15 seconds,
> > 15 seconds)
> >  }
>
> >  override def lowPriority = {
> >    case TaskMessage =>
> >      DoSomething()
> >       if(someCondition) { tempActor ! UnSchedule }
> >  }
> > }
>
> > Instead of registering the comet actors for the scheduled task, I
> > register a temporary actor.  During its execution, scheduleAtFixedRate
> > creates an actor. Let's call this the Scheduled Task Actor.  The
> > scheduled task actor is then linked(see
>
> >http://www.scala-lang.org/docu/files/api/scala/actors/Actor.html#link...
> > )
> > to the temporary actor i passed in.  So now, when I need to stop the
> > scheduled task actor, I can shutdown the temporary actor.  This works
> > because when an actor is shutdown, all actors it's linked to are shut
> > down as well.
>
> > This is kinda nuts, but I guess it works.
>
> > I'm just sharing in case someone else runs into this problem.
>
> > Thanks,
> > Xavi
>
> > On Wed, Sep 23, 2009 at 4:13 PM, Xavi Ramirez  wrote:
> > > There isn't much to show... but maybe an example clarify things.
>
> > > class SomeCometActor extends CometActor {
> > >  override def localSetup() {
> > >    ActorPing.scheduleAtFixedRate(this, TaskMessage, 15 seconds, 15
> > seconds)
> > >  }
>
> > >  override def lowPriority = {
> > >    case TaskMessage =>
> > >      DoSomething()
> > >      if(someCondition) { /* stop the scheduled task... What do I put
> > here?*/ }
> > >  }
> > > }
>
> > > If scheduleAtFixedRate returned either the Future or the Actor it
> > > creates, then stopping the scheduled task would be fairly straight
> > > forward.  Then again, I might be missing something.
>
> > > Thanks,
> > > Xavi
>
> > > On Wed, Sep 23, 2009 at 3:54 PM, Timothy Perrett
> > >  wrote:
>
> > >> Xavi,
>
> > >> Can you show some code? There might be a way of doing it depending
> > >> what you have...
>
> > >> Cheers, Tim
>
> > >> Sent from my iPhone
>
> > >> On 23 Sep 2009, at 20:50, Xavi Ramirez  wrote:
>
> > >>> Hello,
>
> > >>> Is there any way to cancel a task created with a
> > >>> ActorPing.scheduleAtFixedRate?
>
> > >>> From looking at the source
> > >>> (
> >http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/util/ActorPi...
> > >>> )
> > >>> it seem that scheduleAtFixedRate creates an actor which accepts an
> > >>> UnSchedule message.  Unfortunately this actor is not returned to the
> > >>> caller.
>
> > >>> Thanks in advance,
> > >>> Xavi
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890
> Follow me:http://twitter.com/dpp
> Surf the harmonics
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: XML -> JSON converter?

2009-09-25 Thread Timothy Perrett
Sorry Dave, but the brevity of your reply left me somewhat confused...  
"yes it makes sense to do that" or "yes, we'll be replacing everything  
with lift-json" ?

Cheers, Tim

On 25 Sep 2009, at 14:07, David Pollak wrote:

> On Fri, Sep 25, 2009 at 1:21 AM, Timothy Perrett  > wrote:
>
> Are there any plans to supersede the JsObj stuff with what is in lift-
> json ? Seems like that would make a lot more sense, no?
>
> Yes.
>
>
> Cheers, Tim
>
> On 24 Sep 2009, at 22:13, Indrajit Raychaudhuri wrote:
>
> >
> >
> > On 24/09/09 2:34 PM, Timothy Perrett wrote:
> >>
> >> Nice stuff Joni!
> >
> > Indeed. That this module gets lots of love shows.
> > Everything nice and tidy in a neat little package.
> >
> > Did I mention that it's test cases serve as docs too?
> >
> > /Indrajit
> >
> >>
> >> Cheers, Tim
> >>
> >> On 24 Sep 2009, at 08:24, Joni Freeman wrote:
> >>
> >>>
> >>> Hi,
> >>>
> >>> There is now improved XML support in lift master. See a short
> >>> section
> >>> in README:
> >>> http://github.com/dpp/liftweb/tree/master/lift-json/
> >>>
> >>> and some executable examples:
> >>> http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala
> >>>
> >>> Cheers Joni
> >>>
> >>> On Sep 2, 9:27 pm, harryh  wrote:
>  Is there anything built into lift that will doXML->  JSON
>  conversion?  For example:
> 
>  
>    
>  1
>  Harry
>    
>    
>  2
>  David
>    
>  
> 
>  to:
> 
>  {
>    "foos": {
>  "foo": [{
>  "id": 1,
>  "name": "Harry"
>   },
>   {
>  "id": 2,
>  "name": "David"
>   }
>  ]
> 
>  }
> 
>  Just checking to see if there was something Lift friendly to do
>  this
>  before writing my own (or picking a java library to use).
> 
>  -harryh
> 
> >>>
> >>
> >>
> >>>
> >
> > >
> >
>
>
>
>
>
>
> -- 
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: XML -> JSON converter?

2009-09-25 Thread David Pollak
On Fri, Sep 25, 2009 at 1:21 AM, Timothy Perrett wrote:

>
> Are there any plans to supersede the JsObj stuff with what is in lift-
> json ? Seems like that would make a lot more sense, no?
>

Yes.


>
> Cheers, Tim
>
> On 24 Sep 2009, at 22:13, Indrajit Raychaudhuri wrote:
>
> >
> >
> > On 24/09/09 2:34 PM, Timothy Perrett wrote:
> >>
> >> Nice stuff Joni!
> >
> > Indeed. That this module gets lots of love shows.
> > Everything nice and tidy in a neat little package.
> >
> > Did I mention that it's test cases serve as docs too?
> >
> > /Indrajit
> >
> >>
> >> Cheers, Tim
> >>
> >> On 24 Sep 2009, at 08:24, Joni Freeman wrote:
> >>
> >>>
> >>> Hi,
> >>>
> >>> There is now improved XML support in lift master. See a short
> >>> section
> >>> in README:
> >>> http://github.com/dpp/liftweb/tree/master/lift-json/
> >>>
> >>> and some executable examples:
> >>>
> http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala
> >>>
> >>> Cheers Joni
> >>>
> >>> On Sep 2, 9:27 pm, harryh  wrote:
>  Is there anything built into lift that will doXML->  JSON
>  conversion?  For example:
> 
>  
>    
>  1
>  Harry
>    
>    
>  2
>  David
>    
>  
> 
>  to:
> 
>  {
>    "foos": {
>  "foo": [{
>  "id": 1,
>  "name": "Harry"
>   },
>   {
>  "id": 2,
>  "name": "David"
>   }
>  ]
> 
>  }
> 
>  Just checking to see if there was something Lift friendly to do
>  this
>  before writing my own (or picking a java library to use).
> 
>  -harryh
> 
> >>>
> >>
> >>
> >>>
> >
> > >
> >
>
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: redirectTo throwing net.liftweb.http.ResponseShortcutException: Shortcut

2009-09-25 Thread Timothy Perrett

Just realised your using ajaxForm... in that case you need to do  
RedirectTo JsCmd which will effectively send a window.location.href to  
the browser.

Cheers, Tim

On 24 Sep 2009, at 21:49, David wrote:

>
> Hello lifters,
> I have the following form and bind:
>SHtml.ajaxForm(
>  bind("ajax", xhtml,
>   "view" -> doView _,
>   "save" -> SHtml.ajaxButton(
> "Save",
> {() =>
>   Log.info("Got a 'save' AJAX call")
>  this.redirectTo("/redirect1") //workflow/index2
>}, ("class", "ui-state-default ui-corner-all"
>
> When the 'Save' ajax button is called, the redirect should be invoked,
> that is working.  However I get the exception below.   Based on what
> I've read, this exception should be handled by lift.  I don't have any
> explicit exception handling in my code.
>
> Is there a bug here, is my redirect correct?  I've also tried adding
> this to my Boot.scala:
>LiftRules.dispatch.prepend {
>  case Req("redirect1" :: _, _, _) => () =>
>Full(RedirectWithState("/workflow/index2",
>   RedirectState(() => println("Called on
> redirect!"),
> "My error" ->
> NoticeType.Error)))
>
>
> Thanks for any suggestions or help.
>
> -Dave
> 16:44:14.097 [12569...@qtp-1983971-5] WARN  lift.warn:114 - Request
> for /ajax_request/F664660567847L4N/ failed Shortcut
> net.liftweb.http.ResponseShortcutException: Shortcut
>   at net.liftweb.http.ResponseShortcutException$.redirect
> (ResponseShortcutException.scala:31) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.ResponseShortcutException$.redirect
> (ResponseShortcutException.scala:35) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$.redirectTo(S.scala:759) [lift-webkit-1.1-
> SNAPSHOT.jar:na]
>   at net.liftweb.http.StatefulSnippet$class.redirectTo(Stateful.scala:
> 77) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at snippet.Workflow.redirectTo(Workflow.scala:31) [classes/:na]
>   at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:151)
> [classes/:na]
>   at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:149)
> [classes/:na]
>   at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala:
> 1843) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala:
> 1843) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na]
>   at net.liftweb.http.S$NFuncHolder.apply(S.scala:1843) [lift-
> webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftSession$$anonfun$buildFunc$1$2.apply
> (LiftSession.scala:323) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply
> (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply
> (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na]
>   at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala:
> 338) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala:
> 327) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at scala.List.flatMap(List.scala:1132) [scala-library-2.7.5.jar:na]
>   at net.liftweb.http.LiftSession.runParams(LiftSession.scala:327)
> [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftServlet.handleAjax(LiftServlet.scala:286)
> [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftServlet.net$liftweb$http$LiftServlet$
> $dispatchStatefulRequest(LiftServlet.scala:253) [lift-webkit-1.1-
> SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala:
> 172) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala:
> 172) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$.net$liftweb$http$S$$wrapQuery(S.scala:904)
> [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit$1$
> $anonfun$apply$20.apply(S.scala:1044) [lift-webkit-1.1-
> SNAPSHOT.jar:na]
>   at net.liftweb.http.S$.net$liftweb$http$S$$doAround(S.scala:841)
> [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit
> $1.apply(S.scala:1042) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) [lift-
> util-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$.net$liftweb$http$S$$_nest2InnerInit(S.scala:
> 1041) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_innerInit$1$
> $anonfun$apply$23$$anonfun$apply$24$$anonfun$apply$25$$anonfun$apply
> $26$$anonfun$apply$27.apply(S.scala:1061) [lift-webkit-1.1-
> SNAPSHOT.jar:na]
>   at net.liftweb.

[Lift] Re: redirectTo throwing net.liftweb.http.ResponseShortcutException: Shortcut

2009-09-25 Thread Timothy Perrett

It looks to me like your bouncing someone out to a dispatch redirect,  
then onto another page? Any reason you don't just go strait to the  
other page? Moreover, why on the second one are you using  
RedirectWithState?

Doing S.redirectTo should be fine in your snippet. Personally, id also  
break the submit handler into another nested def because its more  
readable.

Cheers, Tim

On 24 Sep 2009, at 21:49, David wrote:

>
> Hello lifters,
> I have the following form and bind:
>SHtml.ajaxForm(
>  bind("ajax", xhtml,
>   "view" -> doView _,
>   "save" -> SHtml.ajaxButton(
> "Save",
> {() =>
>   Log.info("Got a 'save' AJAX call")
>  this.redirectTo("/redirect1") //workflow/index2
>}, ("class", "ui-state-default ui-corner-all"
>
> When the 'Save' ajax button is called, the redirect should be invoked,
> that is working.  However I get the exception below.   Based on what
> I've read, this exception should be handled by lift.  I don't have any
> explicit exception handling in my code.
>
> Is there a bug here, is my redirect correct?  I've also tried adding
> this to my Boot.scala:
>LiftRules.dispatch.prepend {
>  case Req("redirect1" :: _, _, _) => () =>
>Full(RedirectWithState("/workflow/index2",
>   RedirectState(() => println("Called on
> redirect!"),
> "My error" ->
> NoticeType.Error)))
>
>
> Thanks for any suggestions or help.
>
> -Dave
> 16:44:14.097 [12569...@qtp-1983971-5] WARN  lift.warn:114 - Request
> for /ajax_request/F664660567847L4N/ failed Shortcut
> net.liftweb.http.ResponseShortcutException: Shortcut
>   at net.liftweb.http.ResponseShortcutException$.redirect
> (ResponseShortcutException.scala:31) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.ResponseShortcutException$.redirect
> (ResponseShortcutException.scala:35) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$.redirectTo(S.scala:759) [lift-webkit-1.1-
> SNAPSHOT.jar:na]
>   at net.liftweb.http.StatefulSnippet$class.redirectTo(Stateful.scala:
> 77) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at snippet.Workflow.redirectTo(Workflow.scala:31) [classes/:na]
>   at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:151)
> [classes/:na]
>   at snippet.Workflow$$anonfun$edit$2.apply(Workflow.scala:149)
> [classes/:na]
>   at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala:
> 1843) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$NFuncHolder$$anonfun$apply$40.apply(S.scala:
> 1843) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na]
>   at net.liftweb.http.S$NFuncHolder.apply(S.scala:1843) [lift-
> webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftSession$$anonfun$buildFunc$1$2.apply
> (LiftSession.scala:323) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply
> (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftSession$$anonfun$6$$anonfun$apply$17.apply
> (LiftSession.scala:338) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at scala.List.map(List.scala:812) [scala-library-2.7.5.jar:na]
>   at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala:
> 338) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftSession$$anonfun$6.apply(LiftSession.scala:
> 327) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at scala.List.flatMap(List.scala:1132) [scala-library-2.7.5.jar:na]
>   at net.liftweb.http.LiftSession.runParams(LiftSession.scala:327)
> [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftServlet.handleAjax(LiftServlet.scala:286)
> [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftServlet.net$liftweb$http$LiftServlet$
> $dispatchStatefulRequest(LiftServlet.scala:253) [lift-webkit-1.1-
> SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala:
> 172) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.LiftServlet$$anonfun$3.apply(LiftServlet.scala:
> 172) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$.net$liftweb$http$S$$wrapQuery(S.scala:904)
> [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit$1$
> $anonfun$apply$20.apply(S.scala:1044) [lift-webkit-1.1-
> SNAPSHOT.jar:na]
>   at net.liftweb.http.S$.net$liftweb$http$S$$doAround(S.scala:841)
> [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$$anonfun$net$liftweb$http$S$$_nest2InnerInit
> $1.apply(S.scala:1042) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) [lift-
> util-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S$.net$liftweb$http$S$$_nest2InnerInit(S.scala:
> 1041) [lift-webkit-1.1-SNAPSHOT.jar:na]
>   at net.liftweb.http.S

[Lift] Re: XML -> JSON converter?

2009-09-25 Thread Timothy Perrett

Are there any plans to supersede the JsObj stuff with what is in lift- 
json ? Seems like that would make a lot more sense, no?

Cheers, Tim

On 24 Sep 2009, at 22:13, Indrajit Raychaudhuri wrote:

>
>
> On 24/09/09 2:34 PM, Timothy Perrett wrote:
>>
>> Nice stuff Joni!
>
> Indeed. That this module gets lots of love shows.
> Everything nice and tidy in a neat little package.
>
> Did I mention that it's test cases serve as docs too?
>
> /Indrajit
>
>>
>> Cheers, Tim
>>
>> On 24 Sep 2009, at 08:24, Joni Freeman wrote:
>>
>>>
>>> Hi,
>>>
>>> There is now improved XML support in lift master. See a short  
>>> section
>>> in README:
>>> http://github.com/dpp/liftweb/tree/master/lift-json/
>>>
>>> and some executable examples:
>>> http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala
>>>
>>> Cheers Joni
>>>
>>> On Sep 2, 9:27 pm, harryh  wrote:
 Is there anything built into lift that will doXML->  JSON
 conversion?  For example:

 
   
 1
 Harry
   
   
 2
 David
   
 

 to:

 {
   "foos": {
 "foo": [{
 "id": 1,
 "name": "Harry"
  },
  {
 "id": 2,
 "name": "David"
  }
 ]

 }

 Just checking to see if there was something Lift friendly to do  
 this
 before writing my own (or picking a java library to use).

 -harryh

>>>
>>
>>
>>>
>
> >
>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---