rer.solrpush 1.3.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. rer/solrpush/__init__.py +7 -0
  2. rer/solrpush/adapters/__init__.py +1 -0
  3. rer/solrpush/adapters/configure.zcml +13 -0
  4. rer/solrpush/adapters/file.py +52 -0
  5. rer/solrpush/adapters/rss_feed.py +28 -0
  6. rer/solrpush/behaviors/__init__.py +0 -0
  7. rer/solrpush/behaviors/configure.zcml +16 -0
  8. rer/solrpush/behaviors/solr_fields.py +41 -0
  9. rer/solrpush/browser/__init__.py +0 -0
  10. rer/solrpush/browser/configure.zcml +111 -0
  11. rer/solrpush/browser/controlpanel.py +96 -0
  12. rer/solrpush/browser/elevate_settings.py +35 -0
  13. rer/solrpush/browser/maintenance.py +476 -0
  14. rer/solrpush/browser/query_debug.py +12 -0
  15. rer/solrpush/browser/querybuilder.py +168 -0
  16. rer/solrpush/browser/scales.py +80 -0
  17. rer/solrpush/browser/static/.gitkeep +0 -0
  18. rer/solrpush/browser/static/dist/dev/main.js +58240 -0
  19. rer/solrpush/browser/static/dist/dev/main.js.map +180 -0
  20. rer/solrpush/browser/static/dist/prod/main.js +9604 -0
  21. rer/solrpush/browser/static/dist/prod/main.js.map +1 -0
  22. rer/solrpush/browser/static/javascripts/FacetsContainer/index.js +46 -0
  23. rer/solrpush/browser/static/javascripts/ProgressBar/index.js +40 -0
  24. rer/solrpush/browser/static/javascripts/ProgressBarContainer/index.js +66 -0
  25. rer/solrpush/browser/static/javascripts/index.js +14 -0
  26. rer/solrpush/browser/static/package.json +13 -0
  27. rer/solrpush/browser/static/styles.css +22 -0
  28. rer/solrpush/browser/static/styles.css.map +1 -0
  29. rer/solrpush/browser/static/styles.scss +27 -0
  30. rer/solrpush/browser/static/yarn.lock +1408 -0
  31. rer/solrpush/browser/templates/controlpanel_layout.pt +49 -0
  32. rer/solrpush/browser/templates/query_debug.pt +17 -0
  33. rer/solrpush/browser/templates/reindex_solr.pt +35 -0
  34. rer/solrpush/configure.zcml +81 -0
  35. rer/solrpush/indexer.py +120 -0
  36. rer/solrpush/interfaces/__init__.py +8 -0
  37. rer/solrpush/interfaces/adapter.py +13 -0
  38. rer/solrpush/interfaces/elevate.py +98 -0
  39. rer/solrpush/interfaces/layer.py +6 -0
  40. rer/solrpush/interfaces/queueprocessor.py +6 -0
  41. rer/solrpush/interfaces/settings.py +194 -0
  42. rer/solrpush/locales/README.rst +37 -0
  43. rer/solrpush/locales/__init__.py +0 -0
  44. rer/solrpush/locales/en/LC_MESSAGES/rer.solrpush.mo +0 -0
  45. rer/solrpush/locales/en/LC_MESSAGES/rer.solrpush.po +399 -0
  46. rer/solrpush/locales/it/LC_MESSAGES/rer.solrpush.mo +0 -0
  47. rer/solrpush/locales/it/LC_MESSAGES/rer.solrpush.po +399 -0
  48. rer/solrpush/locales/rer.solrpush.pot +402 -0
  49. rer/solrpush/locales/update.py +71 -0
  50. rer/solrpush/locales/update.sh +12 -0
  51. rer/solrpush/parser.py +211 -0
  52. rer/solrpush/permissions.zcml +18 -0
  53. rer/solrpush/profiles/default/actions.xml +21 -0
  54. rer/solrpush/profiles/default/browserlayer.xml +7 -0
  55. rer/solrpush/profiles/default/catalog.xml +4 -0
  56. rer/solrpush/profiles/default/controlpanel.xml +31 -0
  57. rer/solrpush/profiles/default/metadata.xml +8 -0
  58. rer/solrpush/profiles/default/registry/bundle.xml +25 -0
  59. rer/solrpush/profiles/default/registry/criteria.xml +55 -0
  60. rer/solrpush/profiles/default/registry/settings.xml +6 -0
  61. rer/solrpush/profiles/default/rolemap.xml +13 -0
  62. rer/solrpush/profiles/default/types/Document.xml +12 -0
  63. rer/solrpush/profiles/to_1100/componentregistry.xml +9 -0
  64. rer/solrpush/profiles/to_1100/metadata.xml +5 -0
  65. rer/solrpush/profiles/to_1300/controlpanel.xml +13 -0
  66. rer/solrpush/profiles/to_1300/registry.xml +5 -0
  67. rer/solrpush/profiles/uninstall/browserlayer.xml +7 -0
  68. rer/solrpush/profiles/uninstall/controlpanel.xml +21 -0
  69. rer/solrpush/profiles/uninstall/registry.xml +17 -0
  70. rer/solrpush/restapi/__init__.py +0 -0
  71. rer/solrpush/restapi/configure.zcml +8 -0
  72. rer/solrpush/restapi/services/__init__.py +0 -0
  73. rer/solrpush/restapi/services/configure.zcml +8 -0
  74. rer/solrpush/restapi/services/elevate_schema/__init__.py +0 -0
  75. rer/solrpush/restapi/services/elevate_schema/configure.zcml +14 -0
  76. rer/solrpush/restapi/services/elevate_schema/get.py +12 -0
  77. rer/solrpush/restapi/services/solr_search/__init__.py +0 -0
  78. rer/solrpush/restapi/services/solr_search/batch.py +129 -0
  79. rer/solrpush/restapi/services/solr_search/configure.zcml +14 -0
  80. rer/solrpush/restapi/services/solr_search/get.py +25 -0
  81. rer/solrpush/restapi/services/solr_search/solr_search_handler.py +86 -0
  82. rer/solrpush/setuphandlers.py +20 -0
  83. rer/solrpush/testing.py +161 -0
  84. rer/solrpush/tests/__init__.py +0 -0
  85. rer/solrpush/tests/docs/example.docx +0 -0
  86. rer/solrpush/tests/docs/example.ods +0 -0
  87. rer/solrpush/tests/docs/example.pdf +0 -0
  88. rer/solrpush/tests/docs/plone_logo.png +0 -0
  89. rer/solrpush/tests/test_behaviors.py +61 -0
  90. rer/solrpush/tests/test_elevate.py +124 -0
  91. rer/solrpush/tests/test_events.py +181 -0
  92. rer/solrpush/tests/test_image_tags.py +85 -0
  93. rer/solrpush/tests/test_maintenance.py +165 -0
  94. rer/solrpush/tests/test_querybuilder.py +272 -0
  95. rer/solrpush/tests/test_restapi_search.py +127 -0
  96. rer/solrpush/tests/test_search.py +177 -0
  97. rer/solrpush/tests/test_setup.py +67 -0
  98. rer/solrpush/tests/test_solr_interface.py +359 -0
  99. rer/solrpush/tests/test_tika.py +85 -0
  100. rer/solrpush/tests/test_vocabularies.py +113 -0
  101. rer/solrpush/upgrades.py +76 -0
  102. rer/solrpush/upgrades.zcml +86 -0
  103. rer/solrpush/utils/__init__.py +6 -0
  104. rer/solrpush/utils/solr_common.py +122 -0
  105. rer/solrpush/utils/solr_indexer.py +295 -0
  106. rer/solrpush/utils/solr_search.py +352 -0
  107. rer/solrpush/vocabularies.py +50 -0
  108. rer.solrpush-1.3.4-py3.10-nspkg.pth +1 -0
  109. rer.solrpush-1.3.4.dist-info/LICENSE.GPL +339 -0
  110. rer.solrpush-1.3.4.dist-info/LICENSE.rst +15 -0
  111. rer.solrpush-1.3.4.dist-info/METADATA +507 -0
  112. rer.solrpush-1.3.4.dist-info/RECORD +116 -0
  113. rer.solrpush-1.3.4.dist-info/WHEEL +5 -0
  114. rer.solrpush-1.3.4.dist-info/entry_points.txt +5 -0
  115. rer.solrpush-1.3.4.dist-info/namespace_packages.txt +1 -0
  116. rer.solrpush-1.3.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,402 @@
1
+ # --- PLEASE EDIT THE LINES BELOW CORRECTLY ---
2
+ # SOME DESCRIPTIVE TITLE.
3
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
+ msgid ""
5
+ msgstr ""
6
+ "Project-Id-Version: PACKAGE VERSION\n"
7
+ "POT-Creation-Date: 2021-12-14 12:39+0000\n"
8
+ "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
9
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
10
+ "Language-Team: LANGUAGE <LL@li.org>\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=utf-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+ "Plural-Forms: nplurals=1; plural=0\n"
15
+ "Language-Code: en\n"
16
+ "Language-Name: English\n"
17
+ "Preferred-Encodings: utf-8 latin1\n"
18
+ "Domain: rer.solrpush\n"
19
+
20
+ #: rer/solrpush/profiles/default/registry/criteria.xml
21
+ msgid "A complete list of keywords stored in SOLR."
22
+ msgstr ""
23
+
24
+ #: rer/solrpush/profiles/default/registry/criteria.xml
25
+ msgid "A complete list of portal_types stored in SOLR."
26
+ msgstr ""
27
+
28
+ #: rer/solrpush/profiles/default/registry/criteria.xml
29
+ msgid "A list of (SOLR indexed) sites where search items."
30
+ msgstr ""
31
+
32
+ #: rer/solrpush/interfaces/settings.py:45
33
+ msgid "Active"
34
+ msgstr ""
35
+
36
+ #: rer/solrpush/browser/controlpanel.py:74
37
+ msgid "Cancel"
38
+ msgstr ""
39
+
40
+ #: rer/solrpush/browser/controlpanel.py:62
41
+ msgid "Changes saved."
42
+ msgstr ""
43
+
44
+ #: rer/solrpush/profiles/default/actions.xml
45
+ msgid "Elevate configuration"
46
+ msgstr ""
47
+
48
+ #: rer/solrpush/interfaces/settings.py:46
49
+ msgid "Enable SOLR indexing on this site."
50
+ msgstr ""
51
+
52
+ #: rer/solrpush/behaviors/configure.zcml:14
53
+ msgid "Extra fields for Solr indexing"
54
+ msgstr ""
55
+
56
+ #: rer/solrpush/interfaces/settings.py:52
57
+ msgid "Force commit"
58
+ msgstr ""
59
+
60
+ #: rer/solrpush/interfaces/settings.py:53
61
+ msgid "Force commits on CRUD operations. If enabled, each indexing operation to SOLR will be immediately committed and persisted. This means that updates are immediately available on SOLR queries.If you are using SolrCloud with ZooKeeper, immediate commits will slow down response performances when indexing, so it's better to turn it off. In this case updates will be available when SOLR periodically commit changes."
62
+ msgstr ""
63
+
64
+ #: rer/solrpush/interfaces/settings.py:73
65
+ msgid "Frontend url"
66
+ msgstr ""
67
+
68
+ #: rer/solrpush/browser/templates/reindex_solr.pt:9
69
+ msgid "Go back"
70
+ msgstr ""
71
+
72
+ #: rer/solrpush/interfaces/settings.py:119
73
+ msgid "If enabled, when a search to SOLR is performed (for example in Collection), the query will be showed in the page for debug. Only visible to Managers."
74
+ msgstr ""
75
+
76
+ #: rer/solrpush/interfaces/settings.py:74
77
+ msgid "If the website has different URL for frontend users."
78
+ msgstr ""
79
+
80
+ #: rer/solrpush/configure.zcml:26
81
+ msgid "Installs the rer.solrpush add-on."
82
+ msgstr ""
83
+
84
+ #: rer/solrpush/profiles/default/registry/criteria.xml
85
+ msgid "Keywords in SOLR"
86
+ msgstr ""
87
+
88
+ #: rer/solrpush/browser/controlpanel.py:70
89
+ msgid "Loaded schema.xml from SOLR"
90
+ msgstr ""
91
+
92
+ #: rer/solrpush/utils/solr_common.py:87
93
+ msgid "No SOLR url provided"
94
+ msgstr ""
95
+
96
+ #: rer/solrpush/profiles/default/registry/criteria.xml
97
+ msgid "Portal types in SOLR"
98
+ msgstr ""
99
+
100
+ #: rer/solrpush/interfaces/settings.py:118
101
+ msgid "Query debug"
102
+ msgstr ""
103
+
104
+ #: rer/solrpush/configure.zcml:26
105
+ msgid "RER: Solr push"
106
+ msgstr ""
107
+
108
+ #: rer/solrpush/configure.zcml:35
109
+ msgid "RER: Solr push (uninstall)"
110
+ msgstr ""
111
+
112
+ #: rer/solrpush/configure.zcml:43
113
+ msgid "RER: Solr push remove persistent utility"
114
+ msgstr ""
115
+
116
+ #: rer/solrpush/configure.zcml:51
117
+ msgid "RER: Solr push remove unused control panel"
118
+ msgstr ""
119
+
120
+ #: rer/solrpush/interfaces/settings.py:109
121
+ msgid "Ready"
122
+ msgstr ""
123
+
124
+ #: rer/solrpush/browser/controlpanel.py:78
125
+ msgid "Reload schema.xml"
126
+ msgstr ""
127
+
128
+ #: rer/solrpush/browser/controlpanel.py:89
129
+ msgid "Reloaded schema.xml from SOLR"
130
+ msgstr ""
131
+
132
+ #: rer/solrpush/profiles/default/registry/criteria.xml
133
+ msgid "SOLR"
134
+ msgstr ""
135
+
136
+ #: rer/solrpush/interfaces/settings.py:110
137
+ msgid "SOLR push is ready to be used."
138
+ msgstr ""
139
+
140
+ #: rer/solrpush/interfaces/settings.py:67
141
+ msgid "SOLR url"
142
+ msgstr ""
143
+
144
+ #: rer/solrpush/browser/controlpanel.py:55
145
+ msgid "Save"
146
+ msgstr ""
147
+
148
+ #: rer/solrpush/profiles/default/registry/criteria.xml
149
+ msgid "Search with Solr"
150
+ msgstr ""
151
+
152
+ #: rer/solrpush/profiles/default/registry/criteria.xml
153
+ msgid "Sites"
154
+ msgstr ""
155
+
156
+ #: rer/solrpush/browser/controlpanel.py:42
157
+ msgid "Solr Push Configuration"
158
+ msgstr ""
159
+
160
+ #: rer/solrpush/behaviors/configure.zcml:14
161
+ msgid "Solr additional fields"
162
+ msgstr ""
163
+
164
+ #: rer/solrpush/interfaces/settings.py:68
165
+ msgid "The SOLR core to connect to."
166
+ msgstr ""
167
+
168
+ #: rer/solrpush/configure.zcml:35
169
+ msgid "Uninstalls the rer.solrpush add-on."
170
+ msgstr ""
171
+
172
+ #. Default: "Set a list of functions (with optional boosts) that will be used to construct FunctionQueries which will be added to the main query as optional clauses that will influence the score. Any function supported natively by Solr can be used, along with a boost value. For example if we want to give less relevance to items deeper in the tree we can set something like this: recip(path_depth,10,100,1)"
173
+ #: rer/solrpush/interfaces/settings.py:168
174
+ msgid "bf_help"
175
+ msgstr ""
176
+
177
+ #. Default: "bf (boost functions)"
178
+ #: rer/solrpush/interfaces/settings.py:167
179
+ msgid "bf_label"
180
+ msgstr ""
181
+
182
+ #. Default: "Set a list query clauses that will be added to the main query to influence the score. For example if we want to boost results that have a specific \"searchwords\" term: searchwords:something^1000"
183
+ #: rer/solrpush/interfaces/settings.py:155
184
+ msgid "bq_help"
185
+ msgstr ""
186
+
187
+ #. Default: "bq (boost query)"
188
+ #: rer/solrpush/interfaces/settings.py:154
189
+ msgid "bq_label"
190
+ msgstr ""
191
+
192
+ #. Default: "Cancel"
193
+ #: rer/solrpush/browser/maintenance.py:73
194
+ msgid "cancel_label"
195
+ msgstr ""
196
+
197
+ #. Default: "There was a problem indexing or unindexing this content. Please take note of this address and contact site administrator."
198
+ #: rer/solrpush/indexer.py:92
199
+ msgid "content_indexed_error"
200
+ msgstr ""
201
+
202
+ #. Default: "There was a problem removing this content from SOLR. Please contact site administrator."
203
+ #: rer/solrpush/utils/solr_indexer.py:275
204
+ msgid "content_remove_error"
205
+ msgstr ""
206
+
207
+ #. Default: "The word that should match in the search."
208
+ #: rer/solrpush/interfaces/elevate.py:30
209
+ #: rer/solrpush/interfaces/settings.py:23
210
+ msgid "elevate_row_schema_text_help"
211
+ msgstr ""
212
+
213
+ #. Default: "Text"
214
+ #: rer/solrpush/interfaces/elevate.py:29
215
+ #: rer/solrpush/interfaces/settings.py:22
216
+ msgid "elevate_row_schema_text_label"
217
+ msgstr ""
218
+
219
+ #. Default: "Select a list of elements to elevate for that search word."
220
+ #: rer/solrpush/interfaces/elevate.py:39
221
+ #: rer/solrpush/interfaces/settings.py:31
222
+ msgid "elevate_row_schema_uid_help"
223
+ msgstr ""
224
+
225
+ #. Default: "Elements"
226
+ #: rer/solrpush/interfaces/elevate.py:38
227
+ #: rer/solrpush/interfaces/settings.py:30
228
+ msgid "elevate_row_schema_uid_label"
229
+ msgstr ""
230
+
231
+ #. Default: "Insert a list of values for elevate."
232
+ #: rer/solrpush/interfaces/elevate.py:58
233
+ msgid "elevate_schema_help"
234
+ msgstr ""
235
+
236
+ #. Default: "Elevate configuration"
237
+ #: rer/solrpush/interfaces/elevate.py:57
238
+ msgid "elevate_schema_label"
239
+ msgstr ""
240
+
241
+ #. Default: "Select a list of portal types to index in solr. Empty list means that all portal types will be indexed."
242
+ #: rer/solrpush/interfaces/settings.py:80
243
+ msgid "enabled_types_help"
244
+ msgstr ""
245
+
246
+ #. Default: "Enabled portal types"
247
+ #: rer/solrpush/interfaces/settings.py:79
248
+ msgid "enabled_types_label"
249
+ msgstr ""
250
+
251
+ #. Default: "Return to configuration"
252
+ #: rer/solrpush/browser/templates/reindex_solr.pt:9
253
+ msgid "go_to_controlpanel"
254
+ msgstr ""
255
+
256
+ #. Default: "Specify words for which this item will show up as the first search result. Multiple words can be specified on new lines."
257
+ #: rer/solrpush/behaviors/solr_fields.py:32
258
+ msgid "help_searchwords"
259
+ msgstr ""
260
+
261
+ #: rer/solrpush/behaviors/solr_fields.py:23
262
+ msgid "help_showinsearch"
263
+ msgstr ""
264
+
265
+ #. Default: "We store this list for performance reasons. If the configuration changes, you need to click on Reload button"
266
+ #: rer/solrpush/interfaces/settings.py:99
267
+ msgid "index_fields_help"
268
+ msgstr ""
269
+
270
+ #. Default: "List of fields loaded from SOLR that we use for indexing."
271
+ #: rer/solrpush/interfaces/settings.py:94
272
+ msgid "index_fields_label"
273
+ msgstr ""
274
+
275
+ #. Default: "Search words"
276
+ #: rer/solrpush/behaviors/solr_fields.py:30
277
+ msgid "label_searchwords"
278
+ msgstr ""
279
+
280
+ #. Default: "Show in search"
281
+ #: rer/solrpush/behaviors/solr_fields.py:22
282
+ msgid "label_showinsearch"
283
+ msgstr ""
284
+
285
+ #. Default: "Action cancelled"
286
+ #: rer/solrpush/browser/maintenance.py:75
287
+ msgid "maintenance_cancel_action"
288
+ msgstr ""
289
+
290
+ #. Default: "Get all Plone contents and reindex them on SOLR."
291
+ #: rer/solrpush/browser/maintenance.py:462
292
+ msgid "maintenance_reindex_help"
293
+ msgstr ""
294
+
295
+ #. Default: "Reindex SOLR"
296
+ #: rer/solrpush/browser/maintenance.py:461
297
+ msgid "maintenance_reindex_label"
298
+ msgstr ""
299
+
300
+ #. Default: "Drop all items in SOLR index."
301
+ #: rer/solrpush/browser/maintenance.py:88
302
+ msgid "maintenance_reset_solr_description"
303
+ msgstr ""
304
+
305
+ #. Default: "Reset SOLR index"
306
+ #: rer/solrpush/browser/maintenance.py:87
307
+ msgid "maintenance_reset_solr_label"
308
+ msgstr ""
309
+
310
+ #. Default: "SOLR index dropped"
311
+ #: rer/solrpush/browser/maintenance.py:95
312
+ msgid "maintenance_reset_success"
313
+ msgstr ""
314
+
315
+ #. Default: "Remove no more existing contents from SOLR and sync with Plone."
316
+ #: rer/solrpush/browser/maintenance.py:472
317
+ msgid "maintenance_sync_help"
318
+ msgstr ""
319
+
320
+ #. Default: "Sync SOLR"
321
+ #: rer/solrpush/browser/maintenance.py:471
322
+ msgid "maintenance_sync_label"
323
+ msgstr ""
324
+
325
+ #. Default: "Set a list of fields, each of which is assigned a boost factor to increase or decrease that particular field’s importance in the query. For example: fieldOne^1000.0 fieldTwo fieldThree^10.0"
326
+ #: rer/solrpush/interfaces/settings.py:143
327
+ msgid "qf_help"
328
+ msgstr ""
329
+
330
+ #. Default: "qf (query fields)"
331
+ #: rer/solrpush/interfaces/settings.py:142
332
+ msgid "qf_label"
333
+ msgstr ""
334
+
335
+ #. Default: "SOLR push is not active. Unable to sync with solr."
336
+ #: rer/solrpush/browser/templates/reindex_solr.pt:26
337
+ msgid "reindex_solr_not_active"
338
+ msgstr ""
339
+
340
+ #. Default: "If this field is set and no \"site_name\" is passed in query, elevate schema is taken from an external source. This is useful if you index several sites and handle elevate configuration in one single site. This should be an url that points to \"@elevate-schema\" view.For example: http://my-site/@elevate-schema."
341
+ #: rer/solrpush/interfaces/settings.py:129
342
+ msgid "remote_elevate_help"
343
+ msgstr ""
344
+
345
+ #. Default: "Remote elevate"
346
+ #: rer/solrpush/interfaces/settings.py:128
347
+ msgid "remote_elevate_label"
348
+ msgstr ""
349
+
350
+ #. Default: "Unable to perform a search with SOLR. Please contact the site administrator or wait some minutes."
351
+ #: rer/solrpush/utils/solr_search.py:325
352
+ msgid "search_error_label"
353
+ msgstr ""
354
+
355
+ #. Default: "Settings"
356
+ #: rer/solrpush/browser/controlpanel.py:22
357
+ msgid "settings_default_label"
358
+ msgstr ""
359
+
360
+ #. Default: "Sono presenti degli errori, si prega di ricontrollare i dati inseriti"
361
+ #: rer/solrpush/browser/controlpanel.py:44
362
+ msgid "settings_form_error"
363
+ msgstr ""
364
+
365
+ #. Default: "Use these settings to tweak search results."
366
+ #: rer/solrpush/browser/controlpanel.py:28
367
+ msgid "settings_search_help"
368
+ msgstr ""
369
+
370
+ #. Default: "Search"
371
+ #: rer/solrpush/browser/controlpanel.py:27
372
+ msgid "settings_search_label"
373
+ msgstr ""
374
+
375
+ #: rer/solrpush/utils/solr_search.py:306
376
+ msgid "solr_configuration_error_label"
377
+ msgstr ""
378
+
379
+ #. Default: "Solr Push Elevate Configuration"
380
+ #: rer/solrpush/browser/elevate_settings.py:15
381
+ msgid "solr_elevate_configuration_label"
382
+ msgstr ""
383
+
384
+ #. Default: "There have been problems connecting to SOLR. Contact site administrator."
385
+ #: rer/solrpush/browser/maintenance.py:109
386
+ msgid "solr_error_connection"
387
+ msgstr ""
388
+
389
+ #. Default: "Start"
390
+ #: rer/solrpush/browser/maintenance.py:65
391
+ msgid "start_label"
392
+ msgstr ""
393
+
394
+ #. Default: "\"${text}\" is used in several groups."
395
+ #: rer/solrpush/interfaces/elevate.py:91
396
+ msgid "text_duplicated_label"
397
+ msgstr ""
398
+
399
+ #. Default: "Text field must be filled for Group ${id}."
400
+ #: rer/solrpush/interfaces/elevate.py:75
401
+ msgid "text_required_label"
402
+ msgstr ""
@@ -0,0 +1,71 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ import os
4
+ import pkg_resources
5
+ import subprocess
6
+
7
+
8
+ domain = "rer.solrpush"
9
+ os.chdir(pkg_resources.resource_filename(domain, ""))
10
+ os.chdir("../../../")
11
+ target_path = "src/rer/solrpush/"
12
+ locale_path = target_path + "locales/"
13
+ i18ndude = "./bin/i18ndude"
14
+
15
+
16
+ def locale_folder_setup():
17
+ os.chdir(locale_path)
18
+ languages = [d for d in os.listdir(".") if os.path.isdir(d)]
19
+ for lang in languages:
20
+ folder = os.listdir(lang)
21
+ if "LC_MESSAGES" in folder:
22
+ continue
23
+ else:
24
+ lc_messages_path = lang + "/LC_MESSAGES/"
25
+ os.mkdir(lc_messages_path)
26
+ cmd = "msginit --locale={0} --input={1}.pot --output={2}/LC_MESSAGES/{3}.po".format( # NOQA: E501
27
+ lang,
28
+ domain,
29
+ lang,
30
+ domain,
31
+ )
32
+ subprocess.call(
33
+ cmd,
34
+ shell=True,
35
+ )
36
+
37
+ os.chdir("../../../../")
38
+
39
+
40
+ def _rebuild():
41
+ cmd = "{0} rebuild-pot --pot {1}/{2}.pot --create {3} {4}".format(
42
+ i18ndude,
43
+ locale_path,
44
+ domain,
45
+ domain,
46
+ target_path,
47
+ )
48
+ subprocess.call(
49
+ cmd,
50
+ shell=True,
51
+ )
52
+
53
+
54
+ def _sync():
55
+ cmd = "{0} sync --pot {1}/{2}.pot {3}*/LC_MESSAGES/{4}.po".format(
56
+ i18ndude,
57
+ locale_path,
58
+ domain,
59
+ locale_path,
60
+ domain,
61
+ )
62
+ subprocess.call(
63
+ cmd,
64
+ shell=True,
65
+ )
66
+
67
+
68
+ def update_locale():
69
+ locale_folder_setup()
70
+ _sync()
71
+ _rebuild()
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+ # i18ndude should be available in current $PATH (eg by running
3
+ # ``export PATH=$PATH:$BUILDOUT_DIR/bin`` when i18ndude is located in your buildout's bin directory)
4
+ #
5
+ # For every language you want to translate into you need a
6
+ # locales/[language]/LC_MESSAGES/rer.solrpush.po
7
+ # (e.g. locales/de/LC_MESSAGES/rer.solrpush.po)
8
+
9
+ domain=rer.solrpush
10
+
11
+ i18ndude rebuild-pot --pot $domain.pot --create $domain ../
12
+ i18ndude sync --pot $domain.pot */LC_MESSAGES/$domain.po
rer/solrpush/parser.py ADDED
@@ -0,0 +1,211 @@
1
+ # -*- coding: utf-8 -*-
2
+ from datetime import datetime
3
+ from DateTime import DateTime
4
+ from plone import api
5
+ from Products.MimetypesRegistry.MimeTypeItem import guess_icon_path
6
+ from rer.solrpush.browser.scales import SolrScalesHandler
7
+ from rer.solrpush.interfaces.adapter import ISolrBrain
8
+ from rer.solrpush.interfaces.settings import IRerSolrpushSettings
9
+ from rer.solrpush.utils.solr_indexer import get_index_fields
10
+ from rer.solrpush.utils.solr_indexer import get_site_title
11
+ from zope.globalrequest import getRequest
12
+ from zope.interface import implementer
13
+
14
+ try:
15
+ from ZTUtils.Lazy import Lazy
16
+ except ImportError:
17
+ from Products.ZCatalog.Lazy import Lazy
18
+
19
+ try:
20
+ from design.plone.theme.interfaces import IDesignPloneThemeLayer
21
+
22
+ HAS_RER_THEME = True
23
+ except ImportError:
24
+ HAS_RER_THEME = False
25
+
26
+ import os
27
+ import six
28
+
29
+ timezone = DateTime().timezone()
30
+
31
+
32
+ @implementer(ISolrBrain)
33
+ class Brain(dict):
34
+ """a dictionary with attribute access"""
35
+
36
+ def __repr__(self):
37
+ return "<SolrBrain for {}>".format(self.getPath())
38
+
39
+ def __getattr__(self, name):
40
+ """look up attributes in dict"""
41
+ marker = []
42
+ value = self.get(name, marker)
43
+ schema = get_index_fields()
44
+ if value is not marker:
45
+ field_schema = schema.get(name, {})
46
+ if field_schema.get("type", "") == "date":
47
+ # dates are stored in SOLR as UTC
48
+ value = DateTime(value).toZone(timezone)
49
+ return value
50
+ else:
51
+ if name not in schema:
52
+ raise AttributeError(name)
53
+
54
+ def __init__(self, context, request=None):
55
+ self.context = context
56
+ self.request = request
57
+ self.update(context) # copy data
58
+
59
+ @property
60
+ def is_current_site(self):
61
+ return self.get("site_name", "") == get_site_title()
62
+
63
+ @property
64
+ def id(self):
65
+ """convenience alias"""
66
+ return self.get("id", self.get("getId"))
67
+
68
+ @property
69
+ def Description(self):
70
+ return self.get("description", "")
71
+
72
+ def absolute_url(self):
73
+ """convenience alias"""
74
+ return self.getUrl()
75
+
76
+ @property
77
+ def Date(self):
78
+ if self.EffectiveDate().startswith("1969"):
79
+ return self.CreationDate()
80
+ return self.EffectiveDate()
81
+
82
+ def getId(self):
83
+ return self.id
84
+
85
+ def getPath(self):
86
+ """convenience alias"""
87
+
88
+ return self.get("path", "")
89
+
90
+ def getObject(self, REQUEST=None, restricted=True):
91
+ if self.is_current_site:
92
+ path = self.getPath()
93
+ if six.PY2:
94
+ path = path.encode("utf-8")
95
+ return api.content.get(path)
96
+ return self
97
+
98
+ def _unrestrictedGetObject(self):
99
+ raise NotImplementedError
100
+
101
+ def getURL(self, relative=False):
102
+ """
103
+ If site_name is the current site, convert the physical path into a url, if it was stored.
104
+ Else return url attribute stored in SOLR
105
+ """
106
+ url = self.get("url", "")
107
+ if self.is_current_site:
108
+ frontend_url = api.portal.get_registry_record(
109
+ "frontend_url", interface=IRerSolrpushSettings, default=""
110
+ )
111
+ if frontend_url:
112
+ return url.replace(
113
+ frontend_url.rstrip("/"), api.portal.get().portal_url()
114
+ )
115
+ return url
116
+
117
+ def Creator(self):
118
+ return self.get("Creator", "")
119
+
120
+ def review_state(self):
121
+ return self.get("review_state", "")
122
+
123
+ def PortalType(self):
124
+ return self.get("portal_type", "")
125
+
126
+ def CreationDate(self):
127
+ return self.get("created", None)
128
+
129
+ def EffectiveDate(self):
130
+ return self.get("effective", None)
131
+
132
+ def location(self):
133
+ return self.get("location", "")
134
+
135
+ def ModificationDate(self):
136
+ value = self.get("ModificationDate", None)
137
+ if not value:
138
+ return None
139
+ return DateTime(value).toZone(timezone)
140
+
141
+ def Subject(self):
142
+ return self.get("Subject", [])
143
+
144
+ def MimeTypeIcon(self):
145
+ mime_type = self.get("mime_type", None)
146
+ if not mime_type:
147
+ return ""
148
+ mtt = api.portal.get_tool(name="mimetypes_registry")
149
+ navroot_url = api.portal.get().absolute_url()
150
+ ctype = mtt.lookup(mime_type)
151
+ mimeicon = None
152
+ if not ctype:
153
+ if HAS_RER_THEME:
154
+ if IDesignPloneThemeLayer.providedBy(self.request):
155
+ mimeicon = os.path.join(
156
+ navroot_url,
157
+ "++plone++design.plone.theme/icons/default.svg",
158
+ )
159
+ else:
160
+ mimeicon = os.path.join(navroot_url, guess_icon_path(ctype[0]))
161
+ return mimeicon
162
+
163
+ def restrictedTraverse(self, name):
164
+ if name == "@@images":
165
+ return SolrScalesHandler(self, getRequest())
166
+ return None
167
+
168
+
169
+ class SolrResults(list):
170
+ """a list of results returned from solr, i.e. sol(a)r flares"""
171
+
172
+
173
+ def parseDate(value):
174
+ """use `DateTime` to parse a date, but take care of solr 1.4
175
+ stripping away leading zeros for the year representation"""
176
+ if value.find("-") < 4:
177
+ year, rest = value.split("-", 1)
178
+ value = "%04d-%s" % (int(year), rest)
179
+ return DateTime(value)
180
+
181
+
182
+ def parse_date_as_datetime(value):
183
+ if value.find("-") < 4:
184
+ year, rest = value.split("-", 1)
185
+ value = "%04d-%s" % (int(year), rest)
186
+ format = "%Y-%m-%dT%H:%M:%S"
187
+ if "." in value:
188
+ format += ".%fZ"
189
+ else:
190
+ format += "Z"
191
+ return datetime.strptime(value, format)
192
+
193
+
194
+ class SolrResponse(Lazy):
195
+ """a solr search response; TODO: this should get an interface!!"""
196
+
197
+ __allow_access_to_unprotected_subobjects__ = True
198
+
199
+ def __init__(self, data=None):
200
+ if getattr(data, "hits", None) is None and data.get("error", False):
201
+ self.actual_result_count = 0
202
+ self._data = {}
203
+ else:
204
+ self.actual_result_count = data.hits
205
+ self._data = data.docs
206
+
207
+ def results(self):
208
+ return list(map(Brain, self._data))
209
+
210
+ def __getitem__(self, index):
211
+ return self.results()[index]