• Get Review Board
  • What's New
  • Products
  • Review Board Code review, image review, and document review
  • Documentation
  • Release Notes
  • Power Pack Enterprise integrations, reports, and enhanced document review
  • Try for 60 Days
  • Purchase
  • RBCommons Review Board as a Service, hosted by us
  • Pricing
  • RBTools Command line tools and Python API for Review Board
  • Documentation
  • Release Notes
  • Review Bot Automated code review, connecting tools you already use
  • Documentation
  • Release Notes
  • RB Gateway Manage Git and Mercurial repositories in your network
  • Documentation
  • Release Notes
  • Learn and Explore
  • What is Code Review?
  • Documentation
  • Frequently Asked Questions
  • Support Options
  • Third-Party Integrations
  • Demo
  • Review Board RBTools Power Pack Review Bot Djblets RB Gateway
    1. Review Board 5.0
    2. Version 7.x
    3. Version 6.x
    4. Version 5.0
    5. Version 4.0
    6. Version 3.0
    7. Version 2.5
    8. Version 2.0
    9. Version 1.7
    10. Version 1.6
    11. Version 1.5
    12. Version 1.0
    13. Extending Review Board
    14. Module and Class References
    15. reviewboard.extensions.hooks
  • Home
  • Users Guide
  • Getting Started
  • Introduction
  • What is Code Review?
  • Review Board Workflows
  • Account Settings
  • Dashboard
  • Working with Review Requests
  • Overview
  • Creating Review Requests
  • Editing Fields
  • Uploading Diffs
  • Uploading File Attachments
  • Publishing Review Requests
  • Closing Review Requests
  • Reviewing
  • Reviews and Comments
  • Review Draft Banner
  • Issue Tracking
  • Reviewing Code (Diffs)
  • Reviewing File Attachments
  • Reviewing Images
  • Reviewing Markdown Files
  • Reviewing Text Files
  • Creating and Editing Reviews
  • Publishing Reviews
  • Approving Changes (Ship It!)
  • Replying to Comments
  • Automated Code Reviews
  • Searching
  • Quick Search
  • Full-Text Search
  • Using Markdown
  • Administration Guide
  • Installation
  • Installing on Linux
  • Installing on Mac OS X Server
  • Installing on Windows
  • Installing with Docker
  • Installing Development Releases
  • Creating a Review Board Site
  • Upgrading
  • Upgrading Review Board
  • Upgrading Review Board Sites
  • Optimization
  • Optimizing and Scaling Review Board
  • Administration UI
  • Overview of the Administration UI
  • Administrator Dashboard
  • Database Management
  • Configuration
  • Site Settings
  • General Settings
  • Authentication Settings
  • Avatar Services Settings
  • E-Mail Settings
  • Diff Viewer Settings
  • Logging Settings
  • SSH Settings
  • File Storage Settings
  • User Privacy Settings
  • Search Settings
  • Access Control
  • Working with E-Mail
  • Default Reviewers
  • Permission Groups
  • Repositories
  • Bazaar Repositories
  • CVS Repositories
  • Git Repositories
  • HCL VersionVault and IBM ClearCase
  • Mercurial Repositories
  • Perforce Repositories
  • Subversion Repositories
  • Assembla Repositories
  • AWS CodeCommit Repositories
  • Beanstalk Repositories
  • Bitbucket Repositories
  • Bitbucket Server Repositories
  • Codebase HQ Repositories
  • Fedora Hosted Repositories
  • Gerrit Repositories
  • GitHub Repositories
  • GitHub Enterprise Repositories
  • GitLab Repositories
  • Gitorious Repositories
  • Cliosoft SOS Repositories
  • SourceForge Repositories
  • Unfuddle STACK Repositories
  • VisualStudio.com Repositories
  • Review Groups
  • Users
  • WebHooks
  • Extensions
  • Integrations
  • Asana Integration
  • CircleCI Integration
  • Discord Integration
  • I Done This Integration
  • Jenkins CI Integration
  • Matrix Integration
  • Mattermost Integration
  • Slack Integration
  • Travis CI Integration
  • Trello Integration
  • Site Maintenance
  • The rb-site Tool
  • Advanced Management Commands
  • Web API Guide
  • Resource Tree
  • Resources
  • Root List Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Extension List Resource
  • Extension Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Info Resource
  • Repository User List Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Request List Resource
  • Review Request Resource
  • Change List Resource
  • Diff Context Resource
  • Diff List Resource
  • File Attachment List Resource
  • Review List Resource
  • Review Request Draft Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Status Update List Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Root Review List Resource
  • Search Resource
  • Server Info Resource
  • Session Resource
  • User List Resource
  • User Resource
  • API Token List Resource
  • Archived Review Request List Resource
  • Muted Review Request List Resource
  • User File Attachment List Resource
  • Watched List Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • Server Info Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Default Reviewer Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • File Diff List Resource
  • File Diff Resource
  • Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • File Diff List Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • Diff Commit Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Diff File Attachment Resource
  • Original File Resource
  • Patched File Resource
  • Extension List Resource
  • Extension Resource
  • Extension Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • Hosting Service Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository User Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User Resource
  • Change List Resource
  • Change Resource
  • Change Resource
  • File Attachment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Comment List Resource
  • File Diff List Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Comment List Resource
  • Review Request List Resource
  • Review Request Resource
  • Change List Resource
  • Change Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • File Attachment List Resource
  • File Attachment Resource
  • Review List Resource
  • Review Resource
  • Review Draft Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft File Attachment List Resource
  • Draft Screenshot List Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Status Update List Resource
  • Status Update Resource
  • Review Request Resource
  • Change List Resource
  • Change Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • File Diff List Resource
  • File Attachment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • Review List Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review File Attachment Comment List Resource
  • Review General Comment List Resource
  • Review Reply List Resource
  • Review Screenshot Comment List Resource
  • Review Draft Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Status Update List Resource
  • Status Update Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Comment List Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft File Attachment Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Draft Screenshot Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft File Diff List Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Root Review List Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Review List Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Draft Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Draft Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply General Comment List Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Draft Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Draft Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review General Comment Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Screenshot Comment Resource
  • Review Reply Draft Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Draft Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Screenshot Comment Resource
  • Search Resource
  • Status Update List Resource
  • Status Update Resource
  • Status Update Resource
  • API Token List Resource
  • API Token Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • Muted Review Request Resource
  • Session Resource
  • User List Resource
  • User Resource
  • API Token List Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Request List Resource
  • User Resource
  • API Token List Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • User File Attachment Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Watched Review Request Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • WebHook Resource
  • Errors
  • 100 - Does Not Exist
  • 101 - Permission Denied
  • 102 - Invalid Attribute
  • 103 - Not Logged In
  • 104 - Login Failed
  • 105 - Invalid Form Data
  • 106 - Missing Attribute
  • 107 - Enable Extension Failed
  • 108 - Disable Extension Failed
  • 109 - Extension Already Installed
  • 110 - Install Extension Failed
  • 111 - Duplicate Item
  • 112 - OAuth2 Missing Scope Error
  • 113 - OAuth2 Access Denied Error
  • 114 - Rate Limit Exceeded
  • 203 - Invalid Change Number
  • 204 - Change Number In Use
  • 205 - Missing Repository
  • 206 - Invalid Repository
  • 207 - Repository File Not Found
  • 208 - Invalid User
  • 209 - Repository Action Not Supported
  • 210 - Repository Information Error
  • 212 - Empty Changeset
  • 213 - Server Configuration Error
  • 214 - Bad Host Key
  • 215 - Unverified Host Key
  • 216 - Unverified Host Certificate
  • 217 - Missing User Key
  • 218 - Repository Authentication Error
  • 219 - Diff Empty
  • 220 - Diff Too Big
  • 221 - File Retrieval Error
  • 222 - Hosting Service Authentication Error
  • 223 - Group Already Exists
  • 224 - Diff Parse Error
  • 225 - Publish Error
  • 226 - User Query Error
  • 227 - Commit ID Already Exists
  • 228 - Token Generation Failed
  • 230 - Could not close review request
  • 231 - Could not reopen review request
  • 232 - Ship-It Revocation Error
  • REST API 2.0
  • Overview
  • Authenticating
  • API Token Policies
  • OAuth2 Authentication
  • Rich Text Fields and Types
  • Storing/Accessing Extra Data
  • Resources
  • Root List Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Extension List Resource
  • Extension Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Request List Resource
  • Review Request Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Root Review List Resource
  • Search Resource
  • Server Info Resource
  • Session Resource
  • User List Resource
  • User Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • Server Info Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Default Reviewer Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • File Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • File Diff List Resource
  • File Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • Diff Commit Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Diff File Attachment Resource
  • Original File Resource
  • Patched File Resource
  • Extension List Resource
  • Extension Resource
  • Extension Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • Hosting Service Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository User Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User Resource
  • Change List Resource
  • Change Resource
  • Change Resource
  • File Attachment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Comment List Resource
  • File Diff List Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Comment List Resource
  • Review Request List Resource
  • Review Request Resource
  • Change List Resource
  • Diff Context Resource
  • Diff List Resource
  • File Attachment List Resource
  • Review List Resource
  • Review Request Draft Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Status Update List Resource
  • Review Request Resource
  • Change List Resource
  • Change Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • File Attachment List Resource
  • File Attachment Resource
  • Review List Resource
  • Review Resource
  • Review Draft Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft File Attachment List Resource
  • Draft Screenshot List Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Status Update List Resource
  • Status Update Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Comment List Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft File Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft File Attachment Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Draft Screenshot Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Root Review List Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Review List Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review File Attachment Comment List Resource
  • Review General Comment List Resource
  • Review Reply List Resource
  • Review Screenshot Comment List Resource
  • Review Draft Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Draft Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Draft Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review General Comment Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Screenshot Comment Resource
  • Review Reply Draft Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply General Comment List Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Draft Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Screenshot Comment Resource
  • Search Resource
  • Status Update List Resource
  • Status Update Resource
  • Status Update Resource
  • API Token List Resource
  • API Token Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • Muted Review Request Resource
  • Session Resource
  • User List Resource
  • User Resource
  • API Token List Resource
  • Archived Review Request List Resource
  • Muted Review Request List Resource
  • User File Attachment List Resource
  • Watched List Resource
  • User Resource
  • API Token List Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Request List Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • User File Attachment Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Watched Review Request Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • WebHook Resource
  • Errors
  • 100 - Does Not Exist
  • 101 - Permission Denied
  • 102 - Invalid Attribute
  • 103 - Not Logged In
  • 104 - Login Failed
  • 105 - Invalid Form Data
  • 106 - Missing Attribute
  • 107 - Enable Extension Failed
  • 108 - Disable Extension Failed
  • 109 - Extension Already Installed
  • 110 - Install Extension Failed
  • 111 - Duplicate Item
  • 112 - OAuth2 Missing Scope Error
  • 113 - OAuth2 Access Denied Error
  • 114 - Rate Limit Exceeded
  • 203 - Invalid Change Number
  • 204 - Change Number In Use
  • 205 - Missing Repository
  • 206 - Invalid Repository
  • 207 - Repository File Not Found
  • 208 - Invalid User
  • 209 - Repository Action Not Supported
  • 210 - Repository Information Error
  • 212 - Empty Changeset
  • 213 - Server Configuration Error
  • 214 - Bad Host Key
  • 215 - Unverified Host Key
  • 216 - Unverified Host Certificate
  • 217 - Missing User Key
  • 218 - Repository Authentication Error
  • 219 - Diff Empty
  • 220 - Diff Too Big
  • 221 - File Retrieval Error
  • 222 - Hosting Service Authentication Error
  • 223 - Group Already Exists
  • 224 - Diff Parse Error
  • 225 - Publish Error
  • 226 - User Query Error
  • 227 - Commit ID Already Exists
  • 228 - Token Generation Failed
  • 230 - Could not close review request
  • 231 - Could not reopen review request
  • 232 - Ship-It Revocation Error
  • Glossary
  • Extending Review Board
  • Extension Files/Package Layout
  • Creating an Extension Class
  • Extension Configuration
  • Database Models
  • Extension Static Media Files
  • JavaScript Extensions
  • Testing Extensions
  • Extension Distribution
  • Writing Review Board Extensions
  • The rbext Tool
  • Extension Hooks
  • AccountPageFormsHook
  • AccountPagesHook
  • Action Hooks
  • AdminWidgetHook
  • APIExtraDataAccessHook
  • AuthBackendHook
  • AvatarServiceHook
  • CommentDetailDisplayHook
  • DashboardColumnsHook
  • DashboardSidebarItemsHook
  • DataGridColumnsHook
  • EmailHook
  • ReviewRequestPublishedEmailHook
  • ReviewRequestClosedEmailHook
  • ReviewPublishedEmailHook
  • ReviewReplyPublishedEmailHook
  • FileAttachmentThumbnailHook
  • FileDiffACLHook
  • HostingServiceHook
  • IntegrationHook
  • NavigationBarHook
  • ReviewRequestApprovalHook
  • ReviewRequestFieldsHook
  • ReviewRequestFieldSetsHook
  • ReviewUIHook
  • SCMToolHook
  • SignalHook
  • TemplateHook
  • URLHook
  • UserInfoboxHook
  • UserPageSidebarItemsHook
  • WebAPICapabilitiesHook
  • JavaScript Extension Hooks
  • CommentDialogHook
  • ReviewDialogCommentHook
  • ReviewDialogHook
  • Adding Review Request Fields
  • Review UI Integration
  • Writing Authentication Backends
  • Writing Legacy Authentication Backends
  • Extending the Web API
  • Module and Class References
  • reviewboard
  • reviewboard.deprecation
  • reviewboard.rb_platform
  • reviewboard.signals
  • reviewboard.accounts.backends
  • reviewboard.accounts.backends.ad
  • reviewboard.accounts.backends.base
  • reviewboard.accounts.backends.http_digest
  • reviewboard.accounts.backends.ldap
  • reviewboard.accounts.backends.nis
  • reviewboard.accounts.backends.registry
  • reviewboard.accounts.backends.standard
  • reviewboard.accounts.backends.x509
  • reviewboard.accounts.decorators
  • reviewboard.accounts.errors
  • reviewboard.accounts.managers
  • reviewboard.accounts.middleware
  • reviewboard.accounts.mixins
  • reviewboard.accounts.models
  • reviewboard.accounts.pages
  • reviewboard.accounts.privacy
  • reviewboard.accounts.templatetags.accounts
  • reviewboard.accounts.trophies
  • reviewboard.accounts.forms.auth
  • reviewboard.accounts.forms.pages
  • reviewboard.accounts.forms.registration
  • reviewboard.admin
  • reviewboard.admin.admin_sites
  • reviewboard.admin.cache_stats
  • reviewboard.admin.checks
  • reviewboard.admin.decorators
  • reviewboard.admin.form_widgets
  • reviewboard.admin.middleware
  • reviewboard.admin.model_admin
  • reviewboard.admin.security_checks
  • reviewboard.admin.server
  • reviewboard.admin.siteconfig
  • reviewboard.admin.support
  • reviewboard.admin.validation
  • reviewboard.admin.widgets
  • reviewboard.attachments.forms
  • reviewboard.attachments.managers
  • reviewboard.attachments.mimetypes
  • reviewboard.attachments.models
  • reviewboard.avatars.registry
  • reviewboard.avatars.services
  • reviewboard.avatars.settings
  • reviewboard.avatars.templatetags.avatars
  • reviewboard.avatars.testcase
  • reviewboard.changedescs.models
  • reviewboard.datagrids.columns
  • reviewboard.datagrids.grids
  • reviewboard.datagrids.sidebar
  • reviewboard.diffviewer.chunk_generator
  • reviewboard.diffviewer.differ
  • reviewboard.diffviewer.diffutils
  • reviewboard.diffviewer.errors
  • reviewboard.diffviewer.forms
  • reviewboard.diffviewer.managers
  • reviewboard.diffviewer.models
  • reviewboard.diffviewer.models.diffcommit
  • reviewboard.diffviewer.models.diffset
  • reviewboard.diffviewer.models.diffset_history
  • reviewboard.diffviewer.models.filediff
  • reviewboard.diffviewer.models.legacy_file_diff_data
  • reviewboard.diffviewer.models.raw_file_diff_data
  • reviewboard.diffviewer.myersdiff
  • reviewboard.diffviewer.opcode_generator
  • reviewboard.diffviewer.parser
  • reviewboard.diffviewer.processors
  • reviewboard.diffviewer.renderers
  • reviewboard.diffviewer.smdiff
  • reviewboard.extensions.base
  • reviewboard.extensions.hooks
  • reviewboard.extensions.packaging
  • reviewboard.extensions.testing
  • reviewboard.extensions.testing.testcases
  • reviewboard.hostingsvcs.errors
  • reviewboard.hostingsvcs.forms
  • reviewboard.hostingsvcs.hook_utils
  • reviewboard.hostingsvcs.models
  • reviewboard.hostingsvcs.repository
  • reviewboard.hostingsvcs.service
  • reviewboard.hostingsvcs.testing
  • reviewboard.hostingsvcs.testing.testcases
  • reviewboard.hostingsvcs.utils.paginator
  • reviewboard.integrations
  • reviewboard.integrations.base
  • reviewboard.integrations.forms
  • reviewboard.integrations.models
  • reviewboard.integrations.urls
  • reviewboard.integrations.views
  • reviewboard.notifications
  • reviewboard.notifications.email
  • reviewboard.notifications.email.backend
  • reviewboard.notifications.email.decorators
  • reviewboard.notifications.email.hooks
  • reviewboard.notifications.email.message
  • reviewboard.notifications.email.utils
  • reviewboard.notifications.email.views
  • reviewboard.notifications.forms
  • reviewboard.notifications.managers
  • reviewboard.notifications.models
  • reviewboard.notifications.webhooks
  • reviewboard.reviews.actions
  • reviewboard.reviews.builtin_fields
  • reviewboard.reviews.chunk_generators
  • reviewboard.reviews.conditions
  • reviewboard.reviews.context
  • reviewboard.reviews.default_actions
  • reviewboard.reviews.detail
  • reviewboard.reviews.errors
  • reviewboard.reviews.features
  • reviewboard.reviews.fields
  • reviewboard.reviews.forms
  • reviewboard.reviews.managers
  • reviewboard.reviews.markdown_utils
  • reviewboard.reviews.models
  • reviewboard.reviews.signals
  • reviewboard.reviews.templatetags.reviewtags
  • reviewboard.reviews.ui.base
  • reviewboard.reviews.ui.image
  • reviewboard.reviews.ui.markdownui
  • reviewboard.reviews.ui.text
  • reviewboard.scmtools.certs
  • reviewboard.scmtools.conditions
  • reviewboard.scmtools.core
  • reviewboard.scmtools.crypto_utils
  • reviewboard.scmtools.errors
  • reviewboard.scmtools.forms
  • reviewboard.scmtools.managers
  • reviewboard.scmtools.models
  • reviewboard.scmtools.signals
  • reviewboard.scmtools.tests.testcases
  • reviewboard.search.fields
  • reviewboard.search.forms
  • reviewboard.search.indexes
  • reviewboard.search.search_backends.base
  • reviewboard.search.search_backends.elasticsearch
  • reviewboard.search.search_backends.registry
  • reviewboard.search.search_backends.whoosh
  • reviewboard.search.signal_processor
  • reviewboard.search.testing
  • reviewboard.site.conditions
  • reviewboard.site.context_processors
  • reviewboard.site.decorators
  • reviewboard.site.middleware
  • reviewboard.site.mixins
  • reviewboard.site.models
  • reviewboard.site.signals
  • reviewboard.site.templatetags.localsite
  • reviewboard.site.urlresolvers
  • reviewboard.site.validation
  • reviewboard.ssh.client
  • reviewboard.ssh.errors
  • reviewboard.ssh.policy
  • reviewboard.ssh.storage
  • reviewboard.ssh.utils
  • reviewboard.testing.hosting_services
  • reviewboard.testing.scmtool
  • reviewboard.testing.testcase
  • reviewboard.webapi.auth_backends
  • reviewboard.webapi.base
  • reviewboard.webapi.decorators
  • reviewboard.webapi.errors
  • reviewboard.webapi.mixins
  • reviewboard.webapi.models
  • reviewboard.webapi.server_info
  • reviewboard.webapi.tests.base
  • Frequently Asked Questions
  • General Index
  • Python Module Index
  • Release Notes
  • This documentation covers Review Board 5.0. You can select a version above or view the latest documentation.

    reviewboard.extensions.hooks¶

    class AccountPageFormsHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for adding new forms to a page in the My Account page.

    This is used to add custom forms to a page in the My Account page. The form can be used to provide user-level customization of an extension, through a traditional form-based approach or even through custom JavaScript.

    This hook takes the ID of a registered page where the form should be placed. Review Board supplies the following built-in page IDs:

    • settings

    • authentication

    • profile

    • groups

    Any registered page ID can be provided, whether from this extension or another.

    Form classes can only be added to a single page.

    initialize(page_id, form_classes)[source]¶

    Initialize the hook.

    This will register each of the provided page form classes on the account page matching the provided ID.

    Parameters:
    • page_id (unicode) – The page ID corresponding to a registered AccountPage.

    • form_classes (list of type) – The list of form classes to register on the page. Each class must be a subclass of AccountPageForm.

    shutdown()[source]¶

    Shut down the hook.

    This will unregister each of the page form classes from the associated page.

    hooks = []¶
    class AccountPagesHook(extension, *args, **kwargs)[source]¶

    Bases: BaseRegistryMultiItemHook

    A hook for adding new pages to the My Account page.

    A page can contain one or more forms or even a custom template allowing for configuration of an extension.

    This takes a list of AccountPage classes as parameters, which it will later instantiate as necessary. Each page can be pre-populated with one or more custom AccountPageForm classes.

    registry = <reviewboard.accounts.pages.AccountPageRegistry object>[source]¶

    The registry to register items with.

    initialize(page_classes)[source]¶

    Initialize the hook.

    This will register each of the provided account page classes.

    Parameters:

    page_classes (list of type) – The list of page classes to register. Each must be a subclass of AccountPage.

    hooks = []¶
    class ActionHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for injecting clickable actions into the UI.

    Actions are displayed either on the action bar of each review request or in the page header.

    The provided actions parameter must be a list of actions. Each action may be a dict with the following keys:

    id (optional):

    The ID of the action.

    label:

    The label for the action.

    url:

    The URL to invoke when the action is clicked.

    If we want to invoke a JavaScript action, then this should be #, and there should be a selector on the id field to attach the handler (as opposed to a javascript: URL, which doesn’t work on all browsers).

    image (optional):

    The path to the image used for the icon.

    image_width (optional):

    The width of the image.

    image_height (optional):

    The height of the image.

    If our hook needs to access the template context, then it can override get_actions() and return results from there.

    initialize(actions=None, *args, **kwargs)[source]¶

    Initialize this action hook.

    Parameters:
    • actions (list, optional) – The list of actions (of type dict or BaseReviewRequestAction) to be added.

    • *args (tuple) – Extra positional arguments.

    • **kwargs (dict) – Extra keyword arguments.

    get_actions(context)[source]¶

    Return the list of action information for this action hook.

    Parameters:

    context (django.template.Context) – The collection of key-value pairs available in the template.

    Returns:

    The list of action information for this action hook.

    Return type:

    list

    class AdminWidgetHook(extension, *args, **kwargs)[source]¶

    Bases: BaseRegistryHook

    A hook for adding a new widget to the administration dashboard.

    Changed in version 4.0: Widget classes should now subclass AdminBaseWidget instead of Widget. Note that this will require a full rewrite of the widget.

    The primary argument is no longer supported when instantiating the hook, and will be ignored. Callers should remove it.

    Changed in version 5.0: Support for legacy widgets and arguments has been removed.

    registry = <reviewboard.admin.widgets.AdminWidgetsRegistry object>[source]¶

    The registry to register items with.

    hooks = []¶
    class APIExtraDataAccessHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for setting access states to extra data fields.

    Extensions can use this hook to register extra_data fields with certain access states on subclasses of WebAPIResource.

    This accepts a list of field_set values specified by the Extension and registers them when the hook is created. Likewise, it unregisters the same list of field_set values when the Extension is disabled.

    Each element of field_set is a 2-tuple where the first element of the tuple is the field’s path (as a tuple) and the second is the field’s access state (as one of ACCESS_STATE_PUBLIC or ACCESS_STATE_PRIVATE).

    Example

    obj.extra_data = {
        'foo': {
            'bar' : 'private_data',
            'baz' : 'public_data'
        }
    }
    
    ...
    
    APIExtraDataAccessHook(
        extension,
        resource,
        [
            (('foo', 'bar'), ExtraDataAccessLevel.ACCESS_STATE_PRIVATE,
        ])
    
    initialize(resource, field_set)[source]¶

    Initialize the APIExtraDataAccessHook.

    Parameters:
    • resource (reviewboard.webapi.base.WebAPIResource) – The resource to modify access states for.

    • field_set (list) – Each element of field_set is a 2-tuple where the first element of the tuple is the field’s path (as a tuple) and the second is the field’s access state (as one of ACCESS_STATE_PUBLIC or ACCESS_STATE_PRIVATE).

    get_extra_data_state(key_path)[source]¶

    Return the state of an extra_data field.

    Parameters:

    key_path (tuple) – A tuple of strings representing the path of an extra_data field.

    Returns:

    The access state of the provided field or None.

    Return type:

    int

    shutdown()[source]¶

    Shut down the hook.

    This will unregister the access levels from the resource.

    hooks = []¶
    class AuthBackendHook(extension, *args, **kwargs)[source]¶

    Bases: BaseRegistryHook

    A hook for registering an authentication backend.

    Authentication backends control user authentication, registration, user lookup, and user data manipulation.

    This hook takes the class of an authentication backend that should be made available to the server.

    registry = <reviewboard.accounts.backends.registry.AuthBackendRegistry object>[source]¶

    The registry to register items with.

    initialize(backend_cls)[source]¶

    Initialize the hook.

    This will register the provided authentication backend.

    Parameters:

    backend_cls (type) – The authentication backend to register. This should be a subclass of AuthBackend.

    hooks = []¶
    class AvatarServiceHook(extension, *args, **kwargs)[source]¶

    Bases: BaseRegistryHook

    “A hook for adding avatar services.

    This hook will register services with the avatar services registry and unregister them when the hook is shut down.

    registry = <SimpleLazyObject: <reviewboard.avatars.registry.AvatarServiceRegistry object>>[source]¶

    The registry to register items with.

    initialize(service)[source]¶

    Initialize the avatar service hook with the given service.

    Parameters:

    service (type) –

    The avatar service class to register.

    This must be a subclass of djblets.avatars.services.base.AvatarService.

    hooks = []¶
    class BaseReviewRequestActionHook(extension, *args, **kwargs)[source]¶

    Bases: AppliesToURLMixin, ActionHook

    A base hook for adding review request actions to the action bar.

    Review request actions are displayed on the action bar (alongside default actions such as Download Diff and Ship It!) of each review request. This action bar is displayed on three main types of pages:

    Review Request Pages:

    Where reviews are displayed.

    File Attachment Pages:

    Where files like screenshots can be reviewed.

    Diff Viewer Pages:

    Where diffs/interdiffs can be viewed side-by-side.

    Each action should be an instance of BaseReviewRequestAction (in particular, each action could be an instance of the subclass BaseReviewRequestMenuAction). For backwards compatibility, actions may also be supplied as ActionHook-style dictionaries.

    initialize(actions=None, apply_to=None, *args, **kwargs)[source]¶

    Initialize this action hook.

    Parameters:
    • actions (list, optional) – The list of actions (of type dict or BaseReviewRequestAction) to be added.

    • apply_to (list of unicode, optional) – The list of URL names that this action hook will apply to.

    • *args (tuple) – Extra positional arguments.

    • **kwargs (dict) – Extra keyword arguments.

    Raises:
    • KeyError – Some dictionary is not an ActionHook-style dictionary.

    • ValueError – Some review request action is neither a BaseReviewRequestAction nor a dict instance.

    shutdown()[source]¶

    Shutdown the hook and unregister all actions.

    convert_action(action_dict)[source]¶

    Convert the given dictionary to a review request action instance.

    Parameters:

    action_dict (dict) – A dictionary representing a review request action, as specified by the ActionHook class.

    Returns:

    The corresponding review request action instance.

    Return type:

    BaseReviewRequestAction

    Raises:

    KeyError – The given dictionary is not an ActionHook-style dictionary.

    hooks = []¶
    class CommentDetailDisplayHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    This hook allows adding details to the display of comments.

    The hook can provide additional details to display for a comment in a review and e-mails.

    render_review_comment_detail(comment)[source]¶

    Render additional HTML for a comment on the page.

    Subclasses must implement this to provide HTML for use on the review request page or review dialog.

    The result is assumed to be HTML-safe. It’s important that subclasses escape any data as needed.

    Parameters:

    comment (reviewboard.reviews.models.base_comment.BaseComment) – The comment to render HTML for,

    Returns:

    The resulting HTML for the comment. This can be an empty string.

    Return type:

    django.utils.safestring.SafeText

    render_email_comment_detail(comment, is_html)[source]¶

    Render additional text or HTML for a comment in an e-mail.

    Subclasses must implement this to provide text or HTML (depending on the is_html flag) for use in an e-mail.

    If rendering HTML, the result is assumed to be HTML-safe. It’s important that subclasses escape any data as needed.

    Parameters:
    • comment (reviewboard.reviews.models.base_comment.BaseComment) – The comment to render HTML for,

    • is_html (bool) – Whether this must return HTML content.

    Returns:

    The resulting HTML for the comment. This can be an empty string.

    Return type:

    django.utils.safestring.SafeText

    hooks = []¶
    class ConsentRequirementHook(extension, *args, **kwargs)¶

    Bases: BaseRegistryHook

    Registers a ConsentRequirement for use of personal data.

    property registry¶

    The registry that the hook interfaces with.

    hooks = []¶
    class DashboardColumnsHook(extension, *args, **kwargs)[source]¶

    Bases: DataGridColumnsHook

    A hook for adding custom columns to the dashboard.

    Extensions can use this hook to provide one or more custom columns in the dashboard. These columns can be added by users, moved around, and even sorted, like other columns.

    Each value passed to columns must be an instance of djblets.datagrid.grids.Column.

    It also must have an id attribute set. This must be unique within the dashboard. It is recommended to use a vendor-specific prefix to the ID, in order to avoid conflicts.

    initialize(columns)[source]¶

    Initialize the hook.

    This will register each of the provided columns on the Dashboard.

    Parameters:

    columns (list of djblets.datagrid.grids.Column) – The list of column instances to register on the Dashboard.

    class DashboardSidebarItemsHook(extension, *args, **kwargs)[source]¶

    Bases: DataGridSidebarItemsHook

    A hook for adding items to the sidebar of the dashboard.

    Extensions can use this hook to plug new items into the sidebar of the dashboard. These will appear below the built-in items.

    The items can be any subclass of reviewboard.datagrids.sidebar.BaseSidebarItem, including the built-in reviewboard.datagrids.sidebar.BaseSidebarSection and built-in reviewboard.datagrids.sidebar.SidebarNavItem.

    initialize(item_classes)[source]¶

    Initialize the hook.

    This will register the provided datagrid sidebar item classes in the Dashboard.

    Parameters:

    item_classes (list of type) – The list of item classes to register on the datagrid’s sidebar. Each must be a subclass of BaseSidebarItem.

    class DataGridColumnsHook(extension, *args, **kwargs)¶

    Bases: ExtensionHook

    Adds columns to a datagrid.

    This hook allows an extension to register new columns to any datagrid. These columns can be added by the user, rearranged, and sorted, like any other column.

    Each column must have an id already set, and it must be unique.

    initialize(datagrid_cls, columns)¶

    Initialize the hook.

    Parameters:
    • datagrid_cls (type) – The specific datagrid class that will include this registered list of columns as possible options.

    • columns (list) – A list of Column instances to register on the datagrid.

    shutdown()¶

    Shut down the extension.

    Extension subclasses can perform any custom cleanup they need here.

    While in this function, hook_state will be set to HOOK_STATE_DISABLING.

    Changed in version 1.0: This method used to be responsible both for internal cleanup and the cleanup of the subclass. Starting in Djblets 1.0, internal cleanup has moved to disable_hook(). Subclasses no longer need to call the parent method unless inheriting from a mixin or another ExtensionHook subclass, but should continue to do so if they need to retain compatibility with older versions.

    Example

    class ThingHook(ExtensionHook, metaclass=ExtensionHookPoint):
        def shutdown(self):
            unregister_thing(self.thing_id)
    
    hooks = []¶
    class DataGridSidebarItemsHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for adding items to the sidebar of a datagrid.

    Extensions can use this hook to plug new items into the sidebar of any datagrid supporting sidebars.

    The items can be any subclass of reviewboard.datagrids.sidebar.BaseSidebarItem, including the built-in reviewboard.datagrids.sidebar.BaseSidebarSection and built-in reviewboard.datagrids.sidebar.SidebarNavItem.

    initialize(datagrid, item_classes)[source]¶

    Initialize the hook.

    This will register the provided datagrid sidebar item classes in the provided datagrid.

    Parameters:
    • datagrid (type) – The datagrid class to register the items on. The datagrid must have a sidebar, or an error will occur.

    • item_classes (list of type) – The list of item classes to register on the datagrid’s sidebar. Each must be a subclass of BaseSidebarItem.

    Raises:

    ValueError – A datagrid was provided that does not contain a sidebar.

    shutdown()[source]¶

    Shut down the hook.

    This will unregister each item class from the datagrid’s sidebar.

    hooks = []¶
    class DiffViewerActionHook(extension, *args, **kwargs)[source]¶

    Bases: BaseReviewRequestActionHook

    A hook for adding review request actions to diff viewer pages.

    By default, actions that are passed into this hook will only be displayed on diff viewer pages and not on any review request pages or file attachment pages.

    initialize(actions=None, apply_to=['view-diff', 'view-interdiff', 'view-diff-revision'])[source]¶

    Initialize this action hook.

    Parameters:
    • actions (list, optional) – The list of actions (of type dict or BaseReviewRequestAction) to be added.

    • apply_to (list of unicode, optional) – The list of URL names that this action hook will apply to.

    Raises:
    • KeyError – Some dictionary is not an ActionHook-style dictionary.

    • ValueError – Some review request action is neither a BaseReviewRequestAction nor a dict instance.

    class EmailHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for changing the recipients of e-mails.

    Extensions can use this hook to change the contents of the To and CC fields of e-mails. This should be subclassed in an extension to provide the desired behaviour. This class is a base class for more specialized extension hooks. If modifying only one type of e-mail’s fields is desired, one of the following classes should be subclassed instead.

    • ReviewPublishedEmailHook

    • ReviewReplyPublishedEmailHook

    • ReviewRequestPublishedEmailHook

    • ReviewRequestClosedEmailHook

    However, if more specialized behaviour is desired, this class can be subclassed.

    initialize(signals)[source]¶

    Initialize the hook.

    Parameters:

    signals (list) –

    A list of Signals that, when triggered, will cause e-mails to be sent. Valid signals are:

    • review_request_published

    • review_request_closed

    • review_published

    • reply_published

    shutdown()[source]¶

    Shut down the hook.

    This will unregister each of the e-mail handlers.

    get_to_field(to_field, **kwargs)[source]¶

    Return the To field for the e-mail.

    Parameters:
    • to_field (set) – A set of Users and Groups that will receive the e-mail.

    • kwargs (dict) – Additional keyword arguments that will be passed based on the type of e-mail being sent.

    Returns:

    The desired To field.

    Return type:

    set

    get_cc_field(cc_field, **kwargs)[source]¶

    Return the CC field for the e-mail.

    Parameters:
    • cc_field (set) – A set of Users and Groups that will receive a carbon copy of the e-mail.

    • kwargs (dict) – Additional keyword arguments that will be passed based on the type of e-mail being sent.

    Returns:

    The desired CC field.

    Return type:

    set

    hooks = []¶
    class ExtensionHook(extension, *args, **kwargs)¶

    Bases: object

    The base class for a hook into some part of an application.

    ExtensionHooks are classes that can hook into an ExtensionHookPoint to provide some level of functionality in an application. A consuming application should provide a subclass of ExtensionHook that will provide functions for getting data or anything else that’s needed. Extensions may then subclass or initialize that specific ExtensionHook.

    A base ExtensionHook subclass must use ExtensionHookPoint as a metaclass. All hooks deriving from that subclass will be registered along with that hook point.

    Example

    from djblets.extensions.hooks import (ExtensionHook,
                                          ExtensionHookPoint)
    
    from myproject.nav import register_thing, unregister_thing_id
    
    
    class ThingHook(ExtensionHook, metaclass=ExtensionHookPoint):
        def initialize(self, thing_id):
            self.thing_id = thing_id
            register_thing(self.thing_id)
    
        def shutdown(self):
            unregister_thing(self.thing_id)
    

    Changed in version 1.0: Starting with Djblets 1.0, extension hooks should implement the initialize() method to handle any initialization. It no longer needs to call the parent shutdown() method, either. However, to retain compatibility with older versions, they may still override __init__() and may call the parent shutdown(). See those methods for more details.

    extension¶

    The parent extension, or another object that can act as a hook owner.

    Type:

    djblets.extensions.extension.Extension

    hook_state¶

    The state of the hook. This will be one of HOOK_STATE_DISABLED, HOOK_STATE_ENABLED, HOOK_STATE_DISABLING, or HOOK_STATE_ENABLING.

    Type:

    int

    HOOK_STATE_DISABLED = 0¶

    The hook is disabled.

    HOOK_STATE_ENABLED = 1¶

    The hook is enabled.

    HOOK_STATE_DISABLING = 2¶

    The hook is in the process of disabling.

    HOOK_STATE_ENABLING = 3¶

    The hook is in the process of enabling.

    __init__(extension, *args, **kwargs)¶

    Initialize the ExtensionHook.

    This is called when creating an instance of the hook. This will call enable_hook() with the provided arguments, beginning the internal initialization process. That will then call initialize(), which is responsible for any initialization of state in the subclass.

    Subclasses should override initialize() in order to provide any state initialization, rather than overriding this method.

    Changed in version 1.0: Prior to Djblets 1.0, initialization all happened in __init__(). Code that needs to remain compatible with older versions should continue to do so, but otherwise this code should move to initialize().

    Parameters:
    • extension (djblets.extensions.extension.Extension) – The parent extension, or another object that can act as a hook owner.

    • start_enabled (bool, optional) – Whether to enable the hook once constructed. This defaults to True.

    property initialized¶

    Whether the hook is initialized and enabled.

    initialize(*args, **kwargs)¶

    Initialize the extension hook’s state.

    Extension subclasses can perform any custom initialization they need here.

    Any additional arguments passed to the hook during construction will be passed to this as well.

    While in this function, hook_state will be set to HOOK_STATE_ENABLING.

    By default, this does nothing.

    New in version 1.0.

    Parameters:
    • *args (tuple) – The list of additional arguments used to initialize the hook state.

    • **kwargs (dict) – The additional keyword arguments used to initialize the hook state.

    Example

    class ThingHook(ExtensionHook, metaclass=ExtensionHookPoint):
        def initialize(self, thing_id):
            self.thing_id = thing_id
            register_thing(self.thing_id)
    
    shutdown()¶

    Shut down the extension.

    Extension subclasses can perform any custom cleanup they need here.

    While in this function, hook_state will be set to HOOK_STATE_DISABLING.

    Changed in version 1.0: This method used to be responsible both for internal cleanup and the cleanup of the subclass. Starting in Djblets 1.0, internal cleanup has moved to disable_hook(). Subclasses no longer need to call the parent method unless inheriting from a mixin or another ExtensionHook subclass, but should continue to do so if they need to retain compatibility with older versions.

    Example

    class ThingHook(ExtensionHook, metaclass=ExtensionHookPoint):
        def shutdown(self):
            unregister_thing(self.thing_id)
    
    enable_hook(*args, **kwargs)¶

    Enable the ExtensionHook, beginning the initialization process.

    This will register the instance of the hook and begin its initialization. It takes the same parameters that would be given during construction of the hook, allowing disabled hooks to be created again with fresh state.

    Subclasses should not override this process. They should instead implement initialize() to handle initialization of the state of the hook.

    New in version 1.0.

    Parameters:
    • *args (tuple) – The list of additional arguments used to initialize the hook state.

    • **kwargs (dict) – The additional keyword arguments used to initialize the hook state.

    disable_hook(call_shutdown=True)¶

    Disable the hook, unregistering it from the extension.

    This will unregister the hook and uninitialize it, putting it into a disabled state.

    Consumers can call this if they want to turn off hooks temporarily without reconstructing the instances later. It’s also called internally when shutting down an extension.

    New in version 1.0.

    Parameters:

    call_shutdown (bool, optional) – Whether to call shutdown(). This should always be True unless called internally.

    class FileAttachmentThumbnailHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    This hook allows custom thumbnails to be defined for file attachments.

    This accepts a list of mimetype handlers specified by the Extension that must:

    • Subclass reviewboard.attachments.mimetypes.MimetypeHandler

    • Define a list of file mimetypes it can handle in a class variable called supported_mimetypes

    • Define how to generate a thumbnail of that mimetype by overriding the instance function def get_thumbnail(self):

    These mimetype handlers are registered when the hook is created. Likewise, it unregisters the same list of mimetype handlers when the extension is disabled.

    initialize(mimetype_handlers)[source]¶

    Initialize the hook.

    This will register each of the provided mimetype handler classes.

    Parameters:

    mimetype_handlers (list of type) – The list of mimetype handlers to register. Each must be a subclass of MimetypeHandler.

    Raises:

    TypeError – One or more of the provided classes are not of the correct type.

    shutdown()[source]¶

    Shut down the hook.

    This will unregister each of the mimetype handler classes.

    hooks = []¶
    class FileDiffACLHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for checking ACLs on diff files.

    Extensions can use this hook to connect repository ACLs into the Review Board access system. This is provided as an extension hook because systems may be deployed in various ways, and SCM usernames may not necessarily match Review Board usernames.

    New in version 4.0.5: This is experimental in 4.0.x, with plans to make it stable for 5.0. The API may change during this time.

    is_accessible(diffset, user, **kwargs)[source]¶

    Return whether the given file is accessible by the given user.

    Parameters:
    • diffset (reviewboard.diffviewer.models.DiffSet) – The diffset containing the file.

    • user (django.contrib.auth.models.User) – The user to check.

    • **kwargs (dict, unused) – Additional keyword arguments for future expansion.

    Returns:

    False if the user does not have access to the file. True if the user explicitly does have access. None if the extension did not check for this diffset or repository (so that other hook points can continue).

    Return type:

    bool

    hooks = []¶
    class HeaderActionHook(extension, *args, **kwargs)[source]¶

    Bases: ActionHook

    A hook for adding actions to the page header.

    hooks = []¶
    class HeaderDropdownActionHook(extension, *args, **kwargs)[source]¶

    Bases: ActionHook

    A hook for adding dropdown menu actions to the page header.

    hooks = []¶
    class HostingServiceHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for registering a hosting service.

    initialize(service_cls)[source]¶

    Initialize the hook.

    This will register the hosting service.

    Parameters:

    service_cls (type) – The hosting service class to register. This must be a subclass of HostingService.

    Raises:

    ValueError – The service’s hosting_service_id attribute was not set.

    shutdown()[source]¶

    Shut down the hook.

    This will unregister the hosting service.

    hooks = []¶
    class IntegrationHook(extension, *args, **kwargs)[source]¶

    Bases: GetIntegrationManagerMixin, BaseIntegrationHook

    A hook for registering new integration classes.

    Integrations enable Review Board to connect with third-party services in specialized ways. This class makes it easy to register new integrations on an extension, binding their lifecycles to that of the extension.

    hooks = []¶
    integration_cls: Type[Integration]¶

    The integration class being managed by the hook.

    class NavigationBarHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for adding entries to the main navigation bar.

    This takes a list of entries. Each entry represents something on the navigation bar, and is a dictionary with the following keys:

    label:

    The label to display

    url:

    The URL to point to.

    url_name:

    The name of the URL to point to.

    Only one of url or url_name is required. url_name will take precedence.

    Optionally, a callable can be passed in for is_enabled_for, which takes a single argument (the user) and returns True or False, indicating whether the entries should be shown. If this is not passed in, the entries are always shown (including for anonymous users).

    If your hook needs to access the template context, it can override get_entries() and return results from there.

    initialize(entries=[], is_enabled_for=None, *args, **kwargs)[source]¶

    Initialize the hook.

    This will register each of the entries in the navigation bar.

    Parameters:
    • entries (list of dict) – The list of dictionary entries representing navigation bar items, as documented above.

    • is_enabled_for (callable, optional) –

      The optional function used to determine if these entries should appear for a given page. This is in the format of:

      def is_enabled_for(user, request, local_site_name,
                         **kwargs):
          return True
      

      If not provided, the entries will be visible on every page.

    • *args (tuple) – Additional positional arguments. Subclasses should always pass these to this class.

    • **kwargs (dict) – Additional keyword arguments. Subclasses should always pass these to this class.

    get_entries(context)[source]¶

    Return the navigation bar entries defined in this hook.

    This can be overridden by subclasses if they need more control over the entries or need to access the template context.

    Parameters:

    context (django.template.RequestContext) – The template context for the page.

    Returns:

    The list of navigation bar entries. This will be empty if the entries are not enabled for this page.

    Return type:

    list of dict

    hooks = []¶
    class ReviewRequestActionHook(extension, *args, **kwargs)[source]¶

    Bases: BaseReviewRequestActionHook

    A hook for adding review request actions to review request pages.

    By default, actions that are passed into this hook will only be displayed on review request pages and not on any file attachment pages or diff viewer pages.

    initialize(actions=None, apply_to=None)[source]¶

    Initialize this action hook.

    Parameters:
    • actions (list, optional) – The list of actions (of type dict or BaseReviewRequestAction) to be added.

    • apply_to (list of unicode, optional) – The list of URL names that this action hook will apply to. By default, this will apply to the main review request page only.

    Raises:
    • KeyError – Some dictionary is not an ActionHook-style dictionary.

    • ValueError – Some review request action is neither a BaseReviewRequestAction nor a dict instance.

    class ReviewRequestApprovalHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for determining if a review request is approved.

    Extensions can use this to hook into the process for determining review request approval, which may impact any scripts integrating with Review Board to, for example, allow committing to a repository.

    is_approved(review_request, prev_approved, prev_failure)[source]¶

    Determine if the review request is approved.

    This function is provided with the review request and the previously calculated approved state (either from a prior hook, or from the base state of ship_it_count > 0 and issue_open_count == 0).

    If approved, this should return True. If unapproved, it should return a tuple with False and a string briefly explaining why it’s not approved. This may be displayed to the user.

    It generally should also take the previous approved state into consideration in this choice (such as returning False if the previous state is False). This is, however, fully up to the hook.

    The approval decision may be overridden by any following hooks.

    Parameters:
    • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The review request being checked for approval.

    • prev_approved (bool) – The previously-calculated approval result, either from another hook or by Review Board.

    • prev_failure (unicode) – The previously-calculated approval failure message, either from another hook or by Review Board.

    Returns:

    Either a boolean indicating approval (re-using prev_failure, if not approved), or a tuple in the form of (approved, failure_message).

    Return type:

    bool or tuple

    hooks = []¶
    class ReviewRequestClosedEmailHook(extension, *args, **kwargs)[source]¶

    Bases: EmailHook

    A hook for changing the recipients of review request closing e-mails.

    This hook must be subclassed. The caller is expected to override get_to_field() and/or get_cc_field().

    initialize()[source]¶

    Initialize the hook.

    get_to_field(to_field, review_request, user, close_type, **kwargs)[source]¶

    Return the To field for the e-mail.

    Parameters:
    • to_field (set) – A set of Users and Groups that will receive the e-mail.

    • review_request (reviewboard.reviews.models.ReviewRequest) – The review request that was published.

    • user (django.contrib.auth.models.User) – The user who closed the review request.

    • close_type (unicode) – How the review request was closed. This is one of SUBMITTED or DISCARDED.

    • **kwargs (dict) – Additional keyword arguments, since the signature may change in the future.

    Returns:

    The desired To field.

    Return type:

    set

    get_cc_field(cc_field, review_request, user, close_type, **kwargs)[source]¶

    Return the CC field for the e-mail.

    Parameters:
    • to_field (set) – A set of Users and Groups that will receive a carbon copy of the e-mail.

    • review_request (reviewboard.reviews.models.ReviewRequest) – The review request that was published.

    • user (django.contrib.auth.models.User) – The user who closed the review request.

    • close_type (unicode) – How the review request was closed. This is one of SUBMITTED or DISCARDED.

    • **kwargs (dict) – Additional keyword arguments, since the signature may change in the future.

    Returns:

    The desired CC field.

    Return type:

    set

    class ReviewRequestDropdownActionHook(extension, *args, **kwargs)[source]¶

    Bases: ReviewRequestActionHook

    A hook for adding dropdown menu actions to review request pages.

    Each menu action should be an instance of BaseReviewRequestMenuAction. For backwards compatibility, menu actions may also be supplied as dictionaries with the following keys:

    id (optional):

    The ID of the action.

    label:

    The label for the dropdown menu action.

    items:

    A list of ActionHook-style dictionaries.

    Example

    actions = [{
        'id': 'sample-menu-action',
        'label': 'Sample Menu',
        'items': [
            {
                'id': 'first-item-action',
                'label': 'Item 1',
                'url': '#',
            },
            {
                'label': 'Item 2',
                'url': '#',
            },
        ],
    }]
    
    convert_action(action_dict)[source]¶

    Convert the given dictionary to a review request action instance.

    Children action dictionaries are recursively converted to action instances.

    Parameters:

    action_dict (dict) – A dictionary representing a review request menu action, as specified by the ReviewRequestDropdownActionHook class.

    Returns:

    The corresponding review request menu action instance.

    Return type:

    BaseReviewRequestMenuAction

    Raises:

    KeyError – The given review request menu action dictionary is not a ReviewRequestDropdownActionHook-style dictionary.

    class ReviewRequestFieldSetsHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for creating fieldsets on the side of the review request page.

    A fieldset contains one or more fields, and is mainly used to separate groups of fields from each other.

    This takes a list of fieldset classes as parameters, which it will later instantiate as necessary. Each fieldset can be pre-populated with one or more custom field classes.

    initialize(fieldsets)[source]¶

    Initialize the hook.

    This will register each of the provided fieldsets for review requests.

    Parameters:

    fieldsets (list of type) – The list of fieldset classes to register. Each must be a subclass of BaseReviewRequestFieldSet.

    Raises:

    djblets.registries.errors.ItemLookupError – A fieldset was already registered matching an ID from this list.

    shutdown()[source]¶

    Shut down the hook.

    This will unregister each of the fieldsets from the review requests.

    hooks = []¶
    class ReviewRequestFieldsHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for creating fields on the review request page.

    This is used to create custom fields on a review request page for requesting and storing data. A field can be editable, or it can be only for display purposes. See the classes in reviewboard.reviews.fields for more information and documentation.

    This hook takes the ID of a registered fieldset where the provided field classes should be added. Review Board supplies three built-in fieldset IDs:

    main:

    The fieldset with Description and Testing Done.

    info:

    The “Information” fieldset on the side.

    reviewers:

    The “Reviewers” fieldset on the side.

    Any registered fieldset ID can be provided, whether from this extension or another.

    Field classes can only be added to a single fieldset.

    initialize(fieldset_id, fields)[source]¶

    Initialize the hook.

    This will register each of the provided field classes into the fieldset with the given ID.

    Parameters:
    • fieldset_id (unicode) – The ID of the BaseReviewRequestFieldSet to register.

    • fields (list of type) – The list of fields to register into the fieldset. Each must be a subclass of BaseReviewRequestField.

    shutdown()[source]¶

    Shut down the hook.

    This will unregister each of the field classes from the fieldset.

    hooks = []¶
    class ReviewRequestPublishedEmailHook(extension, *args, **kwargs)[source]¶

    Bases: EmailHook

    A hook for changing the recipients of review request publishing e-mails.

    This hook must be subclassed. The caller is expected to override get_to_field() and/or get_cc_field().

    initialize()[source]¶

    Initialize the hook.

    get_to_field(to_field, review_request, user, **kwargs)[source]¶

    Return the To field for the e-mail.

    Parameters:
    • to_field (set) – A set of Users and Groups that will receive the e-mail.

    • review_request (reviewboard.reviews.models.ReviewRequest) – The review request that was published.

    • user (django.contrib.auth.models.User) – The user who published the review request.

    • **kwargs (dict) – Additional keyword arguments, since the signature may change in the future.

    Returns:

    The desired To field.

    Return type:

    set

    get_cc_field(cc_field, review_request, user, **kwargs)[source]¶

    Return the CC field for the e-mail.

    Parameters:
    • to_field (set) – A set of Users and Groups that will receive a carbon copy of the e-mail.

    • review_request (reviewboard.reviews.models.ReviewRequest) – The review request that was published.

    • user (django.contrib.auth.models.User) – The user who published the review request.

    • **kwargs (dict) – Additional keyword arguments, since the signature may change in the future.

    Returns:

    The desired CC field.

    Return type:

    set

    class ReviewPublishedEmailHook(extension, *args, **kwargs)[source]¶

    Bases: EmailHook

    A hook for changing the recipients of review publishing e-mails.

    This hook must be subclassed. The caller is expected to override get_to_field() and/or get_cc_field().

    initialize()[source]¶

    Initialize the hook.

    get_to_field(to_field, review, user, review_request, to_owner_only, **kwargs)[source]¶

    Return the To field for the e-mail.

    Parameters:
    • to_field (set) – A set of Users and Groups that will receive the e-mail.

    • review (reviewboard.reviews.models.Review) – The review that was published.

    • user (django.contrib.auth.models.User) – The user who published the review.

    • review_request (reviewboard.reviews.models.ReviewRequest) – The review request that was reviewed.

    • to_owner_only (bool) – Whether or not the review was marked as being targeted at only the submitter.

    • **kwargs (dict) – Additional keyword arguments, since the signature may change in the future.

    Returns:

    The desired To field.

    Return type:

    set

    get_cc_field(cc_field, review, user, review_request, to_owner_only, **kwargs)[source]¶

    Return the CC field for the e-mail.

    Parameters:
    • cc_field (set) – A set of Users and Groups that will receive a carbon copy of the e-mail.

    • review (reviewboard.reviews.models.Review) – The review that was published.

    • user (django.contrib.auth.models.User) – The user who published the review.

    • review_request (reviewboard.reviews.models.ReviewRequest) – The review request that was reviewed.

    • to_owner_only (bool) – Whether or not the review was marked as being targeted at only the submitter.

    • **kwargs (dict) – Additional keyword arguments, since the signature may change in the future.

    Returns:

    The desired CC field.

    Return type:

    set

    class ReviewReplyPublishedEmailHook(extension, *args, **kwargs)[source]¶

    Bases: EmailHook

    A hook for changing the recipients of review reply publishing e-mails.

    This hook must be subclassed. The caller is expected to override get_to_field() and/or get_cc_field().

    initialize()[source]¶

    Initialize the hook.

    get_to_field(to_field, reply, user, review_request, **kwargs)[source]¶

    Return the To field for the e-mail.

    Parameters:
    • to_field (set) – A set of Users and Groups that will receive the e-mail.

    • reply (reviewboard.reviews.models.Review) – The review reply that was published.

    • user (django.contrib.auth.models.User) – The user who published the review reply.

    • review (reviewboard.reviews.model.Review) – The review the reply is in reply to.

    • review_request (reviewboard.reviews.models.ReviewRequest) – The review request that was reviewed.

    • **kwargs (dict) – Additional keyword arguments, since the signature may change in the future.

    Returns:

    The desired To field.

    Return type:

    set

    get_cc_field(cc_field, reply, user, review_request, **kwargs)[source]¶

    Return the CC field for the e-mail.

    Parameters:
    • to_field (set) – A set of Users and Groups that will receive a carbon copy of the e-mail

    • reply (reviewboard.reviews.models.Review) – The review reply that was published.

    • user (django.contrib.auth.models.User) – The user who published the reply.

    • review_request (reviewboard.reviews.models.ReviewRequest) – The review request that was reviewed.

    • **kwargs (dict) – Additional keyword arguments, since the signature may change in the future.

    Returns:

    The desired CC field.

    Return type:

    set

    class ReviewUIHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    This hook allows integration of Extension-defined Review UIs.

    This accepts a list of Review UIs specified by the Extension and registers them when the hook is created. Likewise, it unregisters the same list of Review UIs when the Extension is disabled.

    initialize(review_uis)[source]¶

    Initialize the hook.

    This will register the list of review UIs for use in reviewing file attachments.

    Parameters:

    review_uis (list of type) – The list of review UI classes to register. Each must be a subclass of FileAttachmentReviewUI.

    Raises:

    TypeError – The provided review UI class is not of a compatible type.

    shutdown()[source]¶

    Shut down the hook.

    This will unregister the list of review UIs.

    hooks = []¶
    class SignalHook(extension, *args, **kwargs)¶

    Bases: ExtensionHook

    Connects to a Django signal.

    This will handle connecting to a signal, calling the specified callback when fired. It will disconnect from the signal when the extension is disabled.

    The callback will also be passed an extension= keyword argument pointing to the extension instance.

    initialize(signal, callback, sender=None, sandbox_errors=True)¶

    Initialize the hook.

    Parameters:
    • signal (django.dispatch.Signal) – The signal to connect to.

    • callback (callable) – The function to call when the signal is fired.

    • sender (object or class, optional) – The sender argument to pass to the signal connection. See send() for more information.

    • sandbox_errors (bool, optional) – If True, errors coming from callback will be sandboxed, preventing them from reaching the code that fired the signal. The error will instead be logged and then ignored.

    shutdown()¶

    Shut down the extension.

    Extension subclasses can perform any custom cleanup they need here.

    While in this function, hook_state will be set to HOOK_STATE_DISABLING.

    Changed in version 1.0: This method used to be responsible both for internal cleanup and the cleanup of the subclass. Starting in Djblets 1.0, internal cleanup has moved to disable_hook(). Subclasses no longer need to call the parent method unless inheriting from a mixin or another ExtensionHook subclass, but should continue to do so if they need to retain compatibility with older versions.

    Example

    class ThingHook(ExtensionHook, metaclass=ExtensionHookPoint):
        def shutdown(self):
            unregister_thing(self.thing_id)
    
    hooks = []¶
    class TemplateHook(extension, *args, **kwargs)¶

    Bases: AppliesToURLMixin, ExtensionHook

    Custom templates hook.

    A hook that renders a template at hook points defined in another template.

    initialize(name, template_name=None, apply_to=[], extra_context={})¶

    Initialize the hook.

    Parameters:
    • name (unicode) – The name of the template hook point that should render this template. This is application-specific.

    • template_name (unicode, optional) – The name of the template to render.

    • apply_to (list, optional) – The list of URL names where this template should render. By default, all templates containing the template hook point will render this template.

    • extra_context (dict) – Extra context to include when rendering the template.

    shutdown()¶

    Shut down the extension.

    Extension subclasses can perform any custom cleanup they need here.

    While in this function, hook_state will be set to HOOK_STATE_DISABLING.

    Changed in version 1.0: This method used to be responsible both for internal cleanup and the cleanup of the subclass. Starting in Djblets 1.0, internal cleanup has moved to disable_hook(). Subclasses no longer need to call the parent method unless inheriting from a mixin or another ExtensionHook subclass, but should continue to do so if they need to retain compatibility with older versions.

    Example

    class ThingHook(ExtensionHook, metaclass=ExtensionHookPoint):
        def shutdown(self):
            unregister_thing(self.thing_id)
    
    render_to_string(request, context)¶

    Renders the content for the hook.

    By default, this renders the provided template name to a string and returns it.

    get_extra_context(request, context)¶

    Returns extra context for the hook.

    Subclasses can override this to provide additional context dynamically beyond what’s passed in to the constructor.

    By default, an empty dictionary is returned.

    classmethod by_name(name)¶
    hooks = []¶
    class URLHook(extension, *args, **kwargs)¶

    Bases: ExtensionHook

    Custom URL hook.

    A hook that installs custom URLs. These URLs reside in a project-specified parent URL.

    initialize(patterns)¶

    Initialize the hook.

    Parameters:

    patterns (list) – The list of path() entries comprising the URLs to register.

    shutdown()¶

    Shut down the extension.

    Extension subclasses can perform any custom cleanup they need here.

    While in this function, hook_state will be set to HOOK_STATE_DISABLING.

    Changed in version 1.0: This method used to be responsible both for internal cleanup and the cleanup of the subclass. Starting in Djblets 1.0, internal cleanup has moved to disable_hook(). Subclasses no longer need to call the parent method unless inheriting from a mixin or another ExtensionHook subclass, but should continue to do so if they need to retain compatibility with older versions.

    Example

    class ThingHook(ExtensionHook, metaclass=ExtensionHookPoint):
        def shutdown(self):
            unregister_thing(self.thing_id)
    
    hooks = []¶
    class UserInfoboxHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    A hook for adding information to the user infobox.

    Extensions can use this hook to add additional pieces of data to the box which pops up when hovering the mouse over a user.

    initialize(template_name=None)[source]¶

    Initialize the hook.

    Parameters:

    template_name (unicode) – The template to render with the default render() method.

    get_extra_context(user, request, local_site, **kwargs)[source]¶

    Return extra context to use when rendering the template.

    This may be overridden in order to make use of the default render() method.

    Parameters:
    • user (django.contrib.auth.models.User) – The user whose infobox is being shown.

    • request (django.http.HttpRequest) – The request for the infobox view.

    • local_site (reviewboard.site.models.LocalSite) – The local site, if any.

    • **kwargs (dict) – Additional keyword arguments.

    Returns:

    Additional context to include when rendering the template.

    Return type:

    dict

    get_etag_data(user, request, local_site, **kwargs)[source]¶

    Return data to be included in the user infobox ETag.

    The infobox view uses an ETag to enable browser caching of the content. If the extension returns data which can change, this method should return a string which is unique to that data.

    Parameters:
    • user (django.contrib.auth.models.User) – The user whose infobox is being shown.

    • request (django.http.HttpRequest) – The request for the infobox view.

    • local_site (reviewboard.site.models.LocalSite) – The local site, if any.

    • **kwargs (dict) – Additional keyword arguments.

    Returns:

    A string to be included in the ETag for the view.

    Return type:

    unicode

    render(user, request, local_site, **kwargs)[source]¶

    Return content to include in the user infobox.

    This may be overridden in the case where providing a custom template and overriding get_extra_context() is insufficient.

    Parameters:
    • user (django.contrib.auth.models.User) – The user whose infobox is being shown.

    • request (django.http.HttpRequest) – The request for the infobox view.

    • local_site (reviewboard.site.models.LocalSite) – The local site, if any.

    • **kwargs (dict) – Additional keyword arguments.

    Returns:

    Text to include in the infobox HTML.

    Return type:

    django.utils.safestring.SafeText

    hooks = []¶
    class UserPageSidebarItemsHook(extension, *args, **kwargs)[source]¶

    Bases: DataGridSidebarItemsHook

    A hook for adding items to the sidebar of the user page.

    Extensions can use this hook to plug new items into the sidebar of the user page. These will appear below the built-in items.

    The items can be any subclass of reviewboard.datagrids.sidebar.BaseSidebarItem, including the built-in reviewboard.datagrids.sidebar.BaseSidebarSection and built-in reviewboard.datagrids.sidebar.SidebarNavItem.

    initialize(item_classes)[source]¶

    Initialize the hook.

    This will register the provided datagrid sidebar item classes in the user page’s datagrid.

    Parameters:

    item_classes (list of type) – The list of item classes to register on the datagrid’s sidebar. Each must be a subclass of BaseSidebarItem.

    class WebAPICapabilitiesHook(extension, *args, **kwargs)[source]¶

    Bases: ExtensionHook

    This hook allows adding capabilities to the web API server info.

    Note that this does not add the functionality, but adds to the server info listing.

    Extensions may only provide one instance of this hook. All capabilities must be registered at once.

    initialize(caps)[source]¶

    Initialize the hook.

    This will register each of the capabilities for the API.

    Parameters:

    caps (dict) – The dictionary of capabilities to register. Each key msut be a string, and each value should be a boolean or a dictionary of string keys to booleans.

    Raises:

    KeyError – Capabilities have already been registered by this extension.

    shutdown()[source]¶

    Shut down the hook.

    This will unregister each of the capabilities from the API.

    hooks = []¶

    Keep up with the latest Review Board releases, security updates, and helpful information.

    About
    News
    Demo
    RBCommons Hosting
    Integrations
    Happy Users
    Support Options
    Documentation
    FAQ
    User Manual
    RBTools
    Administration Guide
    Power Pack
    Release Notes
    Downloads
    Review Board
    RBTools
    Djblets
    Power Pack
    Package Store
    PGP Signatures
    Contributing
    Bug Tracker
    Submit Patches
    Development Setup
    Wiki
    Follow Us
    Mailing Lists
    Reddit
    Twitter
    Mastodon
    Facebook
    YouTube

    Copyright © 2006-2025 Beanbag, Inc. All rights reserved.

    Terms of Service — Privacy Policy — AI Ethics Policy — Branding

    On this page

    • [Top]
    • AccountPageFormsHook
      • AccountPageFormsHook.initialize()
      • AccountPageFormsHook.shutdown()
      • AccountPageFormsHook.hooks
    • AccountPagesHook
      • AccountPagesHook.registry
      • AccountPagesHook.initialize()
      • AccountPagesHook.hooks
    • ActionHook
      • ActionHook.initialize()
      • ActionHook.get_actions()
    • AdminWidgetHook
      • AdminWidgetHook.registry
      • AdminWidgetHook.hooks
    • APIExtraDataAccessHook
      • APIExtraDataAccessHook.initialize()
      • APIExtraDataAccessHook.get_extra_data_state()
      • APIExtraDataAccessHook.shutdown()
      • APIExtraDataAccessHook.hooks
    • AuthBackendHook
      • AuthBackendHook.registry
      • AuthBackendHook.initialize()
      • AuthBackendHook.hooks
    • AvatarServiceHook
      • AvatarServiceHook.registry
      • AvatarServiceHook.initialize()
      • AvatarServiceHook.hooks
    • BaseReviewRequestActionHook
      • BaseReviewRequestActionHook.initialize()
      • BaseReviewRequestActionHook.shutdown()
      • BaseReviewRequestActionHook.convert_action()
      • BaseReviewRequestActionHook.hooks
    • CommentDetailDisplayHook
      • CommentDetailDisplayHook.render_review_comment_detail()
      • CommentDetailDisplayHook.render_email_comment_detail()
      • CommentDetailDisplayHook.hooks
    • ConsentRequirementHook
      • ConsentRequirementHook.registry
      • ConsentRequirementHook.hooks
    • DashboardColumnsHook
      • DashboardColumnsHook.initialize()
    • DashboardSidebarItemsHook
      • DashboardSidebarItemsHook.initialize()
    • DataGridColumnsHook
      • DataGridColumnsHook.initialize()
      • DataGridColumnsHook.shutdown()
      • DataGridColumnsHook.hooks
    • DataGridSidebarItemsHook
      • DataGridSidebarItemsHook.initialize()
      • DataGridSidebarItemsHook.shutdown()
      • DataGridSidebarItemsHook.hooks
    • DiffViewerActionHook
      • DiffViewerActionHook.initialize()
    • EmailHook
      • EmailHook.initialize()
      • EmailHook.shutdown()
      • EmailHook.get_to_field()
      • EmailHook.get_cc_field()
      • EmailHook.hooks
    • ExtensionHook
      • ExtensionHook.extension
      • ExtensionHook.hook_state
      • ExtensionHook.HOOK_STATE_DISABLED
      • ExtensionHook.HOOK_STATE_ENABLED
      • ExtensionHook.HOOK_STATE_DISABLING
      • ExtensionHook.HOOK_STATE_ENABLING
      • ExtensionHook.__init__()
      • ExtensionHook.initialized
      • ExtensionHook.initialize()
      • ExtensionHook.shutdown()
      • ExtensionHook.enable_hook()
      • ExtensionHook.disable_hook()
    • FileAttachmentThumbnailHook
      • FileAttachmentThumbnailHook.initialize()
      • FileAttachmentThumbnailHook.shutdown()
      • FileAttachmentThumbnailHook.hooks
    • FileDiffACLHook
      • FileDiffACLHook.is_accessible()
      • FileDiffACLHook.hooks
    • HeaderActionHook
      • HeaderActionHook.hooks
    • HeaderDropdownActionHook
      • HeaderDropdownActionHook.hooks
    • HostingServiceHook
      • HostingServiceHook.initialize()
      • HostingServiceHook.shutdown()
      • HostingServiceHook.hooks
    • IntegrationHook
      • IntegrationHook.hooks
      • IntegrationHook.integration_cls
    • NavigationBarHook
      • NavigationBarHook.initialize()
      • NavigationBarHook.get_entries()
      • NavigationBarHook.hooks
    • ReviewRequestActionHook
      • ReviewRequestActionHook.initialize()
    • ReviewRequestApprovalHook
      • ReviewRequestApprovalHook.is_approved()
      • ReviewRequestApprovalHook.hooks
    • ReviewRequestClosedEmailHook
      • ReviewRequestClosedEmailHook.initialize()
      • ReviewRequestClosedEmailHook.get_to_field()
      • ReviewRequestClosedEmailHook.get_cc_field()
    • ReviewRequestDropdownActionHook
      • ReviewRequestDropdownActionHook.convert_action()
    • ReviewRequestFieldSetsHook
      • ReviewRequestFieldSetsHook.initialize()
      • ReviewRequestFieldSetsHook.shutdown()
      • ReviewRequestFieldSetsHook.hooks
    • ReviewRequestFieldsHook
      • ReviewRequestFieldsHook.initialize()
      • ReviewRequestFieldsHook.shutdown()
      • ReviewRequestFieldsHook.hooks
    • ReviewRequestPublishedEmailHook
      • ReviewRequestPublishedEmailHook.initialize()
      • ReviewRequestPublishedEmailHook.get_to_field()
      • ReviewRequestPublishedEmailHook.get_cc_field()
    • ReviewPublishedEmailHook
      • ReviewPublishedEmailHook.initialize()
      • ReviewPublishedEmailHook.get_to_field()
      • ReviewPublishedEmailHook.get_cc_field()
    • ReviewReplyPublishedEmailHook
      • ReviewReplyPublishedEmailHook.initialize()
      • ReviewReplyPublishedEmailHook.get_to_field()
      • ReviewReplyPublishedEmailHook.get_cc_field()
    • ReviewUIHook
      • ReviewUIHook.initialize()
      • ReviewUIHook.shutdown()
      • ReviewUIHook.hooks
    • SignalHook
      • SignalHook.initialize()
      • SignalHook.shutdown()
      • SignalHook.hooks
    • TemplateHook
      • TemplateHook.initialize()
      • TemplateHook.shutdown()
      • TemplateHook.render_to_string()
      • TemplateHook.get_extra_context()
      • TemplateHook.by_name()
      • TemplateHook.hooks
    • URLHook
      • URLHook.initialize()
      • URLHook.shutdown()
      • URLHook.hooks
    • UserInfoboxHook
      • UserInfoboxHook.initialize()
      • UserInfoboxHook.get_extra_context()
      • UserInfoboxHook.get_etag_data()
      • UserInfoboxHook.render()
      • UserInfoboxHook.hooks
    • UserPageSidebarItemsHook
      • UserPageSidebarItemsHook.initialize()
    • WebAPICapabilitiesHook
      • WebAPICapabilitiesHook.initialize()
      • WebAPICapabilitiesHook.shutdown()
      • WebAPICapabilitiesHook.hooks