Re: [Catalyst] Access custom TT filters outside of catalyst context

2008-12-12 Thread Hugh Hunter
This doesn't exactly solve my problem, because I'm not in need of the
context object in my view, rather I'm trying to use my view where no context
object exists.

I solved my issue last night by factoring out my custom filters into a
separate module that I could use Template Toolkit proper (rather than the
catalyst view).

Thanks for the advice!

--Hugh

On Thu, Dec 11, 2008 at 6:23 PM, Kieren Diment dim...@gmail.com wrote:


 On 12/12/2008, at 10:04 AM, Hugh Hunter wrote:

  In an effort to create a sitemap, I want to iterate over all the objects
 in
 my database and construct urls (which I will write to a file) to view all
 of
 those objects.  Most of the URLs on my site are constructed using custom
 TT
 filters that I have written.

 My question is this:  how do I use these filters in an outside script
 where
 there is no catalyst context object?

 I regularly use models in outside scripts using the
 MyApp-model('Model::Class')-methodname syntax (rather than
 $c-model('Model::Class')-methodname).

 I'm not having much luck figuring out how to do this with my TT View.
 Anyone tackled this one before?


 Use either of these techniques in your TT View:

 http://www.catalystframework.org/calendar/2008/8


 ___
 List: Catalyst@lists.scsys.co.uk
 Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
 Searchable archive:
 http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
 Dev site: http://dev.catalyst.perl.org/

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Access custom TT filters outside of catalyst context

2008-12-11 Thread Hugh Hunter
In an effort to create a sitemap, I want to iterate over all the objects in
my database and construct urls (which I will write to a file) to view all of
those objects.  Most of the URLs on my site are constructed using custom TT
filters that I have written.

My question is this:  how do I use these filters in an outside script where
there is no catalyst context object?

I regularly use models in outside scripts using the
MyApp-model('Model::Class')-methodname syntax (rather than
$c-model('Model::Class')-methodname).

I'm not having much luck figuring out how to do this with my TT View.
Anyone tackled this one before?

--Hugh
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Passing UTF-8 arg in URL to DBIC search

2008-09-30 Thread Hugh Hunter
I thought about this (that passing the string in the path rather than as a
parameter would make a difference).  I've tried using a RewriteRule to turn
the path into a query parameter but I get the same behavior.  I feel like
the issue is with how perl is passing the string around inside my code
before it passes it to the database.

I'll keep poking.

--Hugh

On Sat, Sep 27, 2008 at 11:38 AM, Bill Moseley [EMAIL PROTECTED] wrote:

 On Sat, Sep 27, 2008 at 09:51:54AM -0400, Hugh Hunter wrote:
 
  I'm using URL arguments to pass parameters to my controller.  It's a
  site about names, so take the url 
  http://domain.com/name/Jesúshttp://domain.com/name/Jes%C3%BAs(note
  the accented u).  The Name.pm controller has an :Args(1) decorator so
  Jesús is stored in $name and then passed to my DBIC model in a -
  search({name = $name}) call.  This doesn't manage to find the row
  that exists in mysql.  When I dump $name I get:
 
 
  I've done everything recommended on
 
 http://dev.catalystframework.org/wiki/gettingstarted/tutorialsandhowtos/using_unicode
   and the name column in my mysql database uses the utf-8 charset.
  Where am I going wrong?

 The plugin does not decode the path, only the query parameters.[1]


 I'm not clear on passing utf8 on the path -- I thought you would have
 to url-encode it, but maybe the browser will do that. Although, I'm not
 clear how it knows what encoding to use.


 [1] also note that it doesn't decoded the body params, so if you
 access those via the body_parameters request method they won't be
 decoded.  Accessing them via -parameters is ok, though.

 --
 Bill Moseley
 [EMAIL PROTECTED]
 Sent from my iMutt


 ___
 List: Catalyst@lists.scsys.co.uk
 Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
 Searchable archive:
 http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
 Dev site: http://dev.catalyst.perl.org/

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Passing UTF-8 arg in URL to DBIC search

2008-09-27 Thread Hugh Hunter

Hello all,

I've been struggling with this for some time and know there must be an  
answer out there.


I'm using URL arguments to pass parameters to my controller.  It's a  
site about names, so take the url http://domain.com/name/Jesús (note  
the accented u).  The Name.pm controller has an :Args(1) decorator so  
Jesús is stored in $name and then passed to my DBIC model in a - 
search({name = $name}) call.  This doesn't manage to find the row  
that exists in mysql.  When I dump $name I get:


'name' = 'Jes\xc3\xbas'

which I think I understand as being perl's internal escaping of utf-8  
characters.


I've done everything recommended on http://dev.catalystframework.org/wiki/gettingstarted/tutorialsandhowtos/using_unicode 
 and the name column in my mysql database uses the utf-8 charset.


Where am I going wrong?

Best regards,

--Hugh
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/