##// END OF EJS Templates
fixed missing commit after hook delete
marcink -
r2086:eefb197b beta
parent child Browse files
Show More
@@ -1,557 +1,561 b''
1 1 .. _changelog:
2 2
3 3 Changelog
4 4 =========
5 5
6 6
7 7 1.3.3 (**2012-XX-XX**)
8 8 ----------------------
9 9
10 10 :status: in-progress
11 11 :branch: beta
12 12
13 13 news
14 14 ++++
15 15
16 16
17 17 fixes
18 18 +++++
19 19
20 20 - fixed some python2.5 compatibility issues
21 21 - fixed issues with removed repos was accidentally added as groups, after
22 22 full rescan of paths
23 23 - fixes #376 Cannot edit user (using container auth)
24 24 - fixes #378 Invalid image urls on changeset screen with proxy-prefix
25 25 configuration
26 26 - fixed initial sorting of repos inside repo group
27 27 - fixes issue when user tried to resubmit same permission into user/user_groups
28 - bumped beaker version that fixes #375 leap error bug
29 - fixed raw_changeset for git. It was generated with hg patch headers
30 - fixed vcs issue with last_changeset for filenodes
31 - fixed missing commit after hook delete
28 32
29 33 1.3.2 (**2012-02-28**)
30 34 ----------------------
31 35
32 36 news
33 37 ++++
34 38
35 39
36 40 fixes
37 41 +++++
38 42
39 43 - fixed git protocol issues with repos-groups
40 44 - fixed git remote repos validator that prevented from cloning remote git repos
41 45 - fixes #370 ending slashes fixes for repo and groups
42 46 - fixes #368 improved git-protocol detection to handle other clients
43 47 - fixes #366 When Setting Repository Group To Blank Repo Group Wont Be
44 48 Moved To Root
45 49 - fixes #371 fixed issues with beaker/sqlalchemy and non-ascii cache keys
46 50 - fixed #373 missing cascade drop on user_group_to_perm table
47 51
48 52 1.3.1 (**2012-02-27**)
49 53 ----------------------
50 54
51 55 news
52 56 ++++
53 57
54 58
55 59 fixes
56 60 +++++
57 61
58 62 - redirection loop occurs when remember-me wasn't checked during login
59 63 - fixes issues with git blob history generation
60 64 - don't fetch branch for git in file history dropdown. Causes unneeded slowness
61 65
62 66 1.3.0 (**2012-02-26**)
63 67 ----------------------
64 68
65 69 news
66 70 ++++
67 71
68 72 - code review, inspired by github code-comments
69 73 - #215 rst and markdown README files support
70 74 - #252 Container-based and proxy pass-through authentication support
71 75 - #44 branch browser. Filtering of changelog by branches
72 76 - mercurial bookmarks support
73 77 - new hover top menu, optimized to add maximum size for important views
74 78 - configurable clone url template with possibility to specify protocol like
75 79 ssh:// or http:// and also manually alter other parts of clone_url.
76 80 - enabled largefiles extension by default
77 81 - optimized summary file pages and saved a lot of unused space in them
78 82 - #239 option to manually mark repository as fork
79 83 - #320 mapping of commit authors to RhodeCode users
80 84 - #304 hashes are displayed using monospace font
81 85 - diff configuration, toggle white lines and context lines
82 86 - #307 configurable diffs, whitespace toggle, increasing context lines
83 87 - sorting on branches, tags and bookmarks using YUI datatable
84 88 - improved file filter on files page
85 89 - implements #330 api method for listing nodes ar particular revision
86 90 - #73 added linking issues in commit messages to chosen issue tracker url
87 91 based on user defined regular expression
88 92 - added linking of changesets in commit messages
89 93 - new compact changelog with expandable commit messages
90 94 - firstname and lastname are optional in user creation
91 95 - #348 added post-create repository hook
92 96 - #212 global encoding settings is now configurable from .ini files
93 97 - #227 added repository groups permissions
94 98 - markdown gets codehilite extensions
95 99 - new API methods, delete_repositories, grante/revoke permissions for groups
96 100 and repos
97 101
98 102
99 103 fixes
100 104 +++++
101 105
102 106 - rewrote dbsession management for atomic operations, and better error handling
103 107 - fixed sorting of repo tables
104 108 - #326 escape of special html entities in diffs
105 109 - normalized user_name => username in api attributes
106 110 - fixes #298 ldap created users with mixed case emails created conflicts
107 111 on saving a form
108 112 - fixes issue when owner of a repo couldn't revoke permissions for users
109 113 and groups
110 114 - fixes #271 rare JSON serialization problem with statistics
111 115 - fixes #337 missing validation check for conflicting names of a group with a
112 116 repositories group
113 117 - #340 fixed session problem for mysql and celery tasks
114 118 - fixed #331 RhodeCode mangles repository names if the a repository group
115 119 contains the "full path" to the repositories
116 120 - #355 RhodeCode doesn't store encrypted LDAP passwords
117 121
118 122 1.2.5 (**2012-01-28**)
119 123 ----------------------
120 124
121 125 news
122 126 ++++
123 127
124 128 fixes
125 129 +++++
126 130
127 131 - #340 Celery complains about MySQL server gone away, added session cleanup
128 132 for celery tasks
129 133 - #341 "scanning for repositories in None" log message during Rescan was missing
130 134 a parameter
131 135 - fixed creating archives with subrepos. Some hooks were triggered during that
132 136 operation leading to crash.
133 137 - fixed missing email in account page.
134 138 - Reverted Mercurial to 2.0.1 for windows due to bug in Mercurial that makes
135 139 forking on windows impossible
136 140
137 141 1.2.4 (**2012-01-19**)
138 142 ----------------------
139 143
140 144 news
141 145 ++++
142 146
143 147 - RhodeCode is bundled with mercurial series 2.0.X by default, with
144 148 full support to largefiles extension. Enabled by default in new installations
145 149 - #329 Ability to Add/Remove Groups to/from a Repository via AP
146 150 - added requires.txt file with requirements
147 151
148 152 fixes
149 153 +++++
150 154
151 155 - fixes db session issues with celery when emailing admins
152 156 - #331 RhodeCode mangles repository names if the a repository group
153 157 contains the "full path" to the repositories
154 158 - #298 Conflicting e-mail addresses for LDAP and RhodeCode users
155 159 - DB session cleanup after hg protocol operations, fixes issues with
156 160 `mysql has gone away` errors
157 161 - #333 doc fixes for get_repo api function
158 162 - #271 rare JSON serialization problem with statistics enabled
159 163 - #337 Fixes issues with validation of repository name conflicting with
160 164 a group name. A proper message is now displayed.
161 165 - #292 made ldap_dn in user edit readonly, to get rid of confusion that field
162 166 doesn't work
163 167 - #316 fixes issues with web description in hgrc files
164 168
165 169 1.2.3 (**2011-11-02**)
166 170 ----------------------
167 171
168 172 news
169 173 ++++
170 174
171 175 - added option to manage repos group for non admin users
172 176 - added following API methods for get_users, create_user, get_users_groups,
173 177 get_users_group, create_users_group, add_user_to_users_groups, get_repos,
174 178 get_repo, create_repo, add_user_to_repo
175 179 - implements #237 added password confirmation for my account
176 180 and admin edit user.
177 181 - implements #291 email notification for global events are now sent to all
178 182 administrator users, and global config email.
179 183
180 184 fixes
181 185 +++++
182 186
183 187 - added option for passing auth method for smtp mailer
184 188 - #276 issue with adding a single user with id>10 to usergroups
185 189 - #277 fixes windows LDAP settings in which missing values breaks the ldap auth
186 190 - #288 fixes managing of repos in a group for non admin user
187 191
188 192 1.2.2 (**2011-10-17**)
189 193 ----------------------
190 194
191 195 news
192 196 ++++
193 197
194 198 - #226 repo groups are available by path instead of numerical id
195 199
196 200 fixes
197 201 +++++
198 202
199 203 - #259 Groups with the same name but with different parent group
200 204 - #260 Put repo in group, then move group to another group -> repo becomes unavailable
201 205 - #258 RhodeCode 1.2 assumes egg folder is writable (lockfiles problems)
202 206 - #265 ldap save fails sometimes on converting attributes to booleans,
203 207 added getter and setter into model that will prevent from this on db model level
204 208 - fixed problems with timestamps issues #251 and #213
205 209 - fixes #266 RhodeCode allows to create repo with the same name and in
206 210 the same parent as group
207 211 - fixes #245 Rescan of the repositories on Windows
208 212 - fixes #248 cannot edit repos inside a group on windows
209 213 - fixes #219 forking problems on windows
210 214
211 215 1.2.1 (**2011-10-08**)
212 216 ----------------------
213 217
214 218 news
215 219 ++++
216 220
217 221
218 222 fixes
219 223 +++++
220 224
221 225 - fixed problems with basic auth and push problems
222 226 - gui fixes
223 227 - fixed logger
224 228
225 229 1.2.0 (**2011-10-07**)
226 230 ----------------------
227 231
228 232 news
229 233 ++++
230 234
231 235 - implemented #47 repository groups
232 236 - implemented #89 Can setup google analytics code from settings menu
233 237 - implemented #91 added nicer looking archive urls with more download options
234 238 like tags, branches
235 239 - implemented #44 into file browsing, and added follow branch option
236 240 - implemented #84 downloads can be enabled/disabled for each repository
237 241 - anonymous repository can be cloned without having to pass default:default
238 242 into clone url
239 243 - fixed #90 whoosh indexer can index chooses repositories passed in command
240 244 line
241 245 - extended journal with day aggregates and paging
242 246 - implemented #107 source code lines highlight ranges
243 247 - implemented #93 customizable changelog on combined revision ranges -
244 248 equivalent of githubs compare view
245 249 - implemented #108 extended and more powerful LDAP configuration
246 250 - implemented #56 users groups
247 251 - major code rewrites optimized codes for speed and memory usage
248 252 - raw and diff downloads are now in git format
249 253 - setup command checks for write access to given path
250 254 - fixed many issues with international characters and unicode. It uses utf8
251 255 decode with replace to provide less errors even with non utf8 encoded strings
252 256 - #125 added API KEY access to feeds
253 257 - #109 Repository can be created from external Mercurial link (aka. remote
254 258 repository, and manually updated (via pull) from admin panel
255 259 - beta git support - push/pull server + basic view for git repos
256 260 - added followers page and forks page
257 261 - server side file creation (with binary file upload interface)
258 262 and edition with commits powered by codemirror
259 263 - #111 file browser file finder, quick lookup files on whole file tree
260 264 - added quick login sliding menu into main page
261 265 - changelog uses lazy loading of affected files details, in some scenarios
262 266 this can improve speed of changelog page dramatically especially for
263 267 larger repositories.
264 268 - implements #214 added support for downloading subrepos in download menu.
265 269 - Added basic API for direct operations on rhodecode via JSON
266 270 - Implemented advanced hook management
267 271
268 272 fixes
269 273 +++++
270 274
271 275 - fixed file browser bug, when switching into given form revision the url was
272 276 not changing
273 277 - fixed propagation to error controller on simplehg and simplegit middlewares
274 278 - fixed error when trying to make a download on empty repository
275 279 - fixed problem with '[' chars in commit messages in journal
276 280 - fixed #99 Unicode errors, on file node paths with non utf-8 characters
277 281 - journal fork fixes
278 282 - removed issue with space inside renamed repository after deletion
279 283 - fixed strange issue on formencode imports
280 284 - fixed #126 Deleting repository on Windows, rename used incompatible chars.
281 285 - #150 fixes for errors on repositories mapped in db but corrupted in
282 286 filesystem
283 287 - fixed problem with ascendant characters in realm #181
284 288 - fixed problem with sqlite file based database connection pool
285 289 - whoosh indexer and code stats share the same dynamic extensions map
286 290 - fixes #188 - relationship delete of repo_to_perm entry on user removal
287 291 - fixes issue #189 Trending source files shows "show more" when no more exist
288 292 - fixes issue #197 Relative paths for pidlocks
289 293 - fixes issue #198 password will require only 3 chars now for login form
290 294 - fixes issue #199 wrong redirection for non admin users after creating a repository
291 295 - fixes issues #202, bad db constraint made impossible to attach same group
292 296 more than one time. Affects only mysql/postgres
293 297 - fixes #218 os.kill patch for windows was missing sig param
294 298 - improved rendering of dag (they are not trimmed anymore when number of
295 299 heads exceeds 5)
296 300
297 301 1.1.8 (**2011-04-12**)
298 302 ----------------------
299 303
300 304 news
301 305 ++++
302 306
303 307 - improved windows support
304 308
305 309 fixes
306 310 +++++
307 311
308 312 - fixed #140 freeze of python dateutil library, since new version is python2.x
309 313 incompatible
310 314 - setup-app will check for write permission in given path
311 315 - cleaned up license info issue #149
312 316 - fixes for issues #137,#116 and problems with unicode and accented characters.
313 317 - fixes crashes on gravatar, when passed in email as unicode
314 318 - fixed tooltip flickering problems
315 319 - fixed came_from redirection on windows
316 320 - fixed logging modules, and sql formatters
317 321 - windows fixes for os.kill issue #133
318 322 - fixes path splitting for windows issues #148
319 323 - fixed issue #143 wrong import on migration to 1.1.X
320 324 - fixed problems with displaying binary files, thanks to Thomas Waldmann
321 325 - removed name from archive files since it's breaking ui for long repo names
322 326 - fixed issue with archive headers sent to browser, thanks to Thomas Waldmann
323 327 - fixed compatibility for 1024px displays, and larger dpi settings, thanks to
324 328 Thomas Waldmann
325 329 - fixed issue #166 summary pager was skipping 10 revisions on second page
326 330
327 331
328 332 1.1.7 (**2011-03-23**)
329 333 ----------------------
330 334
331 335 news
332 336 ++++
333 337
334 338 fixes
335 339 +++++
336 340
337 341 - fixed (again) #136 installation support for FreeBSD
338 342
339 343
340 344 1.1.6 (**2011-03-21**)
341 345 ----------------------
342 346
343 347 news
344 348 ++++
345 349
346 350 fixes
347 351 +++++
348 352
349 353 - fixed #136 installation support for FreeBSD
350 354 - RhodeCode will check for python version during installation
351 355
352 356 1.1.5 (**2011-03-17**)
353 357 ----------------------
354 358
355 359 news
356 360 ++++
357 361
358 362 - basic windows support, by exchanging pybcrypt into sha256 for windows only
359 363 highly inspired by idea of mantis406
360 364
361 365 fixes
362 366 +++++
363 367
364 368 - fixed sorting by author in main page
365 369 - fixed crashes with diffs on binary files
366 370 - fixed #131 problem with boolean values for LDAP
367 371 - fixed #122 mysql problems thanks to striker69
368 372 - fixed problem with errors on calling raw/raw_files/annotate functions
369 373 with unknown revisions
370 374 - fixed returned rawfiles attachment names with international character
371 375 - cleaned out docs, big thanks to Jason Harris
372 376
373 377 1.1.4 (**2011-02-19**)
374 378 ----------------------
375 379
376 380 news
377 381 ++++
378 382
379 383 fixes
380 384 +++++
381 385
382 386 - fixed formencode import problem on settings page, that caused server crash
383 387 when that page was accessed as first after server start
384 388 - journal fixes
385 389 - fixed option to access repository just by entering http://server/<repo_name>
386 390
387 391 1.1.3 (**2011-02-16**)
388 392 ----------------------
389 393
390 394 news
391 395 ++++
392 396
393 397 - implemented #102 allowing the '.' character in username
394 398 - added option to access repository just by entering http://server/<repo_name>
395 399 - celery task ignores result for better performance
396 400
397 401 fixes
398 402 +++++
399 403
400 404 - fixed ehlo command and non auth mail servers on smtp_lib. Thanks to
401 405 apollo13 and Johan Walles
402 406 - small fixes in journal
403 407 - fixed problems with getting setting for celery from .ini files
404 408 - registration, password reset and login boxes share the same title as main
405 409 application now
406 410 - fixed #113: to high permissions to fork repository
407 411 - fixed problem with '[' chars in commit messages in journal
408 412 - removed issue with space inside renamed repository after deletion
409 413 - db transaction fixes when filesystem repository creation failed
410 414 - fixed #106 relation issues on databases different than sqlite
411 415 - fixed static files paths links to use of url() method
412 416
413 417 1.1.2 (**2011-01-12**)
414 418 ----------------------
415 419
416 420 news
417 421 ++++
418 422
419 423
420 424 fixes
421 425 +++++
422 426
423 427 - fixes #98 protection against float division of percentage stats
424 428 - fixed graph bug
425 429 - forced webhelpers version since it was making troubles during installation
426 430
427 431 1.1.1 (**2011-01-06**)
428 432 ----------------------
429 433
430 434 news
431 435 ++++
432 436
433 437 - added force https option into ini files for easier https usage (no need to
434 438 set server headers with this options)
435 439 - small css updates
436 440
437 441 fixes
438 442 +++++
439 443
440 444 - fixed #96 redirect loop on files view on repositories without changesets
441 445 - fixed #97 unicode string passed into server header in special cases (mod_wsgi)
442 446 and server crashed with errors
443 447 - fixed large tooltips problems on main page
444 448 - fixed #92 whoosh indexer is more error proof
445 449
446 450 1.1.0 (**2010-12-18**)
447 451 ----------------------
448 452
449 453 news
450 454 ++++
451 455
452 456 - rewrite of internals for vcs >=0.1.10
453 457 - uses mercurial 1.7 with dotencode disabled for maintaining compatibility
454 458 with older clients
455 459 - anonymous access, authentication via ldap
456 460 - performance upgrade for cached repos list - each repository has its own
457 461 cache that's invalidated when needed.
458 462 - performance upgrades on repositories with large amount of commits (20K+)
459 463 - main page quick filter for filtering repositories
460 464 - user dashboards with ability to follow chosen repositories actions
461 465 - sends email to admin on new user registration
462 466 - added cache/statistics reset options into repository settings
463 467 - more detailed action logger (based on hooks) with pushed changesets lists
464 468 and options to disable those hooks from admin panel
465 469 - introduced new enhanced changelog for merges that shows more accurate results
466 470 - new improved and faster code stats (based on pygments lexers mapping tables,
467 471 showing up to 10 trending sources for each repository. Additionally stats
468 472 can be disabled in repository settings.
469 473 - gui optimizations, fixed application width to 1024px
470 474 - added cut off (for large files/changesets) limit into config files
471 475 - whoosh, celeryd, upgrade moved to paster command
472 476 - other than sqlite database backends can be used
473 477
474 478 fixes
475 479 +++++
476 480
477 481 - fixes #61 forked repo was showing only after cache expired
478 482 - fixes #76 no confirmation on user deletes
479 483 - fixes #66 Name field misspelled
480 484 - fixes #72 block user removal when he owns repositories
481 485 - fixes #69 added password confirmation fields
482 486 - fixes #87 RhodeCode crashes occasionally on updating repository owner
483 487 - fixes #82 broken annotations on files with more than 1 blank line at the end
484 488 - a lot of fixes and tweaks for file browser
485 489 - fixed detached session issues
486 490 - fixed when user had no repos he would see all repos listed in my account
487 491 - fixed ui() instance bug when global hgrc settings was loaded for server
488 492 instance and all hgrc options were merged with our db ui() object
489 493 - numerous small bugfixes
490 494
491 495 (special thanks for TkSoh for detailed feedback)
492 496
493 497
494 498 1.0.2 (**2010-11-12**)
495 499 ----------------------
496 500
497 501 news
498 502 ++++
499 503
500 504 - tested under python2.7
501 505 - bumped sqlalchemy and celery versions
502 506
503 507 fixes
504 508 +++++
505 509
506 510 - fixed #59 missing graph.js
507 511 - fixed repo_size crash when repository had broken symlinks
508 512 - fixed python2.5 crashes.
509 513
510 514
511 515 1.0.1 (**2010-11-10**)
512 516 ----------------------
513 517
514 518 news
515 519 ++++
516 520
517 521 - small css updated
518 522
519 523 fixes
520 524 +++++
521 525
522 526 - fixed #53 python2.5 incompatible enumerate calls
523 527 - fixed #52 disable mercurial extension for web
524 528 - fixed #51 deleting repositories don't delete it's dependent objects
525 529
526 530
527 531 1.0.0 (**2010-11-02**)
528 532 ----------------------
529 533
530 534 - security bugfix simplehg wasn't checking for permissions on commands
531 535 other than pull or push.
532 536 - fixed doubled messages after push or pull in admin journal
533 537 - templating and css corrections, fixed repo switcher on chrome, updated titles
534 538 - admin menu accessible from options menu on repository view
535 539 - permissions cached queries
536 540
537 541 1.0.0rc4 (**2010-10-12**)
538 542 --------------------------
539 543
540 544 - fixed python2.5 missing simplejson imports (thanks to Jens BΓ€ckman)
541 545 - removed cache_manager settings from sqlalchemy meta
542 546 - added sqlalchemy cache settings to ini files
543 547 - validated password length and added second try of failure on paster setup-app
544 548 - fixed setup database destroy prompt even when there was no db
545 549
546 550
547 551 1.0.0rc3 (**2010-10-11**)
548 552 -------------------------
549 553
550 554 - fixed i18n during installation.
551 555
552 556 1.0.0rc2 (**2010-10-11**)
553 557 -------------------------
554 558
555 559 - Disabled dirsize in file browser, it's causing nasty bug when dir renames
556 560 occure. After vcs is fixed it'll be put back again.
557 561 - templating/css rewrites, optimized css. No newline at end of file
@@ -1,414 +1,414 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.controllers.admin.settings
4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 settings controller for rhodecode admin
7 7
8 8 :created_on: Jul 14, 2010
9 9 :author: marcink
10 10 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
11 11 :license: GPLv3, see COPYING for more details.
12 12 """
13 13 # This program is free software: you can redistribute it and/or modify
14 14 # it under the terms of the GNU General Public License as published by
15 15 # the Free Software Foundation, either version 3 of the License, or
16 16 # (at your option) any later version.
17 17 #
18 18 # This program is distributed in the hope that it will be useful,
19 19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 21 # GNU General Public License for more details.
22 22 #
23 23 # You should have received a copy of the GNU General Public License
24 24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 25
26 26 import logging
27 27 import traceback
28 28 import formencode
29 29
30 30 from sqlalchemy import func
31 31 from formencode import htmlfill
32 32 from pylons import request, session, tmpl_context as c, url, config
33 33 from pylons.controllers.util import abort, redirect
34 34 from pylons.i18n.translation import _
35 35
36 36 from rhodecode.lib import helpers as h
37 37 from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator, \
38 38 HasPermissionAnyDecorator, NotAnonymous
39 39 from rhodecode.lib.base import BaseController, render
40 40 from rhodecode.lib.celerylib import tasks, run_task
41 41 from rhodecode.lib.utils import repo2db_mapper, invalidate_cache, \
42 42 set_rhodecode_config, repo_name_slug
43 43 from rhodecode.model.db import RhodeCodeUi, Repository, RepoGroup, \
44 44 RhodeCodeSetting
45 45 from rhodecode.model.forms import UserForm, ApplicationSettingsForm, \
46 46 ApplicationUiSettingsForm
47 47 from rhodecode.model.scm import ScmModel
48 48 from rhodecode.model.user import UserModel
49 49 from rhodecode.model.db import User
50 50 from rhodecode.model.notification import EmailNotificationModel
51 51 from rhodecode.model.meta import Session
52 52
53 53 log = logging.getLogger(__name__)
54 54
55 55
56 56 class SettingsController(BaseController):
57 57 """REST Controller styled on the Atom Publishing Protocol"""
58 58 # To properly map this controller, ensure your config/routing.py
59 59 # file has a resource setup:
60 60 # map.resource('setting', 'settings', controller='admin/settings',
61 61 # path_prefix='/admin', name_prefix='admin_')
62 62
63 63 @LoginRequired()
64 64 def __before__(self):
65 65 c.admin_user = session.get('admin_user')
66 66 c.admin_username = session.get('admin_username')
67 67 super(SettingsController, self).__before__()
68 68
69 69 @HasPermissionAllDecorator('hg.admin')
70 70 def index(self, format='html'):
71 71 """GET /admin/settings: All items in the collection"""
72 72 # url('admin_settings')
73 73
74 74 defaults = RhodeCodeSetting.get_app_settings()
75 75 defaults.update(self.get_hg_ui_settings())
76 76 return htmlfill.render(
77 77 render('admin/settings/settings.html'),
78 78 defaults=defaults,
79 79 encoding="UTF-8",
80 80 force_defaults=False
81 81 )
82 82
83 83 @HasPermissionAllDecorator('hg.admin')
84 84 def create(self):
85 85 """POST /admin/settings: Create a new item"""
86 86 # url('admin_settings')
87 87
88 88 @HasPermissionAllDecorator('hg.admin')
89 89 def new(self, format='html'):
90 90 """GET /admin/settings/new: Form to create a new item"""
91 91 # url('admin_new_setting')
92 92
93 93 @HasPermissionAllDecorator('hg.admin')
94 94 def update(self, setting_id):
95 95 """PUT /admin/settings/setting_id: Update an existing item"""
96 96 # Forms posted to this method should contain a hidden field:
97 97 # <input type="hidden" name="_method" value="PUT" />
98 98 # Or using helpers:
99 99 # h.form(url('admin_setting', setting_id=ID),
100 100 # method='put')
101 101 # url('admin_setting', setting_id=ID)
102 102 if setting_id == 'mapping':
103 103 rm_obsolete = request.POST.get('destroy', False)
104 104 log.debug('Rescanning directories with destroy=%s' % rm_obsolete)
105 105 initial = ScmModel().repo_scan()
106 106 log.debug('invalidating all repositories')
107 107 for repo_name in initial.keys():
108 108 invalidate_cache('get_repo_cached_%s' % repo_name)
109 109
110 110 added, removed = repo2db_mapper(initial, rm_obsolete)
111 111
112 112 h.flash(_('Repositories successfully'
113 113 ' rescanned added: %s,removed: %s') % (added, removed),
114 114 category='success')
115 115
116 116 if setting_id == 'whoosh':
117 117 repo_location = self.get_hg_ui_settings()['paths_root_path']
118 118 full_index = request.POST.get('full_index', False)
119 119 run_task(tasks.whoosh_index, repo_location, full_index)
120 120
121 121 h.flash(_('Whoosh reindex task scheduled'), category='success')
122 122 if setting_id == 'global':
123 123
124 124 application_form = ApplicationSettingsForm()()
125 125 try:
126 126 form_result = application_form.to_python(dict(request.POST))
127 127
128 128 try:
129 129 hgsettings1 = RhodeCodeSetting.get_by_name('title')
130 130 hgsettings1.app_settings_value = \
131 131 form_result['rhodecode_title']
132 132
133 133 hgsettings2 = RhodeCodeSetting.get_by_name('realm')
134 134 hgsettings2.app_settings_value = \
135 135 form_result['rhodecode_realm']
136 136
137 137 hgsettings3 = RhodeCodeSetting.get_by_name('ga_code')
138 138 hgsettings3.app_settings_value = \
139 139 form_result['rhodecode_ga_code']
140 140
141 141 self.sa.add(hgsettings1)
142 142 self.sa.add(hgsettings2)
143 143 self.sa.add(hgsettings3)
144 144 self.sa.commit()
145 145 set_rhodecode_config(config)
146 146 h.flash(_('Updated application settings'),
147 147 category='success')
148 148
149 149 except Exception:
150 150 log.error(traceback.format_exc())
151 151 h.flash(_('error occurred during updating '
152 152 'application settings'),
153 153 category='error')
154 154
155 155 self.sa.rollback()
156 156
157 157 except formencode.Invalid, errors:
158 158 return htmlfill.render(
159 159 render('admin/settings/settings.html'),
160 160 defaults=errors.value,
161 161 errors=errors.error_dict or {},
162 162 prefix_error=False,
163 163 encoding="UTF-8")
164 164
165 165 if setting_id == 'mercurial':
166 166 application_form = ApplicationUiSettingsForm()()
167 167 try:
168 168 form_result = application_form.to_python(dict(request.POST))
169 169
170 170 try:
171 171
172 172 hgsettings1 = self.sa.query(RhodeCodeUi)\
173 173 .filter(RhodeCodeUi.ui_key == 'push_ssl').one()
174 174 hgsettings1.ui_value = form_result['web_push_ssl']
175 175
176 176 hgsettings2 = self.sa.query(RhodeCodeUi)\
177 177 .filter(RhodeCodeUi.ui_key == '/').one()
178 178 hgsettings2.ui_value = form_result['paths_root_path']
179 179
180 180 #HOOKS
181 181 hgsettings3 = self.sa.query(RhodeCodeUi)\
182 182 .filter(RhodeCodeUi.ui_key == 'changegroup.update').one()
183 183 hgsettings3.ui_active = \
184 184 bool(form_result['hooks_changegroup_update'])
185 185
186 186 hgsettings4 = self.sa.query(RhodeCodeUi)\
187 187 .filter(RhodeCodeUi.ui_key ==
188 188 'changegroup.repo_size').one()
189 189 hgsettings4.ui_active = \
190 190 bool(form_result['hooks_changegroup_repo_size'])
191 191
192 192 hgsettings5 = self.sa.query(RhodeCodeUi)\
193 193 .filter(RhodeCodeUi.ui_key ==
194 194 'pretxnchangegroup.push_logger').one()
195 195 hgsettings5.ui_active = \
196 196 bool(form_result['hooks_pretxnchangegroup'
197 197 '_push_logger'])
198 198
199 199 hgsettings6 = self.sa.query(RhodeCodeUi)\
200 200 .filter(RhodeCodeUi.ui_key ==
201 201 'preoutgoing.pull_logger').one()
202 202 hgsettings6.ui_active = \
203 203 bool(form_result['hooks_preoutgoing_pull_logger'])
204 204
205 205 self.sa.add(hgsettings1)
206 206 self.sa.add(hgsettings2)
207 207 self.sa.add(hgsettings3)
208 208 self.sa.add(hgsettings4)
209 209 self.sa.add(hgsettings5)
210 210 self.sa.add(hgsettings6)
211 211 self.sa.commit()
212 212
213 213 h.flash(_('Updated mercurial settings'),
214 214 category='success')
215 215
216 216 except:
217 217 log.error(traceback.format_exc())
218 218 h.flash(_('error occurred during updating '
219 219 'application settings'), category='error')
220 220
221 221 self.sa.rollback()
222 222
223 223 except formencode.Invalid, errors:
224 224 return htmlfill.render(
225 225 render('admin/settings/settings.html'),
226 226 defaults=errors.value,
227 227 errors=errors.error_dict or {},
228 228 prefix_error=False,
229 229 encoding="UTF-8")
230 230
231 231 if setting_id == 'hooks':
232 232 ui_key = request.POST.get('new_hook_ui_key')
233 233 ui_value = request.POST.get('new_hook_ui_value')
234 234 try:
235 235
236 236 if ui_value and ui_key:
237 237 RhodeCodeUi.create_or_update_hook(ui_key, ui_value)
238 238 h.flash(_('Added new hook'),
239 239 category='success')
240 240
241 241 # check for edits
242 242 update = False
243 243 _d = request.POST.dict_of_lists()
244 244 for k, v in zip(_d.get('hook_ui_key', []),
245 245 _d.get('hook_ui_value_new', [])):
246 246 RhodeCodeUi.create_or_update_hook(k, v)
247 247 update = True
248 248
249 249 if update:
250 250 h.flash(_('Updated hooks'), category='success')
251 Session.commit()
251 self.sa.commit()
252 252 except:
253 253 log.error(traceback.format_exc())
254 254 h.flash(_('error occurred during hook creation'),
255 255 category='error')
256 256
257 257 return redirect(url('admin_edit_setting', setting_id='hooks'))
258 258
259 259 if setting_id == 'email':
260 260 test_email = request.POST.get('test_email')
261 261 test_email_subj = 'RhodeCode TestEmail'
262 262 test_email_body = 'RhodeCode Email test'
263 263
264 264 test_email_html_body = EmailNotificationModel()\
265 265 .get_email_tmpl(EmailNotificationModel.TYPE_DEFAULT,
266 266 body=test_email_body)
267 267
268 268 recipients = [test_email] if [test_email] else None
269 269
270 270 run_task(tasks.send_email, recipients, test_email_subj,
271 271 test_email_body, test_email_html_body)
272 272
273 273 h.flash(_('Email task created'), category='success')
274 274 return redirect(url('admin_settings'))
275 275
276 276 @HasPermissionAllDecorator('hg.admin')
277 277 def delete(self, setting_id):
278 278 """DELETE /admin/settings/setting_id: Delete an existing item"""
279 279 # Forms posted to this method should contain a hidden field:
280 280 # <input type="hidden" name="_method" value="DELETE" />
281 281 # Or using helpers:
282 282 # h.form(url('admin_setting', setting_id=ID),
283 283 # method='delete')
284 284 # url('admin_setting', setting_id=ID)
285 285 if setting_id == 'hooks':
286 286 hook_id = request.POST.get('hook_id')
287 287 RhodeCodeUi.delete(hook_id)
288
288 self.sa.commit()
289 289
290 290 @HasPermissionAllDecorator('hg.admin')
291 291 def show(self, setting_id, format='html'):
292 292 """
293 293 GET /admin/settings/setting_id: Show a specific item"""
294 294 # url('admin_setting', setting_id=ID)
295 295
296 296 @HasPermissionAllDecorator('hg.admin')
297 297 def edit(self, setting_id, format='html'):
298 298 """
299 299 GET /admin/settings/setting_id/edit: Form to
300 300 edit an existing item"""
301 301 # url('admin_edit_setting', setting_id=ID)
302 302
303 303 c.hooks = RhodeCodeUi.get_builtin_hooks()
304 304 c.custom_hooks = RhodeCodeUi.get_custom_hooks()
305 305
306 306 return htmlfill.render(
307 307 render('admin/settings/hooks.html'),
308 308 defaults={},
309 309 encoding="UTF-8",
310 310 force_defaults=False
311 311 )
312 312
313 313 @NotAnonymous()
314 314 def my_account(self):
315 315 """
316 316 GET /_admin/my_account Displays info about my account
317 317 """
318 318 # url('admin_settings_my_account')
319 319
320 320 c.user = User.get(self.rhodecode_user.user_id)
321 321 all_repos = self.sa.query(Repository)\
322 322 .filter(Repository.user_id == c.user.user_id)\
323 323 .order_by(func.lower(Repository.repo_name)).all()
324 324
325 325 c.user_repos = ScmModel().get_repos(all_repos)
326 326
327 327 if c.user.username == 'default':
328 328 h.flash(_("You can't edit this user since it's"
329 329 " crucial for entire application"), category='warning')
330 330 return redirect(url('users'))
331 331
332 332 defaults = c.user.get_dict()
333 333 return htmlfill.render(
334 334 render('admin/users/user_edit_my_account.html'),
335 335 defaults=defaults,
336 336 encoding="UTF-8",
337 337 force_defaults=False
338 338 )
339 339
340 340 def my_account_update(self):
341 341 """PUT /_admin/my_account_update: Update an existing item"""
342 342 # Forms posted to this method should contain a hidden field:
343 343 # <input type="hidden" name="_method" value="PUT" />
344 344 # Or using helpers:
345 345 # h.form(url('admin_settings_my_account_update'),
346 346 # method='put')
347 347 # url('admin_settings_my_account_update', id=ID)
348 348 user_model = UserModel()
349 349 uid = self.rhodecode_user.user_id
350 350 _form = UserForm(edit=True,
351 351 old_data={'user_id': uid,
352 352 'email': self.rhodecode_user.email})()
353 353 form_result = {}
354 354 try:
355 355 form_result = _form.to_python(dict(request.POST))
356 356 user_model.update_my_account(uid, form_result)
357 357 h.flash(_('Your account was updated successfully'),
358 358 category='success')
359 359 Session.commit()
360 360 except formencode.Invalid, errors:
361 361 c.user = User.get(self.rhodecode_user.user_id)
362 362 all_repos = self.sa.query(Repository)\
363 363 .filter(Repository.user_id == c.user.user_id)\
364 364 .order_by(func.lower(Repository.repo_name))\
365 365 .all()
366 366 c.user_repos = ScmModel().get_repos(all_repos)
367 367
368 368 return htmlfill.render(
369 369 render('admin/users/user_edit_my_account.html'),
370 370 defaults=errors.value,
371 371 errors=errors.error_dict or {},
372 372 prefix_error=False,
373 373 encoding="UTF-8")
374 374 except Exception:
375 375 log.error(traceback.format_exc())
376 376 h.flash(_('error occurred during update of user %s') \
377 377 % form_result.get('username'), category='error')
378 378
379 379 return redirect(url('my_account'))
380 380
381 381 @NotAnonymous()
382 382 @HasPermissionAnyDecorator('hg.admin', 'hg.create.repository')
383 383 def create_repository(self):
384 384 """GET /_admin/create_repository: Form to create a new item"""
385 385
386 386 c.repo_groups = RepoGroup.groups_choices()
387 387 c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups)
388 388
389 389 new_repo = request.GET.get('repo', '')
390 390 c.new_repo = repo_name_slug(new_repo)
391 391
392 392 return render('admin/repos/repo_add_create_repository.html')
393 393
394 394 def get_hg_ui_settings(self):
395 395 ret = self.sa.query(RhodeCodeUi).all()
396 396
397 397 if not ret:
398 398 raise Exception('Could not get application ui settings !')
399 399 settings = {}
400 400 for each in ret:
401 401 k = each.ui_key
402 402 v = each.ui_value
403 403 if k == '/':
404 404 k = 'root_path'
405 405
406 406 if k.find('.') != -1:
407 407 k = k.replace('.', '_')
408 408
409 409 if each.ui_section == 'hooks':
410 410 v = each.ui_active
411 411
412 412 settings[each.ui_section + '_' + k] = v
413 413
414 414 return settings
General Comments 0
You need to be logged in to leave comments. Login now