Changeset 1440
- Timestamp:
- 02/22/08 15:02:26 (8 months ago)
- Location:
- trunk/pylucid/PyLucid
- Files:
-
- 4 modified
-
index.py (modified) (5 diffs)
-
plugins_internal/auth/auth.py (modified) (1 diff)
-
system/context_processors.py (modified) (3 diffs)
-
system/plugin_manager.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pylucid/PyLucid/index.py
r1429 r1440 45 45 46 46 47 def _render_cms_page( context, page_content=None):47 def _render_cms_page(request, context, page_content=None): 48 48 """ 49 49 render the cms page. … … 51 51 - render a _command request: The page.content is the output from the plugin. 52 52 """ 53 if request.anonymous_view == False: 54 # context["robots"] was set in contex_processors.static() 55 # Hide the response from search engines 56 context["robots"] = "NONE,NOARCHIVE" 57 53 58 current_page = context["PAGE"] 54 59 … … 92 97 For index() and handle_command() views. 93 98 """ 99 # add additional attribute 100 request.anonymous_view = True 101 94 102 try: 95 103 context = RequestContext(request) … … 227 235 context = _get_context(request, current_page_obj) 228 236 # Get the response for the requested cms page: 229 response = _render_cms_page( context)237 response = _render_cms_page(request, context) 230 238 231 239 if use_cache: … … 317 325 ) 318 326 319 return _render_cms_page( context, page_content)327 return _render_cms_page(request, context, page_content) 320 328 321 329 -
trunk/pylucid/PyLucid/plugins_internal/auth/auth.py
r1439 r1440 166 166 "Warning: DEBUG is ON! Should realy only use for debugging!" 167 167 ) 168 169 # This view is available for anonymous users. Only a anonymous user 170 # must login ;) 171 # But the html line <meta name="robots" content="{{ robots }}" /> 172 # should be set to "NONE,NOARCHIVE" 173 self.request.anonymous_view = False 168 174 169 175 UsernameForm = forms.form_for_model(User, fields=("username",)) -
trunk/pylucid/PyLucid/system/context_processors.py
r1435 r1440 17 17 http://www.djangoproject.com/documentation/templates_python/#writing-your-own-context-processors 18 18 """ 19 context_extras = {} 20 21 #___________________________________________________________________________ 22 23 context_extras['powered_by'] = mark_safe( 24 '<a href="http://www.pylucid.org">PyLucid v%s</a>' \ 19 return { 20 "powered_by": mark_safe( 21 '<a href="http://www.pylucid.org">PyLucid v%s</a>' \ 25 22 % PYLUCID_VERSION_STRING 26 ) 27 28 #___________________________________________________________________________ 29 30 # The module_manager set "must_login": 31 if getattr(request, "must_login", False): 32 context_extras["robots"] = "NONE,NOARCHIVE" 33 else: 34 context_extras["robots"] = "index,follow" 35 36 #___________________________________________________________________________ 37 38 return context_extras 39 23 ), 24 # This value would be changed in index._render_cms_page(), if the 25 # plugin manager or any plugin set request.anonymous_view = False 26 "robots": "index,follow", 27 } 40 28 41 29 … … 53 41 txt = "%s [%s]" % (_("Log out"), request.user.username) 54 42 else: 55 url = URLs.commandLink("auth", "login/?next=%s" % request.path) 43 # url = URLs.commandLink("auth", "login/?next=%s" % request.path) 44 url = URLs.commandLink("auth", "login") 56 45 txt = _("Log in") 57 46 58 context["login_link"] = mark_safe( 59 '<a href="%s">%s</a>' % (url, txt) 60 ) 61 47 context["login_link"] = mark_safe('<a href="%s">%s</a>' % (url, txt)) 48 62 49 # Put the language information into the context, if it exists. 63 50 # see: http://www.djangoproject.com/documentation/i18n/ … … 66 53 else: 67 54 context['django_language']='' 68 69 55 70 56 -
trunk/pylucid/PyLucid/system/plugin_manager.py
r1416 r1440 131 131 # User must be login to use this method 132 132 # http://www.djangoproject.com/documentation/authentication/ 133 134 request.must_login = True # For static_tags an the robot tag135 136 133 if request.user.is_anonymous(): 137 134 # User is not logged in … … 148 145 raise AccessDenied 149 146 147 # set if the current request was viewable for anonymous user 148 # interesting for: <meta name="robots" content="{{ robots }}" /> 149 if request.anonymous_view == True: 150 # Only change anonymous_view, if it not set to False in the past. 151 if method_cfg["must_login"] or method_cfg["must_admin"]: 152 request.anonymous_view = False 153 150 154 URLs = context["URLs"] 151 155 URLs.current_plugin = plugin_name … … 193 197 """ 194 198 output = run(context, response, plugin_name, method_name, url_args) 199 195 200 return output 196 201
