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

[fix] Enqueue syncing global search #3455

Merged
merged 3 commits into from
Jun 16, 2017
Merged

[fix] Enqueue syncing global search #3455

merged 3 commits into from
Jun 16, 2017

Conversation

pratu16x7
Copy link
Contributor

@pratu16x7 pratu16x7 commented Jun 9, 2017

Enqueueing only the sync_global_search operation, and not update_global_search, and only on a commit, not on every save. The previous code feels shocking in hindsight.

Can implement a buffer that occasionally inserts, in future.

@@ -244,11 +244,13 @@ def get_formatted_value(value, field):
value = ' '.join(value.split())
return field.label + " : " + strip_html_tags(unicode(value))

def sync_global_search():
'''Add values from `frappe.flags.update_global_search` to __global_search.
def sync_global_search(flags = frappe.flags.update_global_search):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11:51:17 web.1            |  * Detected change in '/Users/saurabh/frappe-bench/apps/frappe/frappe/database.py', reloading
11:51:17 web.1            |  * Restarting with fsevents reloader
11:51:18 web.1            | Traceback (most recent call last):
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 91, in <module>
11:51:18 web.1            |     main()
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 12, in main
11:51:18 web.1            |     commands = get_app_groups()
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 24, in get_app_groups
11:51:18 web.1            |     app_commands = get_app_commands(app)
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 63, in get_app_commands
11:51:18 web.1            |     app_command_module = importlib.import_module(app + '.commands')
11:51:18 web.1            |   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
11:51:18 web.1            |     __import__(name)
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 59, in <module>
11:51:18 web.1            |     commands = get_commands()
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 53, in get_commands
11:51:18 web.1            |     from .site import commands as site_commands
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/commands/site.py", line 8, in <module>
11:51:18 web.1            |     from frappe.limits import update_limits, get_limits
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/limits.py", line 5, in <module>
11:51:18 web.1            |     from frappe.installer import update_site_config
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/installer.py", line 11, in <module>
11:51:18 web.1            |     import frappe.database
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/database.py", line 18, in <module>
11:51:18 web.1            |     import frappe.model.meta
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/model/meta.py", line 23, in <module>
11:51:18 web.1            |     from frappe.model.document import Document
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/model/document.py", line 17, in <module>
11:51:18 web.1            |     from frappe.utils.global_search import update_global_search
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/apps/frappe/frappe/utils/global_search.py", line 247, in <module>
11:51:18 web.1            |     def sync_global_search(flags = frappe.flags.update_global_search):
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/env/lib/python2.7/site-packages/werkzeug/local.py", line 338, in __getattr__
11:51:18 web.1            |     return getattr(self._get_current_object(), name)
11:51:18 web.1            |   File "/Users/saurabh/frappe-bench/env/lib/python2.7/site-packages/werkzeug/local.py", line 301, in _get_current_object
11:51:18 web.1            |     raise RuntimeError('no object bound to %s' % self.__name__)
11:51:18 web.1            | RuntimeError: no object bound to flags
11:51:18 system           | web.1 stopped (rc=1)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking bench start

@rmehta
Copy link
Member

rmehta commented Jun 12, 2017

Please do basic testing before sending a PR. Broke my test script and I was scratching my head for an hour!! (since I could not do import frappe) 😅

@frappe-pr-bot
Copy link
Collaborator

Pull Request Summary

Image or animted GIF Not Added

Please add an image or animated GIF as proof that you have manually tested this contribution. Hint: use LiceCAP to capture animated GIFs.

Test Case Not Added / Updated

Since you have changed a Python file, you must update the relevant python test case. If there is no test coverage for this code, then please add it.


Result

  • Passed: Small Pull Request

This summary was automatically generated based on this script

@rmehta rmehta merged commit d8fb2c2 into frappe:develop Jun 16, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants