How to use dateTimeConverter

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

How to use dateTimeConverter

Heiko Seeberger-4
Hi,

LiftRules.formatDate and .parseDate are deprecated and dateTimeConverter should be used now. Where can I find an explanation of example how to use it with different Locales?

Thanks,

Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Stambecco, highly scalable computing: stambecco.org

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to use dateTimeConverter

Naftoli Gugenheim
Right now there isn't any built-in support for different locales. It's a regular FactoryMaker, so you just have to provide different DateTimeConverter instances based on any factor you like. I'm not sure of the Lift API to get the locale though.


On Sun, Apr 11, 2010 at 9:56 AM, Heiko Seeberger <[hidden email]> wrote:
Hi,

LiftRules.formatDate and .parseDate are deprecated and dateTimeConverter should be used now. Where can I find an explanation of example how to use it with different Locales?

Thanks,

Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Stambecco, highly scalable computing: stambecco.org

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

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to use dateTimeConverter

Heiko Seeberger-4
On 11 April 2010 17:53, Naftoli Gugenheim <[hidden email]> wrote:
Right now there isn't any built-in support for different locales. It's a regular FactoryMaker, so you just have to provide different DateTimeConverter instances based on any factor you like. I'm not sure of the Lift API to get the locale though.

Thank you. I know how to handle the locale, but could you please provide me an example of how to use the FactoryMaker in order to set "my" DateTimeConverter?

Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Stambecco, highly scalable computing: stambecco.org

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to use dateTimeConverter

Timothy Perrett
yourfactorymaker.default.set(...)

Cheers, Tim

On 11 Apr 2010, at 17:15, Heiko Seeberger wrote:

On 11 April 2010 17:53, Naftoli Gugenheim <[hidden email]> wrote:
Right now there isn't any built-in support for different locales. It's a regular FactoryMaker, so you just have to provide different DateTimeConverter instances based on any factor you like. I'm not sure of the Lift API to get the locale though.

Thank you. I know how to handle the locale, but could you please provide me an example of how to use the FactoryMaker in order to set "my" DateTimeConverter?

Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Stambecco, highly scalable computing: stambecco.org

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

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to use dateTimeConverter

Dridus
For the global default as Tim says, though you need to create a closure to generate it --

LiftRules.dateTimeConverter.default.set(() => myDateTimeConverter)

You can also manufacture one on a per-session basis:

LiftRules.dateTimeConverter.session.set(() => S.session.map(s => makeMyDateTimeConverter(s)))

Or per-request in much the same way.

-Ross


On Apr 11, 2010, at 12:19 PM, Timothy Perrett wrote:

yourfactorymaker.default.set(...)

Cheers, Tim

On 11 Apr 2010, at 17:15, Heiko Seeberger wrote:

On 11 April 2010 17:53, Naftoli Gugenheim <[hidden email]> wrote:
Right now there isn't any built-in support for different locales. It's a regular FactoryMaker, so you just have to provide different DateTimeConverter instances based on any factor you like. I'm not sure of the Lift API to get the locale though.

Thank you. I know how to handle the locale, but could you please provide me an example of how to use the FactoryMaker in order to set "my" DateTimeConverter?

Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Stambecco, highly scalable computing: stambecco.org

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


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

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to use dateTimeConverter

Heiko Seeberger-4
On 12 April 2010 00:14, Ross Mellgren <[hidden email]> wrote:
For the global default as Tim says, though you need to create a closure to generate it --

LiftRules.dateTimeConverter.default.set(() => myDateTimeConverter)

You can also manufacture one on a per-session basis:

LiftRules.dateTimeConverter.session.set(() => S.session.map(s => makeMyDateTimeConverter(s)))

Per session?! That looks nice! Thanks.

=> We need a little documentation for this FactoryMaker thingy in the Wiki ...

Heiko

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Stambecco, highly scalable computing: stambecco.org

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to use dateTimeConverter

Marius Danciu
In reply to this post by Dridus


On Apr 12, 1:14 am, Ross Mellgren <[hidden email]> wrote:
> For the global default as Tim says, though you need to create a closure to generate it --
>
> LiftRules.dateTimeConverter.default.set(() => myDateTimeConverter)
>
> You can also manufacture one on a per-session basis:
>
> LiftRules.dateTimeConverter.session.set(() => S.session.map(s => makeMyDateTimeConverter(s)))
>
> Or per-request in much the same way.

From the API perspective per session and per request functions passed
to set should take a LiftSession respectively a Req as parameter. The
API scope IMO would have been much clearer. I know you can obtain the
session & req from S but the API for set is not very intuitive.

Just my 2 cents ...

Br's,
Marius

>
> -Ross
>
> On Apr 11, 2010, at 12:19 PM, Timothy Perrett wrote:
>
>
>
> > yourfactorymaker.default.set(...)
>
> > Cheers, Tim
>
> > On 11 Apr 2010, at 17:15, Heiko Seeberger wrote:
>
> >> On 11 April 2010 17:53, Naftoli Gugenheim <[hidden email]> wrote:
> >> Right now there isn't any built-in support for different locales. It's a regular FactoryMaker, so you just have to provide different DateTimeConverter instances based on any factor you like. I'm not sure of the Lift API to get the locale though.
>
> >> Thank you. I know how to handle the locale, but could you please provide me an example of how to use the FactoryMaker in order to set "my" DateTimeConverter?
>
> >> Heiko
>
> >> Company: weiglewilczek.com
> >> Blog: heikoseeberger.name
> >> Follow me: twitter.com/hseeberger
> >> OSGi on Scala: scalamodules.org
> >> Lift, the simply functional web framework: liftweb.net
> >> Stambecco, highly scalable computing: stambecco.org
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "Lift" group.
> >> To post to this group, send email to [hidden email].
> >> To unsubscribe from this group, send email to [hidden email].
> >> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups "Lift" group.
> > To post to this group, send email to [hidden email].
> > To unsubscribe from this group, send email to [hidden email].
> > For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Re: How to use dateTimeConverter

Dridus
Yeah. That'd probably require something like Maker1[T1, R] in addition to the Maker[R] type, to accommodate the function argument.

-Ross



On Apr 12, 2010, at 2:32 AM, Marius wrote:

>
>
> On Apr 12, 1:14 am, Ross Mellgren <[hidden email]> wrote:
>> For the global default as Tim says, though you need to create a closure to generate it --
>>
>> LiftRules.dateTimeConverter.default.set(() => myDateTimeConverter)
>>
>> You can also manufacture one on a per-session basis:
>>
>> LiftRules.dateTimeConverter.session.set(() => S.session.map(s => makeMyDateTimeConverter(s)))
>>
>> Or per-request in much the same way.
>
> From the API perspective per session and per request functions passed
> to set should take a LiftSession respectively a Req as parameter. The
> API scope IMO would have been much clearer. I know you can obtain the
> session & req from S but the API for set is not very intuitive.
>
> Just my 2 cents ...
>
> Br's,
> Marius
>>
>> -Ross
>>
>> On Apr 11, 2010, at 12:19 PM, Timothy Perrett wrote:
>>
>>
>>
>>> yourfactorymaker.default.set(...)
>>
>>> Cheers, Tim
>>
>>> On 11 Apr 2010, at 17:15, Heiko Seeberger wrote:
>>
>>>> On 11 April 2010 17:53, Naftoli Gugenheim <[hidden email]> wrote:
>>>> Right now there isn't any built-in support for different locales. It's a regular FactoryMaker, so you just have to provide different DateTimeConverter instances based on any factor you like. I'm not sure of the Lift API to get the locale though.
>>
>>>> Thank you. I know how to handle the locale, but could you please provide me an example of how to use the FactoryMaker in order to set "my" DateTimeConverter?
>>
>>>> Heiko
>>
>>>> Company: weiglewilczek.com
>>>> Blog: heikoseeberger.name
>>>> Follow me: twitter.com/hseeberger
>>>> OSGi on Scala: scalamodules.org
>>>> Lift, the simply functional web framework: liftweb.net
>>>> Stambecco, highly scalable computing: stambecco.org
>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups "Lift" group.
>>>> To post to this group, send email to [hidden email].
>>>> To unsubscribe from this group, send email to [hidden email].
>>>> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "Lift" group.
>>> To post to this group, send email to [hidden email].
>>> To unsubscribe from this group, send email to [hidden email].
>>> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to [hidden email].
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Re: How to use dateTimeConverter

Timothy Perrett
Hm  yeah, +1 Marius/Ross. Sounds like a good idea.

Cheers, Tim

On 12 Apr 2010, at 07:41, Ross Mellgren wrote:

> Yeah. That'd probably require something like Maker1[T1, R] in addition to the Maker[R] type, to accommodate the function argument.
>
> -Ross
>
>
>
> On Apr 12, 2010, at 2:32 AM, Marius wrote:
>
>>
>>
>> On Apr 12, 1:14 am, Ross Mellgren <[hidden email]> wrote:
>>> For the global default as Tim says, though you need to create a closure to generate it --
>>>
>>> LiftRules.dateTimeConverter.default.set(() => myDateTimeConverter)
>>>
>>> You can also manufacture one on a per-session basis:
>>>
>>> LiftRules.dateTimeConverter.session.set(() => S.session.map(s => makeMyDateTimeConverter(s)))
>>>
>>> Or per-request in much the same way.
>>
>> From the API perspective per session and per request functions passed
>> to set should take a LiftSession respectively a Req as parameter. The
>> API scope IMO would have been much clearer. I know you can obtain the
>> session & req from S but the API for set is not very intuitive.
>>
>> Just my 2 cents ...
>>
>> Br's,
>> Marius
>>>
>>> -Ross
>>>
>>> On Apr 11, 2010, at 12:19 PM, Timothy Perrett wrote:
>>>
>>>
>>>
>>>> yourfactorymaker.default.set(...)
>>>
>>>> Cheers, Tim
>>>
>>>> On 11 Apr 2010, at 17:15, Heiko Seeberger wrote:
>>>
>>>>> On 11 April 2010 17:53, Naftoli Gugenheim <[hidden email]> wrote:
>>>>> Right now there isn't any built-in support for different locales. It's a regular FactoryMaker, so you just have to provide different DateTimeConverter instances based on any factor you like. I'm not sure of the Lift API to get the locale though.
>>>
>>>>> Thank you. I know how to handle the locale, but could you please provide me an example of how to use the FactoryMaker in order to set "my" DateTimeConverter?
>>>
>>>>> Heiko
>>>
>>>>> Company: weiglewilczek.com
>>>>> Blog: heikoseeberger.name
>>>>> Follow me: twitter.com/hseeberger
>>>>> OSGi on Scala: scalamodules.org
>>>>> Lift, the simply functional web framework: liftweb.net
>>>>> Stambecco, highly scalable computing: stambecco.org
>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups "Lift" group.
>>>>> To post to this group, send email to [hidden email].
>>>>> To unsubscribe from this group, send email to [hidden email].
>>>>> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups "Lift" group.
>>>> To post to this group, send email to [hidden email].
>>>> To unsubscribe from this group, send email to [hidden email].
>>>> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Lift" group.
>> To post to this group, send email to [hidden email].
>> To unsubscribe from this group, send email to [hidden email].
>> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to [hidden email].
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>
>

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Re: How to use dateTimeConverter

Naftoli Gugenheim
In reply to this post by Heiko Seeberger-4
Don't session and request set the value *once* for the *current* session or request?
The regular set method takes a function, so if that function reads the session or request the value will be session- or request- *dependent*. I think the purpose of session and request is to set a different function temporarily.


-------------------------------------
Marius<[hidden email]> wrote:



On Apr 12, 1:14 am, Ross Mellgren <[hidden email]> wrote:
> For the global default as Tim says, though you need to create a closure to generate it --
>
> LiftRules.dateTimeConverter.default.set(() => myDateTimeConverter)
>
> You can also manufacture one on a per-session basis:
>
> LiftRules.dateTimeConverter.session.set(() => S.session.map(s => makeMyDateTimeConverter(s)))
>
> Or per-request in much the same way.

From the API perspective per session and per request functions passed
to set should take a LiftSession respectively a Req as parameter. The
API scope IMO would have been much clearer. I know you can obtain the
session & req from S but the API for set is not very intuitive.

Just my 2 cents ...

Br's,
Marius

>
> -Ross
>
> On Apr 11, 2010, at 12:19 PM, Timothy Perrett wrote:
>
>
>
> > yourfactorymaker.default.set(...)
>
> > Cheers, Tim
>
> > On 11 Apr 2010, at 17:15, Heiko Seeberger wrote:
>
> >> On 11 April 2010 17:53, Naftoli Gugenheim <[hidden email]> wrote:
> >> Right now there isn't any built-in support for different locales. It's a regular FactoryMaker, so you just have to provide different DateTimeConverter instances based on any factor you like. I'm not sure of the Lift API to get the locale though.
>
> >> Thank you. I know how to handle the locale, but could you please provide me an example of how to use the FactoryMaker in order to set "my" DateTimeConverter?
>
> >> Heiko
>
> >> Company: weiglewilczek.com
> >> Blog: heikoseeberger.name
> >> Follow me: twitter.com/hseeberger
> >> OSGi on Scala: scalamodules.org
> >> Lift, the simply functional web framework: liftweb.net
> >> Stambecco, highly scalable computing: stambecco.org
>
> >> --
> >> You received this message because you are subscribed to the Google Groups "Lift" group.
> >> To post to this group, send email to [hidden email].
> >> To unsubscribe from this group, send email to [hidden email].
> >> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups "Lift" group.
> > To post to this group, send email to [hidden email].
> > To unsubscribe from this group, send email to [hidden email].
> > For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.

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

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to use dateTimeConverter

Marius Danciu
That's besides the point I'm making.

Instead of

 LiftRules.dateTimeConverter.session.set(() => S.session.map(s =>
makeMyDateTimeConverter(s)))

we'd have

 LiftRules.dateTimeConverter.session.set((s) =>
makeMyDateTimeConverter(s))

So you'd have the session provided to you as opposed of fetching it
from S.

To me this is a distinct API design approach that is more appropriate.

But that's just me.

Br's,
Marius

On Apr 12, 3:13 pm, Naftoli Gugenheim <[hidden email]> wrote:

> Don't session and request set the value *once* for the *current* session or request?
> The regular set method takes a function, so if that function reads the session or request the value will be session- or request- *dependent*. I think the purpose of session and request is to set a different function temporarily.
>
> -------------------------------------
>
> Marius<[hidden email]> wrote:
>
> On Apr 12, 1:14 am, Ross Mellgren <[hidden email]> wrote:
>
> > For the global default as Tim says, though you need to create a closure to generate it --
>
> > LiftRules.dateTimeConverter.default.set(() => myDateTimeConverter)
>
> > You can also manufacture one on a per-session basis:
>
> > LiftRules.dateTimeConverter.session.set(() => S.session.map(s => makeMyDateTimeConverter(s)))
>
> > Or per-request in much the same way.
>
> From the API perspective per session and per request functions passed
> to set should take a LiftSession respectively a Req as parameter. The
> API scope IMO would have been much clearer. I know you can obtain the
> session & req from S but the API for set is not very intuitive.
>
> Just my 2 cents ...
>
> Br's,
> Marius
>
>
>
>
>
>
>
> > -Ross
>
> > On Apr 11, 2010, at 12:19 PM, Timothy Perrett wrote:
>
> > > yourfactorymaker.default.set(...)
>
> > > Cheers, Tim
>
> > > On 11 Apr 2010, at 17:15, Heiko Seeberger wrote:
>
> > >> On 11 April 2010 17:53, Naftoli Gugenheim <[hidden email]> wrote:
> > >> Right now there isn't any built-in support for different locales. It's a regular FactoryMaker, so you just have to provide different DateTimeConverter instances based on any factor you like. I'm not sure of the Lift API to get the locale though.
>
> > >> Thank you. I know how to handle the locale, but could you please provide me an example of how to use the FactoryMaker in order to set "my" DateTimeConverter?
>
> > >> Heiko
>
> > >> Company: weiglewilczek.com
> > >> Blog: heikoseeberger.name
> > >> Follow me: twitter.com/hseeberger
> > >> OSGi on Scala: scalamodules.org
> > >> Lift, the simply functional web framework: liftweb.net
> > >> Stambecco, highly scalable computing: stambecco.org
>
> > >> --
> > >> You received this message because you are subscribed to the Google Groups "Lift" group.
> > >> To post to this group, send email to [hidden email].
> > >> To unsubscribe from this group, send email to [hidden email].
> > >> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups "Lift" group.
> > > To post to this group, send email to [hidden email].
> > > To unsubscribe from this group, send email to [hidden email].
> > > For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to [hidden email].
> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.

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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Re: How to use dateTimeConverter

Naftoli Gugenheim
Ah, I got it.
Is it possible to have both? Or are you saying you'd prefer it changed?
Also, what if there is no session? Would s be a Box?

On Mon, Apr 12, 2010 at 11:37 AM, Marius <[hidden email]> wrote:
That's besides the point I'm making.

Instead of

 LiftRules.dateTimeConverter.session.set(() => S.session.map(s =>
makeMyDateTimeConverter(s)))

we'd have

 LiftRules.dateTimeConverter.session.set((s) =>
makeMyDateTimeConverter(s))

So you'd have the session provided to you as opposed of fetching it
from S.

To me this is a distinct API design approach that is more appropriate.

But that's just me.

Br's,
Marius

On Apr 12, 3:13 pm, Naftoli Gugenheim <[hidden email]> wrote:
> Don't session and request set the value *once* for the *current* session or request?
> The regular set method takes a function, so if that function reads the session or request the value will be session- or request- *dependent*. I think the purpose of session and request is to set a different function temporarily.
>
> -------------------------------------
>
> Marius<[hidden email]> wrote:
>
> On Apr 12, 1:14 am, Ross Mellgren <[hidden email]> wrote:
>
> > For the global default as Tim says, though you need to create a closure to generate it --
>
> > LiftRules.dateTimeConverter.default.set(() => myDateTimeConverter)
>
> > You can also manufacture one on a per-session basis:
>
> > LiftRules.dateTimeConverter.session.set(() => S.session.map(s => makeMyDateTimeConverter(s)))
>
> > Or per-request in much the same way.
>
> From the API perspective per session and per request functions passed
> to set should take a LiftSession respectively a Req as parameter. The
> API scope IMO would have been much clearer. I know you can obtain the
> session & req from S but the API for set is not very intuitive.
>
> Just my 2 cents ...
>
> Br's,
> Marius
>
>
>
>
>
>
>
> > -Ross
>
> > On Apr 11, 2010, at 12:19 PM, Timothy Perrett wrote:
>
> > > yourfactorymaker.default.set(...)
>
> > > Cheers, Tim
>
> > > On 11 Apr 2010, at 17:15, Heiko Seeberger wrote:
>
> > >> On 11 April 2010 17:53, Naftoli Gugenheim <[hidden email]> wrote:
> > >> Right now there isn't any built-in support for different locales. It's a regular FactoryMaker, so you just have to provide different DateTimeConverter instances based on any factor you like. I'm not sure of the Lift API to get the locale though.
>
> > >> Thank you. I know how to handle the locale, but could you please provide me an example of how to use the FactoryMaker in order to set "my" DateTimeConverter?
>
> > >> Heiko
>
> > >> Company: weiglewilczek.com
> > >> Blog: heikoseeberger.name
> > >> Follow me: twitter.com/hseeberger
> > >> OSGi on Scala: scalamodules.org
> > >> Lift, the simply functional web framework: liftweb.net
> > >> Stambecco, highly scalable computing: stambecco.org
>
> > >> --
> > >> You received this message because you are subscribed to the Google Groups "Lift" group.
> > >> To post to this group, send email to [hidden email].
> > >> To unsubscribe from this group, send email to [hidden email].
> > >> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups "Lift" group.
> > > To post to this group, send email to [hidden email].
> > > To unsubscribe from this group, send email to [hidden email].
> > > For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to [hidden email].
> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.

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


--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Re: How to use dateTimeConverter

Heiko Seeberger-4
Folks,

You surely follow the other thread? The one where I would like to get rid of the FactoryMaker thing? This would make this discussion obsolete ...

Heiko

On 12 April 2010 18:28, Naftoli Gugenheim <[hidden email]> wrote:
Ah, I got it.
Is it possible to have both? Or are you saying you'd prefer it changed?
Also, what if there is no session? Would s be a Box?


On Mon, Apr 12, 2010 at 11:37 AM, Marius <[hidden email]> wrote:
That's besides the point I'm making.

Instead of

 LiftRules.dateTimeConverter.session.set(() => S.session.map(s =>
makeMyDateTimeConverter(s)))

we'd have

 LiftRules.dateTimeConverter.session.set((s) =>
makeMyDateTimeConverter(s))

So you'd have the session provided to you as opposed of fetching it
from S.

To me this is a distinct API design approach that is more appropriate.

But that's just me.

Br's,
Marius

On Apr 12, 3:13 pm, Naftoli Gugenheim <[hidden email]> wrote:
> Don't session and request set the value *once* for the *current* session or request?
> The regular set method takes a function, so if that function reads the session or request the value will be session- or request- *dependent*. I think the purpose of session and request is to set a different function temporarily.
>
> -------------------------------------
>
> Marius<[hidden email]> wrote:
>
> On Apr 12, 1:14 am, Ross Mellgren <[hidden email]> wrote:
>
> > For the global default as Tim says, though you need to create a closure to generate it --
>
> > LiftRules.dateTimeConverter.default.set(() => myDateTimeConverter)
>
> > You can also manufacture one on a per-session basis:
>
> > LiftRules.dateTimeConverter.session.set(() => S.session.map(s => makeMyDateTimeConverter(s)))
>
> > Or per-request in much the same way.
>
> From the API perspective per session and per request functions passed
> to set should take a LiftSession respectively a Req as parameter. The
> API scope IMO would have been much clearer. I know you can obtain the
> session & req from S but the API for set is not very intuitive.
>
> Just my 2 cents ...
>
> Br's,
> Marius
>
>
>
>
>
>
>
> > -Ross
>
> > On Apr 11, 2010, at 12:19 PM, Timothy Perrett wrote:
>
> > > yourfactorymaker.default.set(...)
>
> > > Cheers, Tim
>
> > > On 11 Apr 2010, at 17:15, Heiko Seeberger wrote:
>
> > >> On 11 April 2010 17:53, Naftoli Gugenheim <[hidden email]> wrote:
> > >> Right now there isn't any built-in support for different locales. It's a regular FactoryMaker, so you just have to provide different DateTimeConverter instances based on any factor you like. I'm not sure of the Lift API to get the locale though.
>
> > >> Thank you. I know how to handle the locale, but could you please provide me an example of how to use the FactoryMaker in order to set "my" DateTimeConverter?
>
> > >> Heiko
>
> > >> Company: weiglewilczek.com
> > >> Blog: heikoseeberger.name
> > >> Follow me: twitter.com/hseeberger
> > >> OSGi on Scala: scalamodules.org
> > >> Lift, the simply functional web framework: liftweb.net
> > >> Stambecco, highly scalable computing: stambecco.org
>
> > >> --
> > >> You received this message because you are subscribed to the Google Groups "Lift" group.
> > >> To post to this group, send email to [hidden email].
> > >> To unsubscribe from this group, send email to [hidden email].
> > >> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups "Lift" group.
> > > To post to this group, send email to [hidden email].
> > > To unsubscribe from this group, send email to [hidden email].
> > > For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to [hidden email].
> To unsubscribe from this group, send email to [hidden email].
> For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.

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


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



--
Heiko Seeberger

Company: weiglewilczek.com
Blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net
Stambecco, highly scalable computing: stambecco.org

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