Fix OctoPrintJsonEncoder to properly work with wrapt, additionally fix a wrong Permission name and combine 2 lines of code
This commit is contained in:
1 parent
120406d115
commit
be2ef79686
3 files changed
+9
-17
No files matched your search
@@ -503,19 +503,10 @@ $(function() {
|
||||
};
|
||||
|
||||
self.update = function(force) {
|
||||
<<<<<<< HEAD
|
||||
if (self.updateInProgress) return;
|
||||
if (!self.loginState.hasPermission(self.access.permissions.SETTINGS)) return;
|
||||
=======
|
||||
if (self.updateInProgress) {
|
||||
if (self.updateInProgress || !self.loginState.hasPermission(self.access.permissions.SETTINGS)) {
|
||||
self._updateClicked = false;
|
||||
return;
|
||||
}
|
||||
if (!self.loginState.isAdmin()) {
|
||||
self._updateClicked = false;
|
||||
return;
|
||||
}
|
||||
>>>>>>> 2e6d65378f21ffa3f2ea00880188f632bac5e102
|
||||
|
||||
if (self.printerState.isPrinting()) {
|
||||
self._showPopup({
|
||||
|
||||
@@ -490,7 +490,7 @@ def gcodeFileCommand(filename, target):
|
||||
|
||||
printAfterLoading = False
|
||||
if "print" in data.keys() and data["print"] in valid_boolean_trues:
|
||||
with Permissions.PRINTING.require(403):
|
||||
with Permissions.PRINT.require(403):
|
||||
if not printer.is_operational():
|
||||
return make_response("Printer is not operational, cannot directly start printing", 409)
|
||||
printAfterLoading = True
|
||||
|
||||
@@ -13,13 +13,14 @@ class OctoPrintJsonEncoder:
|
||||
|
||||
class Encoder(JSONEncoder):
|
||||
def default(self, obj):
|
||||
data_types = type(obj).__mro__
|
||||
if data_types[0] in OctoPrintJsonEncoder.json_encoder:
|
||||
node = OctoPrintJsonEncoder.json_encoder[data_types[0]](obj)
|
||||
for data_type, func in OctoPrintJsonEncoder.json_encoder.items():
|
||||
if isinstance(obj, data_type):
|
||||
node = func(obj)
|
||||
break
|
||||
else:
|
||||
for data_type in data_types:
|
||||
if data_type in OctoPrintJsonEncoder.json_multi_encoder:
|
||||
node = OctoPrintJsonEncoder.json_multi_encoder[data_type](obj)
|
||||
for data_type, func in OctoPrintJsonEncoder.json_multi_encoder.items():
|
||||
if isinstance(obj, data_type):
|
||||
node = func(obj)
|
||||
break
|
||||
else:
|
||||
node = JSONEncoder.default(self, obj)
|
||||
|
||||
Reference in new issue
Block a user