Skip to content

Commit

Permalink
API was only handling environment IP configurations in the case that …
Browse files Browse the repository at this point in the history
…there was only 1 entry. Solved.

/environment/configuration/list/120/ 335MEOBBSFWKD3JBR5VTBW ERROR  - Erro não esperado.
Traceback (most recent call last):
  File "/vagrant/networkapi/rest.py", line 88, in handle_request
    response = self.handle_get(request, user, args, **kwargs)
  File "/vagrant/networkapi/ambiente/resource/EnvironmentConfigurationListResource.py", line 52, in handle_get
    self.log.info("teste %s" % configurations_prefix)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 72, in __repr__
    data = list(self[:REPR_OUTPUT_SIZE + 1])
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 87, in __len__
    self._result_cache.extend(self._iter)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 291, in iterator
    for row in compiler.results_iter():
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 763, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 818, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 40, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 114, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
DatabaseError: (1242, 'Subquery returns more than 1 row')
  • Loading branch information
Marcus Vinicius G. Cesario committed May 8, 2015
1 parent 9499cf8 commit 4d3a857
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion networkapi/ambiente/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ def get_by_environment(self, environment_id):
config_environment = ConfigEnvironment.objects.filter(
environment=environment_id).values('ip_config').query

return IPConfig.objects.filter(id=config_environment)
return IPConfig.objects.filter(id__in=config_environment)

return
except ObjectDoesNotExist, e:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# -*- coding:utf-8 -*-

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


from networkapi.admin_permission import AdminPermission
from networkapi.auth import has_perm
Expand Down

0 comments on commit 4d3a857

Please sign in to comment.