I'm trying to permanently edit variables within a Python script' source.
e.g.
urlpatterns = patterns('core.views',
)
to
urlpatterns = patterns('core.views',
url(r'^admin/', include(admin.site.urls)),
)
e.g.
items = [
'unicorn',
'cats',
]
to
items = [
'unicorn',
'cats',
'knights',
'panthers',
]
The problem is capturing the single variable, extending it and replacing it, source of the python file can be quite big and varied.
This has probably been done already, but cannot seem to find much around.
Any ideas, tips or suggestions?
My solution for now:
I'm just going to add code at the bottom of the script file
e.g.
urlpatterns += patterns('core.views',
url(r'^admin/', include(admin.site.urls)),
)
works for now :)
importit, extend it, and use that than it is to physically modify the source.