[Lift] MetaMapper broke LifecycleCallbacks ?

2009-12-18 Thread night_stalker
I need to add a beforeSave() callback, so I wrote:

class X extends LongKeyedMapper[X] with IdPK with
LifecycleCallbacks {
  def getSingleton = X
  def beforeSave {
println(hi!)
  }
  ...
}
object X extends X with LongKeyedMetaMapper[X] {
  ...
}

Then got a compile error:

[ERROR]  X.scala:35: error: error overriding method
beforeValidation in trait LifecycleCallbacks of type = Unit;
[INFO]  method beforeValidation in trait MetaMapper of type = List
[(com.lawsite.model.precedent.PrecedentContent) = Unit] needs
`override' modifier

Is it a bug or, am I doing something wrong ?

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: MetaMapper broke LifecycleCallbacks ?

2009-12-18 Thread night_stalker
Got it, I was a little bit confused :)

class X extends LongKeyedMapper[X] with IdPK {
  ...
}
object X extends X with LongKeyedMetaMapper[X] {
  override def beforeSave = List((x: X) = {
println(hi)
()
  })
}

On Dec 18, 11:50 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I think LifecycleCallbacks is needed for fields, not the mapper itself.

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Latest API Documentation

2009-11-07 Thread night_stalker

I think crawling all pages under
http://scala-tools.org/mvnsites-snapshots/liftweb/ is a better
option,
which costs less band-width and less time, and is very much easier
than building documentation from source.

On Nov 6, 6:45 am, Jonathan Ferguson j...@spiralarm.com wrote:
 Is it practical to build the snapshot documentation or is it being built to
 often?

 Jono

 2009/11/6 David Pollak feeder.of.the.be...@gmail.com



  On Wed, Nov 4, 2009 at 10:44 PM, aw anth...@whitford.com wrote:

  When clicking on the API Documentation link, it links to 1.0
  documentation...  Is there a link for 1.1-M7 documentation?

  (I tried going tohttp://scala-tools.org/scaladocs/liftweb/1.1-M7/but
  that didn't work...)

  Try:
 http://scala-tools.org/mvnsites/liftweb-1.1-M6/

  The M7 docs will be up in 30-60 minutes.

  --
  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] (Newbie Question) How to do simple transaction with mapper?

2009-11-03 Thread night_stalker

Is there any easy way like ActiveRecord's transaction ? I'd prefer
  ModelA.transaction { ModelB.transaction {
ModelA.create fill someField save_!;
ModelB delete_! someId
...
  }}

If no block-like methods, something like the following is OK
  DB.beginTransaction
...
  DB.endTransaction

I don't know whether this guy works ...
  try { DB runQuery begin } catch { case _ = () }
...
  try { DB runQuery end } catch { case _ = () }

--~--~-~--~~~---~--~~
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: (Newbie Question) How to do simple transaction with mapper?

2009-11-03 Thread night_stalker

Thank you. solved:

import net.liftweb.mapper.{DB, DefaultConnectionIdentifier}
DB.use(DefaultConnectionIdentifier) { conn =
  conn.setAutoCommit(false)
  ... // CRUDs
  if(success) conn.commit
  else conn.rollback
  conn.setAutoCommit(true)
}


On Nov 4, 2:52 pm, Naftoli Gugenheim naftoli...@gmail.com wrote:
 I think it's called DB.use, not sure.

 -

 night_stalkerusur...@gmail.com wrote:

 Is there any easy way like ActiveRecord's transaction ? I'd prefer
   ModelA.transaction { ModelB.transaction {
     ModelA.create fill someField save_!;
     ModelB delete_! someId
     ...
   }}

 If no block-like methods, something like the following is OK
   DB.beginTransaction
     ...
   DB.endTransaction

 I don't know whether this guy works ...
   try { DB runQuery begin } catch { case _ = () }
     ...
   try { DB runQuery end } catch { case _ = () }
--~--~-~--~~~---~--~~
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] lift:bind-at get warnings for every request

2009-10-20 Thread night_stalker

Hi all.
When using lift:bind-at, the result page is fine as I wished,
yet these warnings run into the log for every request:

WARN - Unused binding values for lift:bind: content, main
WARN - Unused binding values for lift:bind: sidebar, main
WARN - Unused binding values for lift:bind: sidebar

Am I missing something, or, can I disable these warnings?
The lift version is 1.1-M6, template code are like below:


templates-hidden/someLayout.html

...begin stuff
lift:bind name=sidebar/
...between stuff
lift:bind name=content/
...end stuff


somePage.html

lift:surround with=someLayout
  lift:bind-at name=sidebar
...sidebar stuff
  /lift:bind-at
  lift:bind-at name=content
...content stuff
  /lift:bind-at
/lift:surround

--~--~-~--~~~---~--~~
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] Friendly url parameter for PaginateSnippet?

2009-10-18 Thread night_stalker

Hi all, I've just tried the PaginatedSnippet and is willing to make
some query pages with it, but the url parameter looks not very good (I
got a /post?F1054255562605UD5=_ ).

So —— how to make paginated page's url more friendly? I'd prefer
something like /posts?page=2.
--~--~-~--~~~---~--~~
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: [request] update lift-openid 's dependency of openid4java to a newer version

2009-10-18 Thread night_stalker

done. thanks for you concern.
http://github.com/dpp/liftweb/issues#issue/109

On Oct 18, 2:27 pm, Indrajit Raychaudhuri indraj...@gmail.com wrote:
 Could you please file a ticket?http://github.com/dpp/liftweb/issues

 Cheers, Indrajit

 On 18/10/09 11:19 AM, night_stalker wrote:



  Currently lift-openid is using openid4java 0.9.3, which is a little
  old and is difficult to find a maven repository to download.

  I think changing lift-openid's pom with a newer one, like
  openid4java-0.9.5 will be better. (works fine on my machine)
--~--~-~--~~~---~--~~
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: Friendly url parameter for PaginateSnippet?

2009-10-18 Thread night_stalker

Thank you for your explanation.

The reason is users don't get the same page with the same url,
 and, they can't read the url.
Just wondering if I can use existing classes or should write my own.
It seems I shouldn't use stateful snippet for this, stateless
requirement.

Best regards.

On Oct 18, 6:35 pm, Marius marius.dan...@gmail.com wrote:
 F1054255562605UD5 means that a function on server side will be invoked
 when this is sent. I believe these is a function that the Paginator is
 binding automatically. Is there a more specific reason why you want
 this ?

 Br's,
 Marius

 On Oct 18, 11:12 am, night_stalker usur...@gmail.com wrote:

  Hi all, I've just tried the PaginatedSnippet and is willing to make
  some query pages with it, but the url parameter looks not very good (I
  got a /post?F1054255562605UD5=_ ).

  So —— how to make paginated page's url more friendly? I'd prefer
  something like /posts?page=2.
--~--~-~--~~~---~--~~
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] [request] update lift-openid 's dependency of openid4java to a newer version

2009-10-17 Thread night_stalker

Currently lift-openid is using openid4java 0.9.3, which is a little
old and is difficult to find a maven repository to download.

I think changing lift-openid's pom with a newer one, like
openid4java-0.9.5 will be better. (works fine on my machine)
--~--~-~--~~~---~--~~
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] how to redirect with OpenIdVendor

2009-09-14 Thread night_stalker

hi all, excuse me for asking another newbie question.
I'm integrating openID with net.liftweb.openid, how to redirect or run
some js in the postLogin method?

// import my packages of User and UserOp
trait CustomOpenId extends OpenIdVendor {
  type UserType = User

  // note: in lift 1.1, use OpenIdConsumer instead (downcase d)
  type ConsumerType = OpenIDConsumer[UserType]

  def currentUser = UserOp.current

  def postLogin(id: Box[Identifier], res: VerificationResult) {
id match {
  case Full(id) =
UserOp.openIdLogin(id.getIdentifier)
if(UserOp.logined) {
  redirectTo(/) // doesn't work
} else {
  ...
--~--~-~--~~~---~--~~
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] email encoding problem

2009-09-12 Thread night_stalker

hi all,

I'm new to lift, I met with a problem when trying to send a mail.

//Mail.scala---
package my.site
import net.liftweb.util._
import Helpers._
import Mailer._
import javax.mail._
import javax.mail.internet._
import xml._

object Mail {
  var from = 

  def config(host: String, user: String, password: String) {
System.setProperty(mail.smtp.starttls.enable,true);
System.setProperty(mail.smtp.host, host)
System.setProperty(mail.smtp.auth, true)
System.setProperty(mail.mime.charset, UTF-8)
Mailer.authenticator = Full(new Authenticator {
  override def getPasswordAuthentication =
new PasswordAuthentication(user, password)
})
from = user
  }

  def send(to: String, xmlContent: NodeSeq) {
sendMail(From(from), Subject(hi),
  XHTMLMailBodyType(xmlContent)::To(to)::Nil : _* )
  }
}

//useMail.scala--
...
// host, user, password
my.site.Mail.config(smtp.gmail.com, *...@gmail.com, *)
// the recieved mail body becomes p??/p
my.site.Mail.send(*...@gmail.com, (p你好/p))

All source files are UTF-8, and project.build.sourceEncoding is UTF-8
too.
Is there a missing step?

--~--~-~--~~~---~--~~
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: email encoding problem

2009-09-12 Thread night_stalker

the last part is like:

Subject: hi
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary==_Part_0_21171036.1252770284921

--=_Part_0_21171036.1252770284921
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

p??/p
--=_Part_0_21171036.1252770284921--

I don't know how to set Content-Type ...

On Sep 12, 10:34 pm, Indrajit Raychaudhuri indraj...@gmail.com
wrote:
 Can you please check what the Content-Type field in the mail header
 looks like in the mail that you get?

 Cheers, Indrajit

--~--~-~--~~~---~--~~
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: email encoding problem

2009-09-12 Thread night_stalker

Thank you all for your replies.

I just modified  net/liftweb/util/Mailer.scala,
replaced all  text/html  with  text/html;charset=UTF-8 , then
problem solved.

the result mail's Content-Type part becomes:

  Content-Type: text/plain; charset=UTF-8
  Content-Transfer-Encoding: quoted-printable

and 你好 is shown correctly.
--~--~-~--~~~---~--~~
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: rewrite problem

2009-09-08 Thread night_stalker

Cool, thank you very much!

On Sep 8, 8:56 pm, Xavi Ramirez xavi@gmail.com wrote:
 That's because the url post/show is being intercepted by the same
 rewrite rule that matches post/id urls.  To get around this, try
 adding an if statement to your rewrite rule:

 LiftRules.rewrite.append {
   case RewriteRequest(ParsePath(List(post, id), _, _, _), _, _)
      if (id != show) =
         RewriteResponse(List(post,show), Map(id-urlDecode(id)))

 Hope this helps!

 ~Xavi

 On Tue, Sep 8, 2009 at 12:12 AM, night_stalkerusur...@gmail.com wrote:

  I want to make RESTful urls (not REST API), for example:

   /post/123 is mapped to post/show.html with param id=123

  but the following rewrite rule seems recursive

     LiftRules.rewrite.append {
       case RewriteRequest(ParsePath(List(post, id), _, _, _), _, _)
  =
         RewriteResponse(List(post,show), Map(id-urlDecode(id)))
     }

  and loops forever ...

--~--~-~--~~~---~--~~
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: rewrite problem

2009-09-08 Thread night_stalker

Can't find

   RewriteResponse.apply(List[String], Map[String, String], Boolean)

in 1.0 API, is it a new feature?

On Sep 8, 11:52 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 or:
 LiftRules.rewrite.append {
      case RewriteRequest(ParsePath(List(post, id), _, _, _), _, _)
 =
        RewriteResponse(List(post,show), Map(id-urlDecode(id)), *true*
 )
    }

 The true parameter stops the rewriting process so you don't get the infinite
 loop.

--~--~-~--~~~---~--~~
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] rewrite problem

2009-09-07 Thread night_stalker

I want to make RESTful urls (not REST API), for example:

  /post/123 is mapped to post/show.html with param id=123

but the following rewrite rule seems recursive

LiftRules.rewrite.append {
  case RewriteRequest(ParsePath(List(post, id), _, _, _), _, _)
=
RewriteResponse(List(post,show), Map(id-urlDecode(id)))
}

and loops forever ...

--~--~-~--~~~---~--~~
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: Good build tool for Lift/Scala projects

2009-07-24 Thread night_stalker

I hate pom.xml and prefer something like rake,scala code best.

On Jul 24, 5:23 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 Hi,

 We're currently using Gradle to build our Lift app. I've used Gradle
 previously on a Java project and really liked it. Unfortunately, it's
 Scala support is just a patch against an older version, which doesn't
 work with the latest releases.

 So before I jump in and try to hack some Scala support for Gradle, I
 thought I would ask here.

 So what are good build tools for a Lift project? Maven and ant are not
 an option :-) Some requirements are:

 - Extendable which probably implies some kind of scripting support in
   the build file (we have all our deployment and release automation
   scripted)

 - Dependency management (ability to read Maven repos)

 - Multiplatform - (OS X, Windows, Linux)

 - Hudson integration

 - Ability to package war, run jetty etc.

 - Run specs/tests

 - Ability to either call Java libraries or have good libs for
   integration with AWS (EC2, S3 etc)

 - For now this is a Scala only project.

 I've briefly looked at buildr but didn't get it to run on OS X. Another
 option might be sbt, but unsure how that works?

 Suggestions?

 /Jeppe

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---