Hi!

  I'am start using reviewboard and need some customizations:
  1) I need hooks run after Submited or Discarded
  2) Add custom footer, change logo, title

  First thing is a way to customize some layoutes. I know how I can do
that now:
  * copy templates from reviewboard to my folder
  * set in my settings_local TEMPLATE_DIRS to my directory and
oryginal directory (for example symlink somewhere inside my instance
created by rb-site)
  but this option have one limitation. Upgrading my ReviewBoard need
to check is modified by me templates doesn't change... hmmm.

  My idea is made some modifications in settings_local which allow not
only overwrite existing settings but modify it.
  My first try looks like:
  settings_local.py
  -----------------------------------------------
  import reviewboard.settings
  TEMPLATE_DIRS = (
      r'/my/custom/dir'
  ) + reviewboard.settings.TEMPLATE_DIRS
  -----------------------------------------------
  but this doesn't have effect. I guess problem in import recursion.
settings_local import settings and settings import settings_local.
Python make it and modify TEMPLATE_DIRS but Django doesn't catch
this.

 So the second shoot is change some ways.
 * settings.py > settings_default.py
 * settings_local.py
 -----------------------------------------------
 from reviewboard.settings_default import *
 [...
 ...
 ...]
 some custom modifications
 * settings.py
 -----------------------------------------------
 try:
     from settings_local import *
 except:
     from default import *

 some neccessery checks and customizations

 This is the way (i think) good enough which provide some features
 1) We have our default values
 2) User can change anything in settings_local. Overwriting is only
one option. There can be also modification! They can add some custom
template directory before templates from reviewboard (and create their
own templates) or not :] Second grate benefit is way to add some
custom plugins (MIDDLEWARE_CLASSES or APPS) which allow to do many
greate things.

  Unfortunetly I don't know how this looks with merging with Django
source tree so :] there is second option (IMHO a little bit worse then
first one)
  At the end add loop which check settings_local under MYRB_PRE_ and
MYRB_POST_ prefixed variables and add/append values to existing once.
  for variable filter(lambda s: s.startswith('MYRB_PRE_'),
dir(settings_local))
      [...]
      globals()[varname] = variable + globals()[varname]
  for variable filter(lambda s: s.startswith('MYRB_POST_'),
dir(settings_local))
      [...]
      globals()[varname] = globals()[varname] + variable

  IMHO first option is much more clear and flexible and bettter
designed then first one. What do You think? I can prepare review for
this concept.

Greetings from Poland!
--
Jan Koprowski

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en

Reply via email to