Using a filter to commit changes to Magma

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Using a filter to commit changes to Magma

nicolas.oury@gmail.com
Dear all,

I am trying to write my first serious seaside application, and I am trying to wrap all requests to the application into a 
Magma transaction. (As a first simple scheme)

I have written a new class MagmaFilter, subclassing WARequestFilter, with a request handler that wraps the request into a commit, just after a refresh.
(I will figure out how to handle conflicts later)

I would like to install this filter into my application, but it is not shown as a possible Filter in the configuration panel.

Should I do something special in order to make it appear?
Is there a way of adding it programmatically?

Thank you very much for your help,
Best regards,

Nicolas.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Using a filter to commit changes to Magma

sebastianconcept@gmail.co
I've done something similar but not for magma

to do it (programmatically) I've done this:

hack this:

WASession>>forContext: aRequestContext

^ self new initializeForContext: aRequestContext 

so you then can do this:

YourSession>>initializeForContext: aRequestContext

| database |

super initializeForContext: aRequestContext.  "<-- if needed"

database := self databaseForContext: aRequestContext.

database exists
ifTrue:[self addFilter: (FLTransactionFilter onDatabase: database)]
ifFalse:[self onUnrecognizableDatabaseFor: aRequestContext]






On Jan 30, 2011, at 2:47 PM, [hidden email] wrote:

Dear all,

I am trying to write my first serious seaside application, and I am trying to wrap all requests to the application into a 
Magma transaction. (As a first simple scheme)

I have written a new class MagmaFilter, subclassing WARequestFilter, with a request handler that wraps the request into a commit, just after a refresh.
(I will figure out how to handle conflicts later)

I would like to install this filter into my application, but it is not shown as a possible Filter in the configuration panel.

Should I do something special in order to make it appear?
Is there a way of adding it programmatically?

Thank you very much for your help,
Best regards,

Nicolas.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Using a filter to commit changes to Magma

nicolas.oury@gmail.com
Thank you so much for your answer.

For something less sophisticated in term of error handling, would something like:

MySession>> initialize
super initialize.
self addFilter: (MagmaFilter new).

work?


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Using a filter to commit changes to Magma

Philippe Marschall
In reply to this post by nicolas.oury@gmail.com
2011/1/30 [hidden email] <[hidden email]>:

> Dear all,
> I am trying to write my first serious seaside application, and I am trying
> to wrap all requests to the application into a
> Magma transaction. (As a first simple scheme)
> I have written a new class MagmaFilter, subclassing WARequestFilter, with a
> request handler that wraps the request into a commit, just after a refresh.
> (I will figure out how to handle conflicts later)
> I would like to install this filter into my application, but it is not shown
> as a possible Filter in the configuration panel.
> Should I do something special in order to make it appear?

Subclass WAConfiguredRequestFilter instead.

> Is there a way of adding it programmatically?

anApplication addFilter: yourFilter

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Using a filter to commit changes to Magma

sebastianconcept@gmail.co
In reply to this post by nicolas.oury@gmail.com
yeah, why not?

I did that so:
1. I can discern dynamically which database the app should work with taking the request in mind (in airflowing I use the subdomain)
2. redirect it defensively if the requested thing is weird (think of a typo in the url or something) and
3. if things are right the filter is working for that database before the app tries to get anything done

a big secondary gain of 3 is that you code focusing on one account/database but the app is scalable to attend N



On Jan 30, 2011, at 3:14 PM, [hidden email] wrote:

Thank you so much for your answer.

For something less sophisticated in term of error handling, would something like:

MySession>> initialize
super initialize.
self addFilter: (MagmaFilter new).

work?

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside