Changeset - ec7b76d4bda4
[Not reviewed]
default
0 4 0
Marcin Kuzminski - 15 years ago 2010-07-27 14:41:43
marcin@python-works.com
Added initial query skipp when seting up the app.
Added internal server error when deleting user using ajax permission form
removed graph unneded code
4 files changed with 11 insertions and 27 deletions:
0 comments (0 inline, 0 general)
pylons_app/config/environment.py
Show inline comments
 
@@ -12,13 +12,13 @@ import logging
 
import os
 
import pylons_app.lib.app_globals as app_globals
 
import pylons_app.lib.helpers
 

	
 
log = logging.getLogger(__name__)
 

	
 
def load_environment(global_conf, app_conf):
 
def load_environment(global_conf, app_conf, initial=False):
 
    """Configure the Pylons environment via the ``pylons.config``
 
    object
 
    """
 
    config = PylonsConfig()
 
    
 
    # Pylons paths
 
@@ -60,13 +60,13 @@ def load_environment(global_conf, app_co
 
    else:
 
        sa_engine_db1 = engine_from_config(config, 'sqlalchemy.db1.')
 

	
 
    init_model(sa_engine_db1)
 
    config['pylons.app_globals'].baseui = make_ui('db')
 
    
 
    repo2db_mapper(_get_repos_cached_initial(config['pylons.app_globals']))
 
    repo2db_mapper(_get_repos_cached_initial(config['pylons.app_globals'], initial))
 
    set_available_permissions(config)
 
    set_base_path(config)
 
    set_hg_app_config(config)
 
    # CONFIGURATION OPTIONS HERE (note: all config options will override
 
    # any Pylons config options)
 
    
pylons_app/controllers/admin/repos.py
Show inline comments
 
@@ -13,12 +13,17 @@
 
# GNU General Public License for more details.
 
# 
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
# MA  02110-1301, USA.
 
"""
 
Created on April 7, 2010
 
admin controller for pylons
 
@author: marcink
 
"""
 
from formencode import htmlfill
 
from operator import itemgetter
 
from pylons import request, response, session, tmpl_context as c, url
 
from pylons.controllers.util import abort, redirect
 
from pylons.i18n.translation import _
 
from pylons_app.lib import helpers as h
 
@@ -28,17 +33,14 @@ from pylons_app.lib.utils import invalid
 
from pylons_app.model.forms import RepoForm
 
from pylons_app.model.hg_model import HgModel
 
from pylons_app.model.repo_model import RepoModel
 
import formencode
 
import logging
 
import traceback
 
"""
 
Created on April 7, 2010
 
admin controller for pylons
 
@author: marcink
 
"""
 
from paste.httpexceptions import HTTPInternalServerError
 

	
 
log = logging.getLogger(__name__)
 

	
 
class ReposController(BaseController):
 
    """REST Controller styled on the Atom Publishing Protocol"""
 
    # To properly map this controller, ensure your config/routing.py
 
    # file has a resource setup:
 
@@ -127,13 +129,12 @@ class ReposController(BaseController):
 
 
 
        except Exception:
 
            log.error(traceback.format_exc())
 
            h.flash(_('error occured during update of repository %s') \
 
                    % repo_name, category='error')
 
            
 
        
 
        return redirect(url('edit_repo', repo_name=changed_name))
 
    
 
    def delete(self, repo_name):
 
        """DELETE /repos/repo_name: Delete an existing item"""
 
        # Forms posted to this method should contain a hidden field:
 
        #    <input type="hidden" name="_method" value="DELETE" />
 
@@ -171,13 +172,13 @@ class ReposController(BaseController):
 
        try:
 
            repo_model = RepoModel()
 
            repo_model.delete_perm_user(request.POST, repo_name)            
 
        except Exception as e:
 
            h.flash(_('An error occured during deletion of repository user'),
 
                    category='error')
 
        
 
            raise HTTPInternalServerError()
 
        
 
    def show(self, repo_name, format='html'):
 
        """GET /repos/repo_name: Show a specific item"""
 
        # url('repo', repo_name=ID)
 
        
 
    def edit(self, repo_name, format='html'):
pylons_app/controllers/summary.py
Show inline comments
 
@@ -69,38 +69,21 @@ class SummaryController(BaseController):
 

	
 

	
 

	
 
    def __get_commit_stats(self, repo):
 
        aggregate = OrderedDict()
 
        
 
        
 
        #graph range
 
        td = datetime.today() 
 
        y = td.year
 
        m = td.month
 
        d = td.day
 
        c.ts_min = mktime((y, (td - timedelta(days=calendar.mdays[m] - 1)).month, d, 0, 0, 0, 0, 0, 0,))
 
        c.ts_max = mktime((y, m, d, 0, 0, 0, 0, 0, 0,))
 
        
 
        
 
#        #generate this monhts keys
 
#        dates_range = OrderedDict()
 
#        year_range = range(2010, datetime.today().year + 1)
 
#        month_range = range(1, datetime.today().month + 1)
 
#        
 
#
 
#        
 
#        for y in year_range:
 
#            for m in month_range:
 
#                for d in range(1, calendar.mdays[m] + 1):
 
#                    k = '%s-%s-%s' % (y, m, d)
 
#                    timetupple = [int(x) for x in k.split('-')]
 
#                    timetupple.extend([0 for _ in xrange(6)])
 
#                    k = mktime(timetupple)                    
 
#                    dates_range[k] = 0
 
        
 
        def author_key_cleaner(k):
 
            k = person(k)
 
            return k
 
                
 
        for cs in repo:
 
            k = '%s-%s-%s' % (cs.date.timetuple()[0], cs.date.timetuple()[1],
pylons_app/websetup.py
Show inline comments
 
@@ -16,8 +16,8 @@ def setup_app(command, conf, vars):
 
    """Place any commands to setup pylons_app here"""
 
    dbmanage = DbManage(log_sql=True)
 
    dbmanage.create_tables(override=True)
 
    dbmanage.config_prompt()
 
    dbmanage.admin_prompt()
 
    dbmanage.create_permissions()
 
    load_environment(conf.global_conf, conf.local_conf)
 
    load_environment(conf.global_conf, conf.local_conf, initial=True)
 

	
0 comments (0 inline, 0 general)