Skip to content
Permalink
Browse files

Merge branch 'feature/scala2.11' into develop

  • Loading branch information
seratch committed Jun 10, 2014
2 parents 962bc13 + 50ed824 commit 1e44f60e5c5d0f53ab0102697a00413ad7a696d0
Showing with 242 additions and 314 deletions.
  1. +1 −0 .travis.yml
  2. +1 −2 assets/src/test/scala/skinny/assets/CoffeeScriptCompilerSpec.scala
  3. +1 −2 assets/src/test/scala/skinny/assets/LessCompilerSpec.scala
  4. +1 −2 assets/src/test/scala/skinny/assets/SassCompilerSpec.scala
  5. +2 −3 common/src/test/scala/skinny/I18nSpec.scala
  6. +2 −3 common/src/test/scala/skinny/ParamTypeSpec.scala
  7. +2 −4 common/src/test/scala/skinny/SkinnyEnvSpec.scala
  8. +2 −3 common/src/test/scala/skinny/util/DateTimeUtilTest.scala
  9. +1 −2 common/src/test/scala/skinny/util/LTSVSpec.scala
  10. +2 −4 common/src/test/scala/skinny/util/StringUtilTest.scala
  11. +2 −3 common/src/test/scala/skinny/util/TypesafeConfigReaderSpec.scala
  12. +1 −1 example/src/main/scala/lib/DBInitializer.scala
  13. +1 −1 example/src/main/scala/model/Comment.scala
  14. +1 −1 example/src/main/scala/model/Company.scala
  15. +1 −1 example/src/main/scala/model/Programmer.scala
  16. +1 −1 example/src/main/scala/model/Skill.scala
  17. +1 −1 example/src/main/scala/model/SnakeCaseKeyExample.scala
  18. +1 −1 example/src/main/scala/templates/ScalatePackage.scala
  19. +2 −3 example/src/test/scala/controller/CompaniesControllerSpec.scala
  20. +2 −3 example/src/test/scala/controller/SampleApiControllerSpec.scala
  21. +5 −5 example/src/test/scala/integrationtest/AssetsSpec.scala
  22. +1 −1 factory-girl/src/main/scala/skinny/test/FactoryGirl.scala
  23. +3 −4 factory-girl/src/test/scala/blog/BlogSpec.scala
  24. +1 −1 factory-girl/src/test/scala/blog/CreateTables.scala
  25. +1 −1 factory-girl/src/test/scala/blog/Post.scala
  26. +1 −1 factory-girl/src/test/scala/blog/PostTag.scala
  27. +1 −1 factory-girl/src/test/scala/blog/Tag.scala
  28. +9 −4 framework/src/main/scala/org/scalatra/SkinnyScalatraBase.scala
  29. +5 −5 framework/src/main/scala/skinny/controller/feature/ScalateTemplateEngineFeature.scala
  30. +1 −1 framework/src/main/scala/skinny/session/jdbc/ServletSession.scala
  31. +1 −1 framework/src/main/scala/skinny/session/jdbc/SkinnySession.scala
  32. +1 −1 framework/src/main/scala/skinny/session/jdbc/SkinnySessionAttribute.scala
  33. +1 −2 framework/src/test/scala/skinny/controller/ConstantsSpec.scala
  34. +3 −3 framework/src/test/scala/skinny/controller/JSONFeatureSpec.scala
  35. +10 −13 framework/src/test/scala/skinny/controller/ScalateTemplateEngineFeaturespec.scala
  36. +1 −1 framework/src/test/scala/skinny/controller/SkinnyApiControllerSpec.scala
  37. +1 −1 framework/src/test/scala/skinny/controller/SkinnyApiResourceSpec.scala
  38. +1 −2 framework/src/test/scala/skinny/controller/SkinnyApiServletSpec.scala
  39. +1 −1 framework/src/test/scala/skinny/session/CreateTables.scala
  40. +3 −4 framework/src/test/scala/skinny/session/SkinnySessionSpec.scala
  41. +2 −4 framework/src/test/scala/skinny/util/JSONStringOpsSpec.scala
  42. +2 −3 framework/src/test/scala/skinny/worker/SkinnyWorkerServiceSpec.scala
  43. +2 −4 mailer/src/test/scala/skinny/mailer/SkinnyMailerSpec.scala
  44. +2 −3 mailer/src/test/scala/skinny/mailer/SkinnyMessageSpec.scala
  45. +2 −4 mailer/src/test/scala/skinny/mailer/WithoutTestSupportSpec.scala
  46. +1 −1 orm/src/main/scala/skinny/orm/SkinnyJoinTable.scala
  47. +1 −1 orm/src/main/scala/skinny/orm/SkinnyJoinTableWithId.scala
  48. +2 −2 orm/src/main/scala/skinny/orm/SkinnyMapperBase.scala
  49. +0 −2 orm/src/main/scala/skinny/orm/SkinnyRecord.scala
  50. +0 −4 orm/src/main/scala/skinny/orm/SkinnyRecordBase.scala
  51. +1 −1 orm/src/main/scala/skinny/orm/SkinnyRecordBaseWithId.scala
  52. +0 −2 orm/src/main/scala/skinny/orm/SkinnyRecordWithId.scala
  53. +1 −1 orm/src/main/scala/skinny/orm/feature/AssociationsFeature.scala
  54. +1 −1 orm/src/main/scala/skinny/orm/feature/AutoSessionFeature.scala
  55. +3 −3 orm/src/main/scala/skinny/orm/feature/CRUDFeature.scala
  56. +1 −1 orm/src/main/scala/skinny/orm/feature/CalculationFeature.scala
  57. +1 −1 orm/src/main/scala/skinny/orm/feature/ConnectionPoolFeature.scala
  58. +2 −2 orm/src/main/scala/skinny/orm/feature/DynamicTableNameFeature.scala
  59. +1 −1 orm/src/main/scala/skinny/orm/feature/FinderFeature.scala
  60. +2 −2 orm/src/main/scala/skinny/orm/feature/IncludesFeature.scala
  61. +2 −2 orm/src/main/scala/skinny/orm/feature/JoinsFeature.scala
  62. +1 −1 orm/src/main/scala/skinny/orm/feature/NoIdCUDFeature.scala
  63. +1 −1 orm/src/main/scala/skinny/orm/feature/NoIdFinderFeature.scala
  64. +2 −2 orm/src/main/scala/skinny/orm/feature/NoIdJoinsFeature.scala
  65. +1 −1 orm/src/main/scala/skinny/orm/feature/NoIdQueryingFeature.scala
  66. +1 −1 orm/src/main/scala/skinny/orm/feature/OptimisticLockWithTimestampFeature.scala
  67. +1 −1 orm/src/main/scala/skinny/orm/feature/OptimisticLockWithVersionFeature.scala
  68. +1 −1 orm/src/main/scala/skinny/orm/feature/QueryingFeature.scala
  69. +1 −1 orm/src/main/scala/skinny/orm/feature/SoftDeleteWithBooleanFeature.scala
  70. +1 −1 orm/src/main/scala/skinny/orm/feature/SoftDeleteWithTimestampFeature.scala
  71. +1 −1 orm/src/main/scala/skinny/orm/feature/TimestampsFeature.scala
  72. +1 −1 orm/src/main/scala/skinny/orm/feature/associations/JoinDefinition.scala
  73. +1 −1 orm/src/main/scala/skinny/orm/package.scala
  74. +3 −4 orm/src/test/scala/blog/BlogSpec.scala
  75. +1 −1 orm/src/test/scala/blog/CreateTables.scala
  76. +1 −1 orm/src/test/scala/blog/Post.scala
  77. +1 −1 orm/src/test/scala/blog/PostTag.scala
  78. +1 −1 orm/src/test/scala/blog/Tag.scala
  79. +3 −4 orm/src/test/scala/blog2/BlogSpec.scala
  80. +1 −1 orm/src/test/scala/blog2/CreateTables.scala
  81. +1 −1 orm/src/test/scala/blog2/Post.scala
  82. +1 −1 orm/src/test/scala/blog2/PostTag.scala
  83. +1 −1 orm/src/test/scala/blog2/Tag.scala
  84. +1 −1 orm/src/test/scala/service/Application.scala
  85. +1 −1 orm/src/test/scala/service/CreateTables.scala
  86. +1 −1 orm/src/test/scala/service/Service.scala
  87. +1 −1 orm/src/test/scala/service/ServiceSetting.scala
  88. +3 −4 orm/src/test/scala/service/ServiceSpec.scala
  89. +2 −3 orm/src/test/scala/skinny/dbmigration/DBSeedsSpec.scala
  90. +1 −1 orm/src/test/scala/skinny/orm/CreateTables.scala
  91. +1 −1 orm/src/test/scala/skinny/orm/LightFactoryGirl.scala
  92. +3 −4 orm/src/test/scala/skinny/orm/SkinnyORMSpec.scala
  93. +2 −2 orm/src/test/scala/skinny/orm/feature/StrongParametersFeatureSpec.scala
  94. +2 −2 orm/src/test/scala/skinny/orm/models.scala
  95. +1 −1 orm/src/test/scala/test001/CreateTables.scala
  96. +3 −4 orm/src/test/scala/test001/Test001Spec.scala
  97. +1 −1 orm/src/test/scala/test001/models.scala
  98. +22 −18 project/Build.scala
  99. +2 −2 task/src/main/scala/skinny/task/generator/ModelGenerator.scala
  100. +2 −3 task/src/test/scala/skinny/task/generator/ControllerGeneratorSpec.scala
  101. +7 −8 task/src/test/scala/skinny/task/generator/ModelGeneratorSpec.scala
  102. +1 −2 task/src/test/scala/skinny/task/generator/ScaffoldGeneratorSpec.scala
  103. +1 −2 task/src/test/scala/skinny/task/generator/ScaffoldJadeGeneratorSpec.scala
  104. +1 −2 task/src/test/scala/skinny/task/generator/ScaffoldScamlGeneratorSpec.scala
  105. +1 −2 task/src/test/scala/skinny/task/generator/ScaffoldSspGeneratorSpec.scala
  106. +6 −0 test/src/main/scala/skinny/test/MockHttpServletRequest.scala
  107. +2 −0 test/src/main/scala/skinny/test/MockHttpServletResponse.scala
  108. +1 −2 validator/src/test/scala/UsageSpec.scala
  109. +1 −2 validator/src/test/scala/skinny/validator/ErrorSpec.scala
  110. +1 −2 validator/src/test/scala/skinny/validator/ErrorsSpec.scala
  111. +1 −2 validator/src/test/scala/skinny/validator/MessagesSpec.scala
  112. +1 −2 validator/src/test/scala/skinny/validator/ParametersSpec.scala
  113. +1 −2 validator/src/test/scala/skinny/validator/ValidationsSpec.scala
  114. +1 −2 validator/src/test/scala/skinny/validator/ValidatorLikeSpec.scala
  115. +1 −2 validator/src/test/scala/skinny/validator/ValidatorSpec.scala
  116. +1 −2 validator/src/test/scala/skinny/validator/dateFormatSpec.scala
  117. +1 −4 validator/src/test/scala/skinny/validator/dateTimeFormatSpec.scala
  118. +1 −2 validator/src/test/scala/skinny/validator/doubleMaxValueSpec.scala
  119. +1 −2 validator/src/test/scala/skinny/validator/doubleMinMaxValueSpec.scala
  120. +1 −2 validator/src/test/scala/skinny/validator/doubleMinValueSpec.scala
  121. +1 −2 validator/src/test/scala/skinny/validator/doubleValueSpec.scala
  122. +1 −2 validator/src/test/scala/skinny/validator/emailSpec.scala
  123. +1 −2 validator/src/test/scala/skinny/validator/floatMaxValueSpec.scala
  124. +1 −2 validator/src/test/scala/skinny/validator/floatMinMaxValueSpec.scala
  125. +1 −2 validator/src/test/scala/skinny/validator/floatMinValueSpec.scala
  126. +1 −2 validator/src/test/scala/skinny/validator/floatValueSpec.scala
  127. +1 −2 validator/src/test/scala/skinny/validator/futureSpec.scala
  128. +1 −2 validator/src/test/scala/skinny/validator/intMaxValueSpec.scala
  129. +1 −2 validator/src/test/scala/skinny/validator/intMinMaxValueSpec.scala
  130. +1 −2 validator/src/test/scala/skinny/validator/intMinValueSpec.scala
  131. +1 −2 validator/src/test/scala/skinny/validator/intValueSpec.scala
  132. +1 −2 validator/src/test/scala/skinny/validator/lengthSpec.scala
  133. +1 −2 validator/src/test/scala/skinny/validator/longMaxValueSpec.scala
  134. +1 −2 validator/src/test/scala/skinny/validator/longMinMaxValueSpec.scala
  135. +1 −2 validator/src/test/scala/skinny/validator/longMinValueSpec.scala
  136. +1 −2 validator/src/test/scala/skinny/validator/longValueSpec.scala
  137. +1 −2 validator/src/test/scala/skinny/validator/maxLengthSpec.scala
  138. +1 −2 validator/src/test/scala/skinny/validator/minLengthSpec.scala
  139. +1 −2 validator/src/test/scala/skinny/validator/minMaxLengthSpec.scala
  140. +1 −2 validator/src/test/scala/skinny/validator/notEmptySpec.scala
  141. +1 −2 validator/src/test/scala/skinny/validator/notNullSpec.scala
  142. +1 −2 validator/src/test/scala/skinny/validator/numericSpec.scala
  143. +1 −2 validator/src/test/scala/skinny/validator/pastSpec.scala
  144. +1 −2 validator/src/test/scala/skinny/validator/requiredSpec.scala
  145. +1 −2 validator/src/test/scala/skinny/validator/sameSpec.scala
  146. +1 −2 validator/src/test/scala/skinny/validator/timeFormatSpec.scala
@@ -1,5 +1,6 @@
language: scala
scala:
- 2.10.4
- 2.11.0
script: "gem install sass && sbt \"example/run db:migrate test\" && sbt test && yes|./run_skinny-blank-app_test.sh"

@@ -1,9 +1,8 @@
package skinny.assets

import org.scalatest._
import org.scalatest.matchers._

class CoffeeScriptCompilerSpec extends FlatSpec with ShouldMatchers {
class CoffeeScriptCompilerSpec extends FlatSpec with Matchers {

behavior of "CoffeeScriptCompiler"

@@ -1,9 +1,8 @@
package skinny.assets

import org.scalatest._
import org.scalatest.matchers._

class LessCompilerSpec extends FlatSpec with ShouldMatchers {
class LessCompilerSpec extends FlatSpec with Matchers {

behavior of "LessCompiler"

@@ -1,9 +1,8 @@
package skinny.assets

import org.scalatest._
import org.scalatest.matchers._

class SassCompilerSpec extends FlatSpec with ShouldMatchers {
class SassCompilerSpec extends FlatSpec with Matchers {

behavior of "SassCompiler"

@@ -1,10 +1,9 @@
package skinny

import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
import org.scalatest._
import java.util.Locale

class I18nSpec extends FlatSpec with ShouldMatchers {
class I18nSpec extends FlatSpec with Matchers {

behavior of "I18n"

@@ -1,9 +1,8 @@
package skinny

import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
import org.scalatest._

class ParamTypeSpec extends FlatSpec with ShouldMatchers {
class ParamTypeSpec extends FlatSpec with Matchers {

behavior of "ParamType.Boolean"

@@ -1,10 +1,8 @@
package skinny

import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
import java.util.Locale
import org.scalatest._

class SkinnyEnvSpec extends FlatSpec with ShouldMatchers {
class SkinnyEnvSpec extends FlatSpec with Matchers {

behavior of "SkinnyEnv"

@@ -1,10 +1,9 @@
package skinny.util

import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
import org.scalatest._
import skinny.ParamType

class DateTimeUtilTest extends FlatSpec with ShouldMatchers {
class DateTimeUtilTest extends FlatSpec with Matchers {

behavior of "DateTimeUtil"

@@ -1,9 +1,8 @@
package skinny.util

import org.scalatest._
import org.scalatest.matchers._

class LTSVSpec extends FlatSpec with ShouldMatchers {
class LTSVSpec extends FlatSpec with Matchers {

behavior of "LTSV.parseLines"

@@ -1,10 +1,8 @@
package skinny.util

import org.scalatest.FlatSpec
import org.scalatest.matchers.ShouldMatchers
import skinny.ParamType
import org.scalatest._

class StringUtilTest extends FlatSpec with ShouldMatchers {
class StringUtilTest extends FlatSpec with Matchers {
import StringUtil._

behavior of "StringUtil"
@@ -1,9 +1,8 @@
package skinny.util

import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers
import org.scalatest._

class TypesafeConfigReaderSpec extends FunSpec with ShouldMatchers {
class TypesafeConfigReaderSpec extends FunSpec with Matchers {

describe("TypesafeConfigReader#load") {

@@ -1,6 +1,6 @@
package lib

import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import skinny.dbmigration.DBSeeds

object DBInitializer extends DBSeeds {
@@ -1,6 +1,6 @@
package model

import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import skinny.orm.SkinnyCRUDMapper

case class Comment(id: Long, author: String, text: String)
@@ -1,6 +1,6 @@
package model

import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import org.joda.time.DateTime
import skinny.orm.SkinnyCRUDMapperWithId
import skinny.orm.feature._
@@ -1,6 +1,6 @@
package model

import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import org.joda.time._
import skinny.orm.SkinnyCRUDMapper
import skinny.orm.feature.{ TimestampsFeature, SoftDeleteWithTimestampFeature }
@@ -1,6 +1,6 @@
package model

import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import org.joda.time.DateTime
import skinny.orm.SkinnyCRUDMapper

@@ -1,7 +1,7 @@
package model

import skinny.orm._, feature._
import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import org.joda.time._

case class SnakeCaseKeyExample(
@@ -9,7 +9,7 @@ import org.fusesource.scalate.{ Binding, TemplateSource }
class ScalatePackage extends TemplatePackage {

/** Returns the Scala code to add to the top of the generated template method */
def header(source: TemplateSource, bindings: List[Binding]) = """
override def header(source: TemplateSource, bindings: List[Binding]) = """
import controller._
import model._
"""
@@ -1,13 +1,12 @@
package controller

import org.scalatest.matchers.ShouldMatchers
import org.scalatest.FunSpec
import org.scalatest._
import skinny.test.{ MockController, FactoryGirl }
import model.Company
import skinny.Format
import unit.DBSettings

class CompaniesControllerSpec extends FunSpec with ShouldMatchers with DBSettings {
class CompaniesControllerSpec extends FunSpec with Matchers with DBSettings {

describe("CompaniesController") {

@@ -1,11 +1,10 @@
package controller

import org.scalatest.FunSpec
import org.scalatest.matchers.ShouldMatchers
import org.scalatest._
import unit.DBSettings
import skinny.test.MockApiController

class SampleApiControllerSpec extends FunSpec with ShouldMatchers with DBSettings {
class SampleApiControllerSpec extends FunSpec with Matchers with DBSettings {

def createMockController = new SampleApiController with MockApiController

@@ -12,7 +12,7 @@ class AssetsSpec extends ScalatraFlatSpec with SkinnyTestSupport {
it should "show react jsx template resources" in {
get("/assets/js/hello-react.js") {
status should equal(200)
header("Content-Type") should equal("application/javascript;charset=UTF-8")
header("Content-Type") should equal("application/javascript; charset=UTF-8")
body.replaceFirst("\n$", "") should equal(
"""/** @jsx React.DOM */
|React.renderComponent(
@@ -32,7 +32,7 @@ class AssetsSpec extends ScalatraFlatSpec with SkinnyTestSupport {
it should "show coffee script resources" in {
get("/assets/js/echo.js") {
status should equal(200)
header("Content-Type") should equal("application/javascript;charset=UTF-8")
header("Content-Type") should equal("application/javascript; charset=UTF-8")
body.replaceFirst("^// Generated by CoffeeScript .+\n", "").replaceFirst("\n$", "") should equal("""(function() {
var echo;
@@ -54,7 +54,7 @@ class AssetsSpec extends ScalatraFlatSpec with SkinnyTestSupport {
it should "show less resources" in {
get("/assets/css/box.css") {
status should equal(200)
header("Content-Type") should equal("text/css;charset=UTF-8")
header("Content-Type") should equal("text/css; charset=UTF-8")
body should equal(""".box {
color: #fe33ac;
border-color: #fdcdea;
@@ -71,7 +71,7 @@ class AssetsSpec extends ScalatraFlatSpec with SkinnyTestSupport {
it should "show scss resources" in {
get("/assets/css/variables-in-scss.css") {
status should equal(200)
header("Content-Type") should equal("text/css;charset=UTF-8")
header("Content-Type") should equal("text/css; charset=UTF-8")
body.replaceFirst("\n$", "") should equal("""body {
| font: 100% Helvetica, sans-serif;
| color: #333333; }""".stripMargin)
@@ -86,7 +86,7 @@ class AssetsSpec extends ScalatraFlatSpec with SkinnyTestSupport {
it should "show sass resources" in {
get("/assets/css/indented-sass.css") {
status should equal(200)
header("Content-Type") should equal("text/css;charset=UTF-8")
header("Content-Type") should equal("text/css; charset=UTF-8")
body.replaceFirst("\n$", "") should equal("""#main {
| color: blue;
| font-size: 0.3em; }""".stripMargin)
@@ -2,7 +2,7 @@ package skinny.test

import com.typesafe.config.ConfigFactory
import scala.collection.JavaConverters._
import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import skinny.orm.feature.CRUDFeatureWithId
import skinny.exception.FactoryGirlException
import skinny.util.JavaReflectAPI
@@ -1,14 +1,13 @@
package blog

import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import scalikejdbc.scalatest.AutoRollback

import org.scalatest.fixture
import org.scalatest.matchers.ShouldMatchers
import org.scalatest.{ Matchers, fixture }
import skinny.test.FactoryGirl
import skinny.logging.Logging

class BlogSpec extends fixture.FunSpec with ShouldMatchers
class BlogSpec extends fixture.FunSpec with Matchers
with Connection with CreateTables with AutoRollback with Logging {

override def db(): DB = NamedDB('fg).toDB()
@@ -1,6 +1,6 @@
package blog

import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import skinny.dbmigration.DBSeeds

trait CreateTables extends DBSeeds { self: Connection =>
@@ -1,7 +1,7 @@
package blog

import skinny.orm._, feature._
import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import org.joda.time._

case class Post(
@@ -1,7 +1,7 @@
package blog

import skinny.orm._, feature._
import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import org.joda.time._

case class PostTag(
@@ -1,7 +1,7 @@
package blog

import skinny.orm._, feature._
import scalikejdbc._, SQLInterpolation._
import scalikejdbc._
import org.joda.time._

case class Tag(
@@ -19,7 +19,7 @@ import skinny.SkinnyEnv
*/
trait SkinnyScalatraBase extends ScalatraBase {

protected override def executeRoutes() {
override protected def executeRoutes() {
var result: Any = null
var rendered = true

@@ -60,8 +60,11 @@ trait SkinnyScalatraBase extends ScalatraBase {
rendered = false
}, e => {
runCallbacks(Failure(e))
renderUncaughtException(e)
runRenderCallbacks(Failure(e))
try {
renderUncaughtException(e)
} finally {
runRenderCallbacks(Failure(e))
}
})
})

@@ -96,12 +99,14 @@ trait SkinnyScalatraBase extends ScalatraBase {
case e: PassException => None
}

// TODO fixed?
override def url(
path: String,
params: Iterable[(String, Any)] = Iterable.empty,
includeContextPath: Boolean = true,
includeServletPath: Boolean = true,
absolutize: Boolean = true)(
absolutize: Boolean = true,
withSessionId: Boolean = true)(
implicit request: HttpServletRequest, response: HttpServletResponse): String = {

try {
@@ -6,7 +6,7 @@ import org.fusesource.scalate.layout.DefaultLayoutStrategy
import skinny._
import javax.servlet.http.{ HttpServletResponse, HttpServletRequest }
import scala.annotation.tailrec
import java.io.PrintWriter
import java.io.{ StringWriter, PrintWriter }
import java.text.DecimalFormat

/**
@@ -29,8 +29,8 @@ import java.text.DecimalFormat
* And then, Skinny expects "src/main/webapp/WEB-INF/views/members/index.html.scaml"
*/
trait ScalateTemplateEngineFeature extends TemplateEngineFeature
with ScalateSupport
with ScalateUrlGeneratorSupport {
with ScalateSupport {
//with ScalateUrlGeneratorSupport {

/**
* To deal with exceptions.
@@ -64,14 +64,14 @@ trait ScalateTemplateEngineFeature extends TemplateEngineFeature
*/
override protected def createRenderContext(req: HttpServletRequest = request, resp: HttpServletResponse = response, out: PrintWriter = response.getWriter): RenderContext = {
val context = super.createRenderContext(req, resp, out)
context.numberFormat = numberFormat
context.numberFormat = scalateRenderContextNumberFormat
context
}

/**
* Creates a DecimalFormat instance to be use by default.
*/
def numberFormat: DecimalFormat = {
def scalateRenderContextNumberFormat: DecimalFormat = {
val df = new DecimalFormat
df.setGroupingUsed(false) // prevent commas from being inserted into numbers
df

0 comments on commit 1e44f60

Please sign in to comment.
You can’t perform that action at this time.