Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when a model object used as a filter, query builder enters into an endless loop #26

Closed
evrenesat opened this issue Dec 6, 2015 · 0 comments
Assignees
Labels

Comments

@evrenesat
Copy link
Contributor

In [1]: from ulakbus.models.hitap import HizmetOkul

In [2]: from ulakbus.models.personel import Personel

In [3]: p = Personel.objects.filter(ad='Mahmut')[0]

In [4]: p
Out[4]: <Personel: Mahmut Can (98765432101 | None)>

In [5]: HizmetOkul.objects.filter(personel=p)[0]
In [1]: from ulakbus.models.personel import Personel
In [2]: from ulakbus.models.hitap import HizmetOkul

In [3]: p = Personel.objects.filter(ad='Per7')[0]

In [4]: p
Out[4]: <Personel: Per7 Selam>

In [5]: HizmetOkul.objects.filter()[0]
Out[5]: <HizmetOkul: 888888888 123131 1231231>

In [6]: HizmetOkul.objects.filter()[1]
Out[6]: <HizmetOkul: 111111 Cupiditate est corrupti temporibus amet doloribus vitae tenetur nostrud velit nisi delectus eos maxime quia consequatur et tempore obcaecati deleniti Consequatur iste sit praesentium provident voluptas est voluptate>

In [7]: HizmetOkul.objects.filter()[1].personel
Out[7]: <LazyModel at 0x7f15a344aa50 wrapping <Personel: Per7 Selam> at 0x7f15a3452b10 with factory <function <lambda> at 0x7f15a3447a28>>

In [8]: HizmetOkul.objects.filter()[0].personel
Out[8]: <LazyModel at 0x7f15a345fc80 wrapping <Personel: Per7 Selam> at 0x7f15a33f1bd0 with factory <function <lambda> at 0x7f15a33ef488>>

In [9]: p = Personel.objects.filter(ad='Per7')[0]

In [10]: p
Out[10]: <Personel: Per7 Selam>

In [11]: HizmetOkul.objects.filter(personel=p)[0]
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-11-019163888efd> in <module>()
----> 1 HizmetOkul.objects.filter(personel=p)[0]

/app/ulakbusenv/local/lib/python2.7/site-packages/pyoko/db/base.pyc in __getitem__(self, index)
    172     def __getitem__(self, index):
    173         if isinstance(index, int):
--> 174             return self.set_params(rows=1, start=index)._get()
    175         elif isinstance(index, slice):
    176             # start, stop, step = index.indices(len(self))

/app/ulakbusenv/local/lib/python2.7/site-packages/pyoko/db/base.pyc in set_params(self, **params)
    428                             "%s %s %s" % (self._solr_query, self._solr_params)
    429                             )
--> 430         clone = copy.deepcopy(self)
    431         clone._solr_params.update(params)
    432         return clone

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    172             copier = getattr(x, "__deepcopy__", None)
    173             if copier:
--> 174                 y = copier(memo)
    175             else:
    176                 reductor = dispatch_table.get(cls)

/app/ulakbusenv/local/lib/python2.7/site-packages/pyoko/db/base.pyc in __deepcopy__(self, memo)
    206                 obj.__dict__[k] = v
    207             else:
--> 208                 obj.__dict__[k] = copy.deepcopy(v, memo)
    209         obj.compiled_query = ''
    210         obj.key = None

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    161     copier = _deepcopy_dispatch.get(cls)
    162     if copier:
--> 163         y = copier(x, memo)
    164     else:
    165         try:

/usr/lib/python2.7/copy.pyc in _deepcopy_list(x, memo)
    228     memo[id(x)] = y
    229     for a in x:
--> 230         y.append(deepcopy(a, memo))
    231     return y
    232 d[list] = _deepcopy_list

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    161     copier = _deepcopy_dispatch.get(cls)
    162     if copier:
--> 163         y = copier(x, memo)
    164     else:
    165         try:

/usr/lib/python2.7/copy.pyc in _deepcopy_tuple(x, memo)
    235     y = []
    236     for a in x:
--> 237         y.append(deepcopy(a, memo))
    238     d = id(x)
    239     try:

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    188                             raise Error(
    189                                 "un(deep)copyable object of type %s" % cls)
--> 190                 y = _reconstruct(x, rv, 1, memo)
    191
    192     memo[d] = y

/usr/lib/python2.7/copy.pyc in _reconstruct(x, info, deep, memo)
    332     if state:
    333         if deep:
--> 334             state = deepcopy(state, memo)
    335         if hasattr(y, '__setstate__'):
    336             y.__setstate__(state)

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    161     copier = _deepcopy_dispatch.get(cls)
    162     if copier:
--> 163         y = copier(x, memo)
    164     else:
    165         try:

/usr/lib/python2.7/copy.pyc in _deepcopy_dict(x, memo)
    255     memo[id(x)] = y
    256     for key, value in x.iteritems():
--> 257         y[deepcopy(key, memo)] = deepcopy(value, memo)
    258     return y
    259 d[dict] = _deepcopy_dict

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    188                             raise Error(
    189                                 "un(deep)copyable object of type %s" % cls)
--> 190                 y = _reconstruct(x, rv, 1, memo)
    191
    192     memo[d] = y

/usr/lib/python2.7/copy.pyc in _reconstruct(x, info, deep, memo)
    332     if state:
    333         if deep:
--> 334             state = deepcopy(state, memo)
    335         if hasattr(y, '__setstate__'):
    336             y.__setstate__(state)

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    161     copier = _deepcopy_dispatch.get(cls)
    162     if copier:
--> 163         y = copier(x, memo)
    164     else:
    165         try:

/usr/lib/python2.7/copy.pyc in _deepcopy_dict(x, memo)
    255     memo[id(x)] = y
    256     for key, value in x.iteritems():
--> 257         y[deepcopy(key, memo)] = deepcopy(value, memo)
    258     return y
    259 d[dict] = _deepcopy_dict

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    188                             raise Error(
    189                                 "un(deep)copyable object of type %s" % cls)
--> 190                 y = _reconstruct(x, rv, 1, memo)
    191
    192     memo[d] = y

/usr/lib/python2.7/copy.pyc in _reconstruct(x, info, deep, memo)
    326         dictiter = None
    327     if deep:
--> 328         args = deepcopy(args, memo)
    329     y = callable(*args)
    330     memo[id(x)] = y

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    161     copier = _deepcopy_dispatch.get(cls)
    162     if copier:
--> 163         y = copier(x, memo)
    164     else:
    165         try:

/usr/lib/python2.7/copy.pyc in _deepcopy_tuple(x, memo)
    235     y = []
    236     for a in x:
--> 237         y.append(deepcopy(a, memo))
    238     d = id(x)
    239     try:

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    188                             raise Error(
    189                                 "un(deep)copyable object of type %s" % cls)
--> 190                 y = _reconstruct(x, rv, 1, memo)
    191
    192     memo[d] = y

/usr/lib/python2.7/copy.pyc in _reconstruct(x, info, deep, memo)
    332     if state:
    333         if deep:
--> 334             state = deepcopy(state, memo)
    335         if hasattr(y, '__setstate__'):
    336             y.__setstate__(state)

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    161     copier = _deepcopy_dispatch.get(cls)
    162     if copier:
--> 163         y = copier(x, memo)
    164     else:
    165         try:

/usr/lib/python2.7/copy.pyc in _deepcopy_dict(x, memo)
    255     memo[id(x)] = y
    256     for key, value in x.iteritems():
--> 257         y[deepcopy(key, memo)] = deepcopy(value, memo)
    258     return y
    259 d[dict] = _deepcopy_dict

/usr/lib/python2.7/copy.pyc in deepcopy(x, memo, _nil)
    188                             raise Error(
    189                                 "un(deep)copyable object of type %s" % cls)
--> 190                 y = _reconstruct(x, rv, 1, memo)
    191
    192     memo[d] = y

/usr/lib/python2.7/copy.pyc in _reconstruct(x, info, deep, memo)
    326         dictiter = None
    327     if deep:
--> 328         args = deepcopy(args, memo)
    329     y = callable(*args)
    330     memo[id(x)] = y
@evrenesat evrenesat added the bug label Dec 6, 2015
@evrenesat evrenesat self-assigned this Dec 6, 2015
evrenesat pushed a commit that referenced this issue Jan 26, 2016
evrenesat added a commit that referenced this issue Feb 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant