Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Deprecation fixes

  • Loading branch information...
commit 6289a10a06397d51e1bb28cbef022d949cec43c6 1 parent a683fbf
@indrajitr indrajitr authored
View
2  core/json/src/main/scala/net/liftweb/json/Formats.scala
@@ -275,7 +275,7 @@ class CustomSerializer[A: Manifest](
val Class = implicitly[Manifest[A]].erasure
def deserialize(implicit format: Formats) = {
- case (TypeInfo(Class, _), json) =>
+ case (TypeInfo(Class, _), json) =>
if (ser(format)._1.isDefinedAt(json)) ser(format)._1(json)
else throw new MappingException("Can't convert " + json + " to " + Class)
}
View
10 core/json/src/test/scala/net/liftweb/json/FieldSerializerBugs.scala
@@ -19,7 +19,7 @@ package json
import org.specs.Specification
-object FieldSerializerBugs extends Specification {
+object FieldSerializerBugs extends Specification {
import Serialization.{read, write => swrite}
implicit val formats = DefaultFormats + FieldSerializer[AnyRef]()
@@ -29,7 +29,7 @@ object FieldSerializerBugs extends Specification {
import java.util.concurrent.atomic.AtomicInteger
val ser = swrite(new AtomicInteger(1))
- val atomic = read[AtomicInteger](ser)
+ val atomic = read[AtomicInteger](ser)
atomic.get mustEqual 1
}
*/
@@ -44,7 +44,7 @@ object FieldSerializerBugs extends Specification {
}
"FieldSerialization should work with Options" in {
- implicit val formats = DefaultFormats + FieldSerializer[ClassWithOption]()
+ implicit val formats = DefaultFormats + FieldSerializer[ClassWithOption]()
val t = new ClassWithOption
t.field = Some(5)
@@ -53,8 +53,8 @@ object FieldSerializerBugs extends Specification {
case class WithSymbol(`a-b*c`: Int)
- class ClassWithOption {
- var field: Option[Int] = None
+ class ClassWithOption {
+ var field: Option[Int] = None
}
}
View
8 core/util/src/main/scala/net/liftweb/util/PCDataMarkupParser.scala
@@ -162,7 +162,7 @@ class PCDataXmlParser(val input: Source) extends ConstructingHandler with PCData
val report = curInput.descr + ":" + line + ":" + col + ": " + msg
System.err.println(report)
try {
- System.err.println(curInput.getLine(line))
+ System.err.println(curInput.getLines().toIndexedSeq(line))
} catch {
case e: Exception => // ignore
}
@@ -205,21 +205,21 @@ object PCDataXmlParser {
pos += 1
}
}
-
+
moveToLT()
// scan past <? ... ?>
if (pos + 1 < len && in.charAt(pos + 1) == '?') {
pos += 1
moveToLT()
- }
+ }
// scan past <!DOCTYPE ....>
if (pos + 1 < len && in.charAt(pos + 1) == '!') {
pos += 1
moveToLT()
}
-
+
apply(Source.fromString(in.substring(pos)))
}
}
View
18 core/util/src/main/scala/net/liftweb/util/SecurityHelpers.scala
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-package net.liftweb
-package util
+package net.liftweb
+package util
import org.apache.commons.codec.binary.Base64
import java.io.{InputStream, ByteArrayOutputStream, ByteArrayInputStream, Reader, File, FileInputStream, BufferedReader}
@@ -35,20 +35,20 @@ object SecurityHelpers extends StringHelpers with IoHelpers with SecurityHelpers
* <li> create SHA, SHA-256, MD5 hashs (can be hex encoded)
* </ul>
*/
-trait SecurityHelpers {
- self: StringHelpers with IoHelpers =>
+trait SecurityHelpers {
+ self: StringHelpers with IoHelpers =>
/** short alias for java.security.SecureRandom */
private val _random = new SecureRandom
- private def withRandom[T](f: SecureRandom => T): T =
+ private def withRandom[T](f: SecureRandom => T): T =
_random.synchronized(f(_random))
/** return a random Long modulo a number */
- def randomLong(mod: Long): Long = withRandom(random => Math.abs(random.nextLong) % mod)
+ def randomLong(mod: Long): Long = withRandom(random => math.abs(random.nextLong) % mod)
/** return a random int modulo a number */
- def randomInt(mod: Int): Int = withRandom(random => Math.abs(random.nextInt) % mod)
+ def randomInt(mod: Int): Int = withRandom(random => math.abs(random.nextInt) % mod)
/**
* return true only 'percent' times when asked repeatedly.
@@ -98,7 +98,7 @@ trait SecurityHelpers {
case (_, null) => false
case (a, b) => secureEquals(a.getBytes("UTF-8"), b.getBytes("UTF-8"))
}
-
+
/** Compare two byte arrays in a way that does not vary if the arrays
* are determined to be not equal early (test every byte... avoids
* timing attackes */
@@ -118,7 +118,7 @@ trait SecurityHelpers {
ret && la == lb
}
}
-
+
/** create a SHA-256 hash from a Byte array */
def hash256(in : Array[Byte]) : Array[Byte] = {
View
1  persistence/mongodb/src/main/scala/net/liftweb/mongodb/Mongo.scala
@@ -68,6 +68,7 @@ object MongoHost {
/*
* Wrapper for creating a Replica Pair
*/
+@deprecated("Use `MongoSet` with `List[ServerAddress]` as argument instead")
case class MongoPair(left: ServerAddress, right: ServerAddress, options: MongoOptions = new MongoOptions) extends MongoHostBase {
lazy val mongo = new Mongo(left, right, options)
}
View
54 web/testkit/src/main/scala/net/liftweb/mocks/MockHttpServletRequest.scala
@@ -56,7 +56,7 @@ import json.JsonAST._
*
* @param url The URL to extract from
* @param contextPath The context path for this request. Defaults to "" per the Servlet API.
- *
+ *
*/
class MockHttpServletRequest(val url : String = null, var contextPath : String = "") extends HttpServletRequest {
@deprecated("Use the \"attributes\" var instead")
@@ -64,7 +64,7 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
@deprecated("Use the \"attributes\" var instead")
def attr_= (attrs : Map[String,Object]) = attributes = attrs
-
+
var attributes: Map[String, Object] = Map()
var authType: String = null
@@ -85,7 +85,7 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
/**
* Sets the body to the given string. The content
* type is set to "text/plain".
- *
+ *
* Note that the String will be converted to bytes
* based on the current setting of charEncoding.
*/
@@ -105,7 +105,7 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
/**
* Sets the body to the given elements. Also sets
* the contentType to "text/xml"
- *
+ *
* Note that the elements will be converted to bytes
* based on the current setting of charEncoding.
*/
@@ -113,7 +113,7 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
/**
* Sets the body to the given elements and content type.
- *
+ *
* Note that the elements will be converted to bytes
* based on the current setting of charEncoding.
*/
@@ -210,7 +210,7 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
if (q != null && q.length > 0) {
val newParams = ListBuffer[(String,String)]()
- q.split('&').foreach {
+ q.split('&').foreach {
pair => pair.split('=') match {
case Array(key,value) => {
// Append to the current key's value
@@ -219,7 +219,7 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
case invalid => throw new IllegalArgumentException("Invalid query string: \"" + q + "\"")
}
}
-
+
parameters = newParams.toList
method = "GET"
}
@@ -249,7 +249,7 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
var user : String = null
var userRoles : Set[String] = Set()
-
+
var userPrincipal : Principal = null
var scheme = "http"
@@ -339,7 +339,7 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
* <li>The userinfo field isn't processed. If you want to mock BASIC authentication,
* use the addBasicAuth method</li>
* </ol>
- *
+ *
* @param url The URL to extract from
* @param contextPath The servlet context of the request. Defaults to ""
*/
@@ -367,11 +367,11 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
queryString = url.getQuery
-
+
}
/** Compute the path portion after the contextPath */
- def computeRealPath (path : String) = {
+ def computeRealPath (path : String) = {
if (! path.startsWith(contextPath)) {
throw new IllegalArgumentException("Path \"%s\" doesn't begin with context path \"%s\"!".format(path, contextPath))
}
@@ -390,9 +390,9 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
// ServletRequest methods
- def getAttribute(key: String): Object = attr.get(key).getOrElse(null)
+ def getAttribute(key: String): Object = attributes.get(key).getOrElse(null)
- def getAttributeNames(): JEnum[Object] = attr.keys.iterator
+ def getAttributeNames(): JEnum[Object] = attributes.keys.iterator
def getCharacterEncoding(): String = charEncoding
@@ -409,12 +409,12 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
def getLocale(): Locale = locales.headOption.getOrElse(Locale.getDefault)
def getLocales(): JEnum[Object] = locales.iterator
-
+
def getLocalName(): String = localName
def getLocalPort(): Int = localPort
-
- def getParameter(key: String): String =
+
+ def getParameter(key: String): String =
parameters.find(_._1 == key).map(_._2) getOrElse null
def getParameterMap(): java.util.Map[Object, Object] = {
@@ -428,17 +428,17 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
asMap(newMap.map{case (k,v) => (k,v.toArray)}.asInstanceOf[Map[Object,Object]])
}
- def getParameterNames(): JEnum[Object] =
+ def getParameterNames(): JEnum[Object] =
parameters.map(_._1).distinct.iterator
- def getParameterValues(key: String): Array[String] =
+ def getParameterValues(key: String): Array[String] =
parameters.filter(_._1 == key).map(_._2).toArray
def getProtocol(): String = protocol
-
- def getReader(): BufferedReader =
+
+ def getReader(): BufferedReader =
new BufferedReader(new InputStreamReader(new ByteArrayInputStream(body), charEncoding))
-
+
def getRealPath(s: String): String = s
def getRemoteAddr(): String = remoteAddr
@@ -457,9 +457,9 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
def isSecure = secure
- def removeAttribute(key: String): Unit = attr -= key
+ def removeAttribute(key: String): Unit = attributes -= key
- def setAttribute(key: String, value: Object): Unit = attr += (key -> value)
+ def setAttribute(key: String, value: Object): Unit = attributes += (key -> value)
def setCharacterEncoding(enc: String): Unit = charEncoding = enc
@@ -477,7 +477,7 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
Empty
}
}
-
+
Helpers.tryo(handler,{
// Have to use internetDateFormatter directly since parseInternetDate returns the epoch date on failure
Box.!!(getHeader(h)).map(Helpers.internetDateFormatter.parse(_).getTime)
@@ -509,14 +509,14 @@ class MockHttpServletRequest(val url : String = null, var contextPath : String =
def getRemoteUser(): String = user
def getRequestedSessionId(): String = null
-
+
def getRequestURI(): String = contextPath + path
def getRequestURL(): StringBuffer = {
val buffer = new StringBuffer(scheme + "://" + localName)
-
+
if (localPort != 80) buffer.append(":" + localPort)
-
+
if (contextPath != "") buffer.append(contextPath)
buffer.append(path)
View
22 web/webkit/src/main/scala/net/liftweb/http/HtmlProperties.scala
@@ -154,7 +154,7 @@ trait HtmlProperties {
def userAgent = old.userAgent
}
}
-
+
/**
* Given a NodeSeq and a Writer, convert the output
@@ -257,7 +257,7 @@ trait HtmlProperties {
def userAgent = newUA
}
}
-
+
}
/**
@@ -269,7 +269,7 @@ final case class OldHtmlProperties(userAgent: Box[String]) extends HtmlPropertie
* setDocType.
*/
def docType: Box[String] = LiftRules.docType.vend.apply(S.request openOr Req.nil)
- def encoding: Box[String] =
+ def encoding: Box[String] =
Full(LiftRules.calculateXmlHeader(null, <ignore/>, contentType))
def contentType: Box[String] = {
@@ -294,10 +294,10 @@ final case class OldHtmlProperties(userAgent: Box[String]) extends HtmlPropertie
w.append(sb)
w.flush()
}
-
- def htmlOutputHeader: Box[String] =
+
+ def htmlOutputHeader: Box[String] =
(docType -> encoding) match {
- case (Full(dt), Full(enc)) if dt.length > 0 && enc.length > 0 =>
+ case (Full(dt), Full(enc)) if dt.length > 0 && enc.length > 0 =>
if (LiftRules.calcIE6ForResponse() && LiftRules.flipDocTypeForIE6) {
Full(dt.trim + "\n" + enc.trim + "\n")
} else {
@@ -317,7 +317,7 @@ final case class OldHtmlProperties(userAgent: Box[String]) extends HtmlPropertie
r.isChrome5 || r.isChrome6
}
- val maxOpenRequests: Int =
+ val maxOpenRequests: Int =
LiftRules.maxConcurrentRequests.vend(S.request openOr Req.nil)
}
@@ -337,7 +337,7 @@ final case class Html5Properties(userAgent: Box[String]) extends HtmlProperties
def htmlWriter: (Node, Writer) => Unit =
Html5.write(_, _, false, !LiftRules.convertToEntity.vend)
-
+
def htmlOutputHeader: Box[String] = docType.map(_.trim + "\n")
val html5FormsSupport: Boolean = {
@@ -346,7 +346,7 @@ final case class Html5Properties(userAgent: Box[String]) extends HtmlProperties
r.isChrome5 || r.isChrome6
}
- val maxOpenRequests: Int =
+ val maxOpenRequests: Int =
LiftRules.maxConcurrentRequests.vend(S.request openOr Req.nil)
}
@@ -369,7 +369,7 @@ final case class XHtmlInHtml5OutProperties(userAgent: Box[String]) extends HtmlP
def htmlWriter: (Node, Writer) => Unit =
Html5.write(_, _, false, !LiftRules.convertToEntity.vend)
-
+
def htmlOutputHeader: Box[String] = docType.map(_ + "\n")
val html5FormsSupport: Boolean = {
@@ -378,7 +378,7 @@ final case class XHtmlInHtml5OutProperties(userAgent: Box[String]) extends HtmlP
r.isChrome5 || r.isChrome6
}
- val maxOpenRequests: Int =
+ val maxOpenRequests: Int =
LiftRules.maxConcurrentRequests.vend(S.request openOr Req.nil)
}
View
2  web/webkit/src/main/scala/net/liftweb/http/LiftRules.scala
@@ -457,8 +457,6 @@ class LiftRules() extends Factory with FormVendor with LazyLoggable {
/**
* Set the doc type used. Use the HtmlProperties
- *
- * @deprecated
*/
@deprecated("Use the HtmlProperties")
val docType: FactoryMaker[Req => Box[String]] = new FactoryMaker( (r: Req) => r match {
View
44 web/webkit/src/main/scala/net/liftweb/http/S.scala
@@ -218,13 +218,13 @@ object S extends S {
}
/**
- * We create one of these dudes and put it
+ * We create one of these dudes and put it
*/
private[http] final case class PageStateHolder(owner: Box[String], session: LiftSession) extends AFuncHolder {
private val loc = S.location
private val snapshot: Function1[Function0[Any], Any] = RequestVarHandler.generateSnapshotRestorer()
override def sessionLife: Boolean = false
-
+
def apply(in: List[String]): Any = {
error("You shouldn't really be calling apply on this dude...")
}
@@ -365,7 +365,7 @@ trait S extends HasParams with Loggable {
* We can now collect Elems to put at the end of the body
*/
private object _tailTags extends TransientRequestVar(new ListBuffer[Elem])
-
+
private object p_queryLog extends TransientRequestVar(new ListBuffer[(String, Long)])
private object p_notice extends TransientRequestVar(new ListBuffer[(NoticeType.Value, NodeSeq, Box[String])])
@@ -574,7 +574,7 @@ trait S extends HasParams with Loggable {
* Get the current instance of HtmlProperties
*/
def htmlProperties: HtmlProperties = {
- session.map(_.requestHtmlProperties.is) openOr
+ session.map(_.requestHtmlProperties.is) openOr
LiftRules.htmlProperties.vend(
S.request openOr Req.nil
)
@@ -896,7 +896,7 @@ trait S extends HasParams with Loggable {
*/
def loc(str: String, dflt: NodeSeq): NodeSeq = loc(str).openOr(dflt)
-
+
/**
* Localize the incoming string based on a resource bundle for the current locale. The
* localized string is converted to an XML element if necessary via the <code>LiftRules.localizeStringToXml</code>
@@ -1236,12 +1236,12 @@ for {
def init[B](request: Req, session: LiftSession)(f: => B): B = {
if (inS.value) f
else {
- if (request.stateless_?)
+ if (request.stateless_?)
session.doAsStateless(_init(request, session)(() => f))
else _init(request, session)(() => f)
}
}
-
+
def statelessInit[B](request: Req)(f: => B): B = {
session match {
case Full(s) if s.stateful_? => {
@@ -1249,13 +1249,13 @@ for {
"Attempt to initialize a stateless session within the context "+
"of a stateful session")
}
-
+
case Full(_) => f
case _ => {
val fakeSess = LiftRules.statelessSession.vend.apply(request)
try {
- _init(request,
+ _init(request,
fakeSess)(() => f)
} finally {
// ActorPing.schedule(() => fakeSess.doShutDown(), 0 seconds)
@@ -1577,11 +1577,11 @@ for {
session match {
case Full(s) if s.stateful_? =>
LiftRules.earlyInStateful.toList.foreach(_(req))
-
- case Full(s) =>
+
+ case Full(s) =>
LiftRules.earlyInStateless.toList.foreach(_(req))
- case _ =>
+ case _ =>
}
f
}
@@ -1595,9 +1595,9 @@ for {
private def doStatefulRewrite(old: Req): Req = {
// Don't even try to rewrite Req.nil
if (statefulRequest_? &&
- !old.path.partPath.isEmpty &&
+ !old.path.partPath.isEmpty &&
(old.request ne null))
- Req(old, S.sessionRewriter.map(_.rewrite) :::
+ Req(old, S.sessionRewriter.map(_.rewrite) :::
LiftRules.statefulRewrite.toList, LiftRules.statelessTest.toList,
LiftRules.statelessReqTest.toList)
else old
@@ -2035,7 +2035,7 @@ for {
/**
* Retrieves the attributes from the most recently executed
* snippet element.
- *
+ *
* For example, given the snippets:
*
* <pre name="code" class="xml">
@@ -2644,7 +2644,7 @@ for {
@deprecated("Use AFuncHolder.listStrToAF")
def toLFunc(in: List[String] => Any): AFuncHolder = LFuncHolder(in, Empty)
-
+
@deprecated("Use AFuncHolder.unitToAF")
def toNFunc(in: () => Any): AFuncHolder = NFuncHolder(in, Empty)
@@ -2708,17 +2708,17 @@ for {
case Full(ret) =>
ret.fixSessionTime()
ret
-
+
case _ =>
val ret = LiftSession(httpRequest.session, req.contextPath)
ret.fixSessionTime()
- SessionMaster.addSession(ret,
+ SessionMaster.addSession(ret,
req,
- httpRequest.userAgent,
+ httpRequest.userAgent,
SessionMaster.getIpFromReq(req))
ret
}
-
+
init(req, ses) {
doRender(ses)
}
@@ -2761,14 +2761,14 @@ for {
/**
* Returns all the HTTP parameters having 'n' name
*/
- def params(n: String): List[String] =
+ def params(n: String): List[String] =
paramsForComet.get.get(n) getOrElse
request.flatMap(_.params.get(n)).openOr(Nil)
/**
* Returns the HTTP parameter having 'n' name
*/
- def param(n: String): Box[String] =
+ def param(n: String): Box[String] =
paramsForComet.get.get(n).flatMap(_.headOption) orElse
request.flatMap(r => Box(r.param(n)))
View
36 web/webkit/src/main/scala/net/liftweb/http/js/JsCommands.scala
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.liftweb
-package http
-package js
+package net.liftweb
+package http
+package js
import scala.xml.{NodeSeq, Group, Unparsed, Elem}
import net.liftweb.util.Helpers._
@@ -87,12 +87,12 @@ trait JsObj extends JsExp {
other match {
case jsObj: JsObj => {
import scala.annotation.tailrec
-
+
@tailrec def test(me: Map[String, JsExp], them: List[(String, JsExp)]): Boolean = {
them match {
case Nil => me.isEmpty
case _ if me.isEmpty => false
- case (k, v) :: xs =>
+ case (k, v) :: xs =>
me.get(k) match {
case None => false
case Some(mv) if mv != v => false
@@ -100,10 +100,10 @@ trait JsObj extends JsExp {
}
}
}
-
+
test(Map(props :_*), jsObj.props)
}
-
+
case x => super.equals(x)
}
}
@@ -185,12 +185,12 @@ trait JsExp extends HtmlFixer with ToJsCmd {
def ~>(right: Box[JsMember]): JsExp = right.dmap(this)(r => ~>(r))
-
+
/**
* This exists for backward compatibility reasons for JQueryLeft and JQueryRight
* which are now deprecated. Use ~> whenever possible as this will be removed soon.
*/
- @deprecated
+ @deprecated("Use `~>` instead")
def >>(right: JsMember): JsExp = ~>(right)
@@ -228,7 +228,7 @@ object JE {
def apply(d: Double): Num = new Num(d)
def apply(f: Float): Num = new Num(f)
}
-
+
case class Num(n: Number) extends JsExp {
def toJsCmd = n.toString
}
@@ -558,7 +558,7 @@ trait HtmlFixer {
@deprecated("Use fixHtmlAndJs or fixHtmlFunc")
protected def fixHtml(uid: String, content: NodeSeq): String = {
val w = new java.io.StringWriter
-
+
S.htmlProperties.
htmlWriter(Group(S.session.
map(s =>
@@ -576,7 +576,7 @@ trait HtmlFixer {
* then evaluations to Expression. For use when converting
* a JsExp that contains HTML.
*/
- def fixHtmlFunc(uid: String, content: NodeSeq)(f: String => String) =
+ def fixHtmlFunc(uid: String, content: NodeSeq)(f: String => String) =
fixHtmlAndJs(uid, content) match {
case (str, Nil) => f(str)
case (str, cmds) => "((function() {"+cmds.reduceLeft{_ & _}.toJsCmd+" return "+f(str)+";})())"
@@ -589,7 +589,7 @@ trait HtmlFixer {
* For use when converting
* a JsCmd that contains HTML.
*/
- def fixHtmlCmdFunc(uid: String, content: NodeSeq)(f: String => String) =
+ def fixHtmlCmdFunc(uid: String, content: NodeSeq)(f: String => String) =
fixHtmlAndJs(uid, content) match {
case (str, Nil) => f(str)
case (str, cmds) => f(str)+"; "+cmds.reduceLeft(_ & _).toJsCmd
@@ -604,7 +604,7 @@ trait HtmlFixer {
import Helpers._
val w = new java.io.StringWriter
-
+
val xhtml = S.session.
map(s =>
s.fixHtml(s.processSurroundAndInclude("JS SetHTML id: "
@@ -614,7 +614,7 @@ trait HtmlFixer {
import scala.collection.mutable.ListBuffer
val lb = new ListBuffer[JsCmd]
-
+
val revised = ("script" #> ((ns: NodeSeq) => {
ns match {
case FindScript(e) => {
@@ -726,7 +726,7 @@ object JsCmds {
/**
* Sets the focus on the element denominated by the id
- */
+ */
case class Focus(id: String) extends JsCmd {
def toJsCmd = "if (document.getElementById(" + id.encJs + ")) {document.getElementById(" + id.encJs + ").focus();};"
}
@@ -781,7 +781,7 @@ object JsCmds {
/**
* Assigns the value of 'right' to the members of the element
- * having this 'id', chained by 'then' sequences
+ * having this 'id', chained by 'then' sequences
*/
case class SetElemById(id: String, right: JsExp, then: String*) extends JsCmd {
def toJsCmd = "if (document.getElementById(" + id.encJs + ")) {document.getElementById(" + id.encJs + ")" + (
@@ -854,7 +854,7 @@ object JsCmds {
*/
def apply(where: String, func: () => Unit): RedirectTo =
S.session match {
- case Full(liftSession) =>
+ case Full(liftSession) =>
new RedirectTo(liftSession.attachRedirectFunc(where, Full(func)))
case _ => new RedirectTo(where)
}
View
34 web/webkit/src/test/scala/net/liftweb/http/SnippetSpec.scala
@@ -32,9 +32,9 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
System.nanoTime, System.nanoTime, false,
() => ParamCalcInfo(Nil, Map.empty, Nil, Empty), Map())
- "LiftSession" should {
+ "Templates" should {
"Correctly process lift:content_id" in {
- val ret = LiftSession.checkForContentId(<html lift:content_id="content">
+ val ret = Templates.checkForContentId(<html lift:content_id="content">
<head/>
<body>
<div id="content" class="lift:surround"/>
@@ -45,7 +45,7 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
}
"Correctly process body class" in {
- val ret = LiftSession.checkForContentId(<html>
+ val ret = Templates.checkForContentId(<html>
<head/>
<body class="lift:content_id=frog">
<div><span> mooose dog
@@ -58,7 +58,7 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
}
"Correctly process l:content_id" in {
- val ret = LiftSession.checkForContentId(<html l:content_id="dog">
+ val ret = Templates.checkForContentId(<html l:content_id="dog">
<head/>
<body>
<lift:surround id="dog"><div/></lift:surround>
@@ -75,12 +75,12 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
<div class="lift:surround"/>
</body>
</html>
-
- val ret = LiftSession.checkForContentId(xml)
+
+ val ret = Templates.checkForContentId(xml)
ret must_== xml
}
-
+
"Snippet invocation works <lift:xxx/>" in {
val res = <div/>
@@ -186,9 +186,10 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
val ret =
S.statelessInit(Req.nil) {
S.mapSnippetsWith("foo" -> testAttrs _) {
+ val clStr = "l:foo?bing=bong&amp;fuzz=faz+snark&amp;noodle=FatPoodle"
for {
s <- S.session
- } yield s.processSurroundAndInclude("test", <div class="l:foo?bing=bong&amp;fuzz=faz+snark&amp;noodle=FatPoodle" />)
+ } yield s.processSurroundAndInclude("test", <div class={clStr} />)
}
}
@@ -236,8 +237,6 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
}
"Snippet invocation fails class='l:bar'" in {
- val res = <div/>
-
val ret =
S.statelessInit(Req.nil) {
S.mapSnippetsWith("foo" -> ((a: NodeSeq) => a)) {
@@ -274,7 +273,7 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
S.mapSnippetsWith("foo" -> ChangeVar.foo _) {
for {
s <- S.session
- } yield s.processSurroundAndInclude("test",
+ } yield s.processSurroundAndInclude("test",
<lift:foo>{res}</lift:foo>)
}
}
@@ -291,7 +290,7 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
S.mapSnippetsWith("foo" -> ChangeVar.foo _) {
for {
s <- S.session
- } yield s.processSurroundAndInclude("test",
+ } yield s.processSurroundAndInclude("test",
<lift:foo>{res}</lift:foo>)
}
}
@@ -307,7 +306,7 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
S.mapSnippetsWith("foo" -> Funky.foo _) {
for {
s <- S.session
- } yield s.processSurroundAndInclude("test",
+ } yield s.processSurroundAndInclude("test",
<lift:foo>{res}</lift:foo>)
}
}
@@ -324,7 +323,7 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
S.mapSnippetsWith("foo" -> Funky.foo _) {
for {
s <- S.session
- } yield s.processSurroundAndInclude("test",
+ } yield s.processSurroundAndInclude("test",
<lift:foo>{res}</lift:foo>)
}
}
@@ -361,7 +360,7 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
val ret = S.init(makeReq, session) {
for {
s <- S.session
- } yield s.processSurroundAndInclude("test",
+ } yield s.processSurroundAndInclude("test",
<lift:Meower>Moo</lift:Meower>)
}
@@ -376,7 +375,7 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
val ret = S.init(makeReq, session) {
for {
s <- S.session
- } yield s.processSurroundAndInclude("test",
+ } yield s.processSurroundAndInclude("test",
<input class="lift:Splunker"/>)
}
@@ -387,14 +386,13 @@ object SnippetSpec extends Specification("SnippetSpec Specification") {
"Eager Eval works" in {
- val res = <div>dog</div>
val session = new LiftSession("", "hello", Empty)
S.init(makeReq, session) {
S.mapSnippetsWith("foo" -> ChangeVar.foo _) {
for {
s <- S.session
- } yield s.processSurroundAndInclude("test",
+ } yield s.processSurroundAndInclude("test",
<div class="l:foo?eager_eval=true">a<lift:foo>b</lift:foo></div>)
}
myInfo.is must_== "ab"
Please sign in to comment.
Something went wrong with that request. Please try again.