Changeset 3909

Show
Ignore:
Timestamp:
06/26/08 16:47:17 (5 months ago)
Author:
osimons
Message:

FullBlogPlugin: Support for query arguments to pre-populate fields when doing a GET on `/blog/create (like a regular link).

Name of post can either be an argument or part of the path - these examples have identical result:

  • /blog/create/my-new-post?author=simon&categories=trac+plugin
  • /blog/create?name=my-new-post&author=simon&categories=trac+plugin

Closes #3083.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fullblogplugin/0.11/tracfullblog/web_ui.py

    r3906 r3909  
    193193            warnings = [] 
    194194 
     195            if command == 'create' and req.method == 'GET' and not the_post.version: 
     196                # Support appending query arguments for populating intial fields 
     197                the_post.update_fields(req.args) 
    195198            if command == 'create' and the_post.version: 
     199                # Post with name or suggested name already exists 
    196200                if 'BLOG_CREATE' in req.perm and the_post.name == default_pagename \ 
    197201                                    and not req.method == 'POST': 
     
    206210            if command == 'edit': 
    207211                req.perm(the_post.resource).require('BLOG_VIEW') # Starting point 
    208             if req.method == 'POST':   # Create or edit a blog post 
     212            if req.method == 'POST': 
     213                # Create or edit a blog post 
    209214                if 'blog-cancel' in req.args: 
    210215                    if req.args.get('action','') == 'edit':