I had to slog through some factory maker stuff recently. What I found
out was that it was amazingly flexible, but that made the simple case
non-obvious. For the simple case (set site-wide), the way I found to
to do it was
factory.default(() => defaultValue)
e.g.
LiftRules.stripComments.default(() => () => false)
The other complication has to do with the fact that you can have
scoped values for this, values computed based on current state and so
on (if I read all the code correctly), e.g.
LiftRules.stripComments.request(computeStripCommentsPerRequest)
Personally, I agree it's confusing and it'd be nice if it were
consistently used or not.
-Ross
On Oct 28, 2009, at 11:23 AM, Timothy Perrett wrote:
>
> Perhaps David can shed more light on it... I didn't write the strip
> comments stuff nor the FactoryMaker stuff and David has yet to detail
> how that stuff actually works or when it should be used. To that end,
> I can see the issue here and don't disagree.
>
> Cheers, Tim
>
> On 28 Oct 2009, at 15:20, Yousry Abdallah wrote:
>
>>
>> I downloaded the library source yesterday and stumbled on the
>> (abstract) factory pattern in the LiftRules Class.
>>
>> Do you think this is the desired way to change a parameter?
>>
>> Sometimes you use simple assignment:
>>
>> LiftRules.useXhtmlMimeType = false
>>
>> or you apply a value:
>>
>> LiftRules.setSiteMap(...)
>>
>> and now you do:
>>
>> LiftRules.stripComments(false){}
>>
>> Could this be simplified?
>>
>> I think this is confusing and time-consuming at the moment to work
>> with LiftRules.
>>
>> On 28 Okt., 15:00, Timothy Perrett <[email protected]> wrote:
>>> Looking at the definition:
>>>
>>> val stripComments: FactoryMaker[() => Boolean] =
>>> new FactoryMaker(() => {() => {
>>> if (Props.devMode)
>>> false
>>> else true
>>> }}) {}
>>>
>>> try doing:
>>>
>>> LiftRules.stripComments(false){}
>>>
>>> Cheers, Tim
>>>
>>> On 28 Oct 2009, at 13:22, Yousry Abdallah wrote:
>>>
>>>
>>>
>>>> LiftRules.stripComments(false)
>>>
>>>> generates following error message:
>>>
>>>> Boot.scala:61: error: wrong number of arguments for method apply:
>>>> ()()
>>>> => Boolean in trait Vendor
>>>> LiftRules.stripComments(false)
>>>
>>>> On 27 Okt., 16:52, David Pollak <[email protected]>
>>>> wrote:
>>>>> Please see LiftRules.stripComments.
>>>
>>>>> You can do LiftRules.stripComments(false)
>>>
>>>>> On Tue, Oct 27, 2009 at 8:18 AM, Yousry Abdallah
>>>>> <[email protected]> wrote:
>>>
>>>>>> Hi,
>>>>>> at the moment I'm testing my application against 1.1 snapshot
>>>>>> and I
>>>>>> noticed that while running lift in production mode: "-
>>>>>> Drun.mode=production" aside from blueprints IE6 fallback:
>>>
>>>>>> " <!--[if IE]><link rel="stylesheet" href="/classpath/blueprint/
>>>>>> ie.css" type="text/css" media="screen, projection"><![endif]-->"
>>>
>>>>>> all other comments are removed from the html output.
>>>
>>>>>> I'm using adsense and it is essential to pass "key parameters"
>>>>>> via
>>>>>> comments.
>>>
>>>>>> Did I miss some options/parameters to deactivate this new
>>>>>> feature?
>>>
>>>>> --
>>>>> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---