diff --git a/brewman/brewman/__init__.py b/brewman/brewman/__init__.py index 57a5e630..9c192643 100644 --- a/brewman/brewman/__init__.py +++ b/brewman/brewman/__init__.py @@ -120,6 +120,8 @@ def main(global_config, **settings): config.add_route('profit_loss', '/ProfitLoss') config.add_route('purchase_entries', '/PurchaseEntries') + config.add_route('auth', '/Auth') + config.add_route('services_session_current_date', '/Services/CurrentDate') config.add_route('services_session_period_start', '/Services/PeriodStart') config.add_route('services_session_period_finish', '/Services/PeriodFinish') @@ -137,7 +139,6 @@ def main(global_config, **settings): config.add_route('services_product_add_inventory', '/Services/AddInventory') config.add_route('services_batch_list', '/Services/Batches') - config.add_route('user_permissions', '/Permissions') config.add_route('account_type_list', '/AccountTypes') config.add_route('voucher', '/Voucher/{id}') diff --git a/brewman/brewman/factories.py b/brewman/brewman/factories.py index 13bad604..197b3977 100644 --- a/brewman/brewman/factories.py +++ b/brewman/brewman/factories.py @@ -11,7 +11,6 @@ class RootFactory(object): (Allow, Authenticated, 'post')] for permission in Role.list(): acl.append((Allow, permission.name, permission.name)) - print(acl) return acl def __init__(self, request): pass \ No newline at end of file diff --git a/brewman/brewman/helpers.py b/brewman/brewman/helpers.py deleted file mode 100644 index dc2f5170..00000000 --- a/brewman/brewman/helpers.py +++ /dev/null @@ -1,283 +0,0 @@ -import string - -from brewman.views.nav_bar import login_menu, report_menu, voucher_menu, entry_menu, employee_menu, master_menu - -class Form(object): - """Make absolute URL from the relative one. - """ - def __init__(self, action, method = "post"): - self.text = "
" - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class CssLink(object): - """Make absolute URL from the relative one. - """ - def __init__(self, request, file, media = "screen"): - self.text = "" - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class JsLink(object): - """Make absolute URL from the relative one. - """ - def __init__(self, request, file): - if file.startswith("http"): - self.text = "" - else: - self.text = "" - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class ScriptLink(object): - """Make absolute URL from the relative one. - """ - def __init__(self, request, file): - if file.startswith("http"): - self.text = "" - else: - self.text = "" - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class Span(object): - def __init__(self, text, css_class = ""): - if len(css_class) > 0: - css_class = "class=\"{0}\"".format(css_class) - self.text = "{1}".format(css_class, text) - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class Label(object): - def __init__(self, text, label_for, css_class = ""): - if len(css_class) > 0: - css_class = "class=\"{0}\"".format(css_class) - self.text = "".format(label_for, css_class, text) - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class TextInput(object): - def __init__(self, name, id = None, value="", css_class = "", required = "", disabled = "", placeholder = "", autocomplete = ""): - if id is None: - id = name - if len(css_class) > 0: - css_class = " class=\"{0}\"".format(css_class) - - disabled = disabled.lower() - if disabled == 'disabled' or disabled == 'true' or disabled == 1 or disabled == 'yes': - disabled = ' disabled=\"disabled\"' - else: - disabled = '' - - if len(placeholder) > 0: - placeholder = ' placeholder=\"{0}\"'.format(placeholder) - - autocomplete = autocomplete.lower() - if len(autocomplete) > 0 and (autocomplete == 'off' or autocomplete == 'disabled' or autocomplete == 0 or autocomplete == 'false'): - autocomplete = ' autocomplete=\"off\"' - else: - autocomplete = '' - - required = required.lower() - if len(required) > 0 and (required == 'required' or required == 'true' or requred == 1 or required == 'yes'): - required = ' required' - else: - required = '' - if value == "": - value = " " - else: - value = " value=\"{0}\"".format(value) - self.text = "".format(name, id, css_class, required, value, disabled, placeholder, autocomplete) - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class CheckBoxInput(object): - def __init__(self, name, id = None, value = False, css_class = ""): - if id is None: - id = name - if len(css_class) > 0: - css_class = " class=\"{0}\"".format(css_class) - if value: - value = " checked=\"checked\"" - else: - value = " " - self.text = "".format(name, id, css_class, value) - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class Password(object): - def __init__(self, name, id = None, css_class = "", required = "", placeholder = ""): - if id is None: - id = name - if len(css_class) > 0: - css_class = " class=\"{0}\"".format(css_class) - required = required.lower() - if len(required) > 0 and (required == 'required' or required == 'true' or requred == 1 or required == 'yes'): - required = ' required' - else: - required = '' - if len(placeholder) > 0: - placeholder = ' placeholder=\"{0}\"'.format(placeholder) - - self.text = "".format(name, id, css_class, required, placeholder) - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class SubmitButton(object): - def __init__(self, id, text, css_class = ""): - if len(css_class) > 0: - css_class = " class=\"{0}\"".format(css_class) - self.text = "".format(id, text, css_class) - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class SelectInput(object): - def __init__(self, name, id = None, list = None, displayField = "", valueField = "", defaultValue = "", css_class = ""): - if id is None: - id = name - if len(css_class) > 0: - css_class = " class=\"{0}\"".format(css_class) - options = '' - if not list is None: - for item in list: - if type(item) == dict: - display = item[displayField] - value = item[valueField] - else: - display = getattr(item, displayField) - value = getattr(item, valueField) - selected = '' - if value == defaultValue: - selected = ' selected' - options += "".format(str(value), selected, display) - - self.text = "".format(name, id, css_class, options) - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class HiddenInput(object): - def __init__(self, id, value=""): - if not value == "": - value = " value=\"{0}\"".format(value) - self.text = "".format(id, value) - - def __str__(self): - return self.text - - __unicode__ = __str__ - - def __html__(self): - return self.text - -class Literal(object): - def __init__(self, s): - self.s = s - - def __html__(self): - return self.s \ No newline at end of file diff --git a/brewman/brewman/models/auth.py b/brewman/brewman/models/auth.py index 187fc19f..5c59ba8a 100644 --- a/brewman/brewman/models/auth.py +++ b/brewman/brewman/models/auth.py @@ -77,7 +77,7 @@ class User(Base): @classmethod def get_by_name(cls, name): - return DBSession.query(cls).filter(cls.name == name).one() + return DBSession.query(cls).filter(cls.name == name).first() @classmethod def get_by_id(cls, id): diff --git a/brewman/brewman/security.py b/brewman/brewman/security.py index 1148c044..c614acb2 100644 --- a/brewman/brewman/security.py +++ b/brewman/brewman/security.py @@ -1,5 +1,4 @@ import uuid -from pyramid.security import Allow, ALL_PERMISSIONS from brewman.models.auth import User class VoucherFactory(object): @@ -25,7 +24,6 @@ def groupfinder(user_id, request): perms.append(perm.name) perms = f7(perms) request.session['perms'] = perms - print(perms) return perms diff --git a/brewman/brewman/static/js/angular-1.0.1.js b/brewman/brewman/static/js/angular-1.0.2.js similarity index 98% rename from brewman/brewman/static/js/angular-1.0.1.js rename to brewman/brewman/static/js/angular-1.0.2.js index 2e63152e..0e4138b1 100644 --- a/brewman/brewman/static/js/angular-1.0.1.js +++ b/brewman/brewman/static/js/angular-1.0.2.js @@ -1,5 +1,5 @@ /** - * @license AngularJS v1.0.1 + * @license AngularJS v1.0.2 * (c) 2010-2012 Google, Inc. http://angularjs.org * License: MIT */ @@ -1178,7 +1178,7 @@ function setupModuleLoader(window) { * @param {Function} directiveFactory Factory function for creating new instance of * directives. * @description - * See {@link ng.$compileProvider.directive $compileProvider.directive()}. + * See {@link ng.$compileProvider#directive $compileProvider.directive()}. */ directive: invokeLater('$compileProvider', 'directive'), @@ -1247,11 +1247,11 @@ function setupModuleLoader(window) { * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". */ var version = { - full: '1.0.1', // all of these placeholder strings will be replaced by rake's + full: '1.0.2', // all of these placeholder strings will be replaced by rake's major: 1, // compile task minor: 0, - dot: 1, - codeName: 'thorium-shielding' + dot: 2, + codeName: 'debilitating-awesomeness' }; @@ -1529,7 +1529,7 @@ function JQLite(element) { var div = document.createElement('div'); // Read about the NoScope elements here: // http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx - div.innerHTML = 'ngBind which will match as
* ng-bind).
* @param {function} directiveFactory An injectable directive factroy function. See {@link guide/directive} for more
* info.
+ * @returns {ng.$compileProvider} Self for chaining.
*/
this.directive = function registerDirective(name, directiveFactory) {
if (isString(name)) {
@@ -3720,6 +3707,15 @@ function $CompileProvider($provide) {
}
};
+ var startSymbol = $interpolate.startSymbol(),
+ endSymbol = $interpolate.endSymbol(),
+ denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}')
+ ? identity
+ : function denormalizeTemplate(template) {
+ return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
+ };
+
+
return compile;
//================================
@@ -3733,7 +3729,7 @@ function $CompileProvider($provide) {
// not be able to attach scope data to them, so we will wrap them in
forEach($compileNode, function(node, index){
if (node.nodeType == 3 /* text node */) {
- $compileNode[index] = jqLite(node).wrap('').parent()[0];
+ $compileNode[index] = jqLite(node).wrap('').parent()[0];
}
});
var compositeLinkFn = compileNodes($compileNode, transcludeFn, $compileNode, maxPriority);
@@ -3999,14 +3995,17 @@ function $CompileProvider($provide) {
}
}
- if (directiveValue = directive.template) {
+ if ((directiveValue = directive.template)) {
assertNoDuplicate('template', templateDirective, directive, $compileNode);
templateDirective = directive;
-
- $template = jqLite('Reload this page with open console, enter text and hit the log button...
- Message: - - - - - -Reload this page with open console, enter text and hit the log button...
+ Message: + + + + + +