Skip to content

Commit 003f9c1

Browse files
committedMay 27, 2019
minor fix
1 parent b4fb3d1 commit 003f9c1

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed
 

‎notebooks/api/oss_hugo/OSS_Participant.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def delete(self):
2626
self.hugo_page.delete(self.path_md_file)
2727
return self.exists() is False
2828

29-
def delete_field(self,field, auto_save=True):
29+
def delete_field(self,field, auto_save=False):
3030
if field in self.fields():
3131
del self.metadata()[field]
3232
if auto_save:

‎notebooks/users/dinis/edit-or-delete-fields.ipynb

+20-12
Original file line numberDiff line numberDiff line change
@@ -208,26 +208,34 @@
208208
},
209209
{
210210
"cell_type": "code",
211-
"execution_count": 100,
211+
"execution_count": 105,
212212
"metadata": {},
213213
"outputs": [
214214
{
215-
"ename": "SyntaxError",
216-
"evalue": "invalid syntax (<ipython-input-100-99fc69caf55e>, line 8)",
217-
"output_type": "error",
218-
"traceback": [
219-
"\u001b[0;36m File \u001b[0;32m\"<ipython-input-100-99fc69caf55e>\"\u001b[0;36m, line \u001b[0;32m8\u001b[0m\n\u001b[0;31m )\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
220-
]
215+
"data": {
216+
"text/plain": [
217+
"'removed 9 fields from 126 files'"
218+
]
219+
},
220+
"execution_count": 105,
221+
"metadata": {},
222+
"output_type": "execute_result"
221223
}
222224
],
223225
"source": [
224226
"%autoreload\n",
227+
"fields_to_delete = ['night_day','eventbrite_id','funded_who','night_room','regonline','pre-summit',\n",
228+
" 'sponsored_by','venue','villa']\n",
229+
"\n",
225230
"md_participants = hugo.md_files_participants()\n",
226-
"md_participant = md_participants[0]\n",
227-
"participant = OSS_Participant(md_participant)\n",
228-
"participant.metadata()\n",
229-
"participant.field('type','participant')\n",
230-
"participant.save()\n"
231+
"for md_participant in md_participants[0:4]:\n",
232+
" participant = OSS_Participant(md_participant)\n",
233+
" for field_to_delete in fields_to_delete:\n",
234+
" participant.delete_field(field_to_delete)\n",
235+
" participant.save() \n",
236+
" \n",
237+
"\n",
238+
"\"removed {0} fields from {1} files\".format(len(fields_to_delete), len(md_participants))\n"
231239
]
232240
},
233241
{

0 commit comments

Comments
 (0)