Ñò ˆ_‚Jc@s°dZddklZddkZddkZddkZddklZd„Zd„Zd„Z d„Z d „Z d e fd „ƒYZ d „Zd efd„ƒYZdS(t Utilitiesiÿÿÿÿ(tconfigN(tresource_filenamecCsNxGtidƒD]6}|iƒidƒotii||ƒ}|SqWdS(Ns./segg-info(tostlistdirtlowertendswithtpathtjoin(tnametdirnametfname((s+/usr/lib/python2.6/site-packages/tg/util.pytget_project_metas cCs?tdƒ}|o(tt|ƒƒddd!}|iƒSdS(sget project name if existsPKG-INFOiiiÿÿÿÿN(R tlisttopentstrip(tpkg_infoR ((s+/usr/lib/python2.6/site-packages/tg/util.pytget_project_name s cCsÊtidƒ}|o|Sdtijo?titiidƒd}ti|ƒ}|idƒ}n'tdƒ}|o t |ƒpg}x3|D]+}|i ƒ}|o|djo|Sq—WdS(s:Try to find out the package name of the current directory.tmoduless--eggis top_level.txttlocalesN( Rtgettsystargvtindext pkg_resourcestget_distributiont _get_metadataR Rtrstrip(tpackaget projectnameteggt top_levelR ((s+/usr/lib/python2.6/site-packages/tg/util.pytget_package_names  cCsItƒ}|pdSt|hhdgƒ}t|dƒo|iSdS(s return modeltmodelN(R tNonet __import__thasattrR!(t package_nameR((s+/usr/lib/python2.6/site-packages/tg/util.pyt get_model's  cCst|d}tg}|iƒD]4}|i|ƒo||i|ƒ||fqq~ƒ}|o|St‚dS(sGiven a dictionary and a prefix, return a Bunch, with just items that start with prefix The returned dictionary will have 'prefix.' stripped so: get_partial_dict('prefix', {'prefix.xyz':1, 'prefix.zyx':2, 'xy':3}) would return: {'xyz':1,'zyx':2} t.N(tBunchtiterkeyst startswithtlstriptAttributeError(tprefixt dictionarytmatcht_[1]tkeytnew_dict((s+/usr/lib/python2.6/site-packages/tg/util.pytget_partial_dict3s  :R(cBs2eZdZd„Zd„ZeiZd„ZRS(s2A dictionary that provides attribute-style access.cCsti||ƒS(N(tdictt __getitem__(tselfR1((s+/usr/lib/python2.6/site-packages/tg/util.pyR5MscCs0y ||SWntj ot||ƒSXdS(N(tKeyErrorR3(R6R ((s+/usr/lib/python2.6/site-packages/tg/util.pyt __getattr__Ps cCs1y ||=Wntj ot|ƒ‚nXdS(N(R7R,(R6R ((s+/usr/lib/python2.6/site-packages/tg/util.pyt __delattr__Xs ( t__name__t __module__t__doc__R5R8R4t __setitem__t __setattr__R9(((s+/usr/lib/python2.6/site-packages/tg/util.pyR(Js    cs-|d‰|d‰‡‡‡fd†}|S(Niics0ˆ|}ˆiƒ}|i|ƒˆ||ŽS(N(tcopytupdate(tcall_time_argstcall_time_kwdstargstkwds(tcreate_time_argstfunctcreate_time_kwds(s+/usr/lib/python2.6/site-packages/tg/util.pytcurried_functionbs   ((RCRGRH((RGRERFs+/usr/lib/python2.6/site-packages/tg/util.pytpartial_s  tDottedFileNameFindercBs#eZdZd„Zdd„ZRS(suthis class implements a cache system above the get_dotted_filename function and is designed to be stuffed inside the app_globals. It exposes a method named get_dotted_filename with the exact same signature as the function of the same name in this module. The reason is that is uses this function itself and just adds caching mechanism on top. cCstƒ|_dS(N(R4t_DottedFileNameFinder__cache(R6((s+/usr/lib/python2.6/site-packages/tg/util.pyt__init__tss.htmlcCsˆy|i|SWnrtj of|idƒ}|djo/|| }||d|}t||ƒ}n|}||i|<|SXdS(sathis helper function is designed to search a template or any other file by python module name. Given a string containing the file/template name passed to the @expose decorator we will return a resource useable as a filename even if the file is in fact inside a zipped egg. The actual implementation is a revamp of the Genshi buffet support plugin, but could be used with any kind a file inside a python package. @param template_name: the string representation of the template name as it has been given by the user on his @expose decorator. Basically this will be a string in the form of: "genshi:myapp.templates.somename" @type template_name: string @param template_extension: the extension we excpect the template to have, this MUST be the full extension as returned by the os.path.splitext function. This means it should contain the dot. ie: '.html' This argument is optional and the default value if nothing is provided will be '.html' @type template_extension: string R'iiN(RKR7trfindR(R6t template_namettemplate_extensiontdividerRtbasenametresult((s+/usr/lib/python2.6/site-packages/tg/util.pytget_dotted_filenamews   (R:R;R<RLRS(((s+/usr/lib/python2.6/site-packages/tg/util.pyRJis  (R<tpylonsRRRRRR RR R&R3R4R(RItobjectRJ(((s+/usr/lib/python2.6/site-packages/tg/util.pyts