[web] Disable 'concat-resources' by default (closes #3670503)
It makes debugging harder and it can actually *break* working JS or CSS files.
This is the first step towards complete removal.
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>."""WSGI request adapter for cubicwebNOTE: each docstring tagged with ``COME FROM DJANGO`` means thatthe code has been taken (or adapted) from Djanco source code : http://www.djangoproject.com/"""__docformat__="restructuredtext en"fromStringIOimportStringIOfromurllibimportquotefromlogilab.common.decoratorsimportcachedfromcubicweb.web.requestimportCubicWebRequestBasefromcubicweb.wsgiimport(pformat,qs2dict,safe_copyfileobj,parse_file_upload,normalize_header)fromcubicweb.web.http_headersimportHeadersclassCubicWebWsgiRequest(CubicWebRequestBase):"""most of this code COMES FROM DJANGO """def__init__(self,environ,vreg):self.environ=environself.path=environ['PATH_INFO']self.method=environ['REQUEST_METHOD'].upper()self.content=environ['wsgi.input']headers_in=dict((normalize_header(k[5:]),v)fork,vinself.environ.items()ifk.startswith('HTTP_'))https=environ.get("HTTPS")in('yes','on','1')post,files=self.get_posted_data()super(CubicWebWsgiRequest,self).__init__(vreg,https,post,headers=headers_in)iffilesisnotNone:forkey,(name,_,stream)infiles.iteritems():ifnameisnotNone:name=unicode(name,self.encoding)self.form[key]=(name,stream)def__repr__(self):# Since this is called as part of error handling, we need to be very# robust against potentially malformed input.form=pformat(self.form)meta=pformat(self.environ)return'<CubicWebWsgiRequest\FORM:%s,\nMETA:%s>'% \(form,meta)## cubicweb request interface ################################################defhttp_method(self):"""returns 'POST', 'GET', 'HEAD', etc."""returnself.methoddefrelative_path(self,includeparams=True):"""return the normalized path of the request (ie at least relative to the instance's root, but some other normalization may be needed so that the returned path may be used to compare to generated urls :param includeparams: boolean indicating if GET form parameters should be kept in the path """path=self.environ['PATH_INFO']path=path[1:]# remove leading '/'ifincludeparams:qs=self.environ.get('QUERY_STRING')ifqs:return'%s?%s'%(path,qs)returnpath## wsgi request helpers ###################################################definstance_uri(self):"""Return the instance's base URI (no PATH_INFO or QUERY_STRING) see python2.5's wsgiref.util.instance_uri code """environ=self.environurl=environ['wsgi.url_scheme']+'://'ifenviron.get('HTTP_HOST'):url+=environ['HTTP_HOST']else:url+=environ['SERVER_NAME']ifenviron['wsgi.url_scheme']=='https':ifenviron['SERVER_PORT']!='443':url+=':'+environ['SERVER_PORT']else:ifenviron['SERVER_PORT']!='80':url+=':'+environ['SERVER_PORT']url+=quote(environ.get('SCRIPT_NAME')or'/')returnurldefget_full_path(self):return'%s%s'%(self.path,self.environ.get('QUERY_STRING','')and('?'+self.environ.get('QUERY_STRING',''))or'')defis_secure(self):return'wsgi.url_scheme'inself.environ \andself.environ['wsgi.url_scheme']=='https'defget_posted_data(self):# The WSGI spec says 'QUERY_STRING' may be absent.post=qs2dict(self.environ.get('QUERY_STRING',''))files=Noneifself.method=='POST':ifself.environ.get('CONTENT_TYPE','').startswith('multipart'):header_dict=dict((normalize_header(k[5:]),v)fork,vinself.environ.items()ifk.startswith('HTTP_'))header_dict['Content-Type']=self.environ.get('CONTENT_TYPE','')post_,files=parse_file_upload(header_dict,self.raw_post_data)post.update(post_)else:post.update(qs2dict(self.raw_post_data))returnpost,files@property@cacheddefraw_post_data(self):buf=StringIO()try:# CONTENT_LENGTH might be absent if POST doesn't have content at all (lighttpd)content_length=int(self.environ.get('CONTENT_LENGTH',0))exceptValueError:# if CONTENT_LENGTH was empty string or not an integercontent_length=0ifcontent_length>0:safe_copyfileobj(self.environ['wsgi.input'],buf,size=content_length)postdata=buf.getvalue()buf.close()returnpostdata