django-anonymizer / README.rst

Diff from to

README.rst

  Django Anonymizer
 ===================
 
-This app aims to help you anonymize data in a database used for development.
+This app helps you anonymize data in a database used for development of a Django
+project.
 
 It is common practice in develpment to use a database that is very similar in
 content to the real data. The problem is that this can lead to having copies of
-sensitive customer data on development machines and other placers (like
-automatic backups). This Django app helps by giving an easy and customizable way
-to anonymize data in your models.
+sensitive customer data on development machines. This Django app helps by
+providing an easy and customizable way to anonymize data in your models.
 
 The basic method is to go through all the models that you specify, and generate
 fake data for all the fields specified. Introspection of the models will produce
 an anonymizer that will attempt to provide sensible fake data for each field,
 leaving you to tweak for your needs.
 
-Please note that the methods provided will not provide full anonymity. Even if
-you anonymize the names and other details of your customers, there may well be
-enough data to identify them. Relationships between records in the database are
-not altered, in order to preserve the characteristic structure of data in your
-application, but this may leave you open to information leaks which might not be
-acceptable for your data. This application **should** be good enough for simpler
-policies like 'remove all real telephone numbers from the database'.
+Please note that the methods provided may not be able to give full
+anonymity. Even if you anonymize the names and other details of your customers,
+there may well be enough data to identify them. Relationships between records in
+the database are not altered, in order to preserve the characteristic structure
+of data in your application, but this may leave you open to information leaks
+which might not be acceptable for your data. This application **should** be good
+enough for simpler policies like 'remove all real telephone numbers from the
+database'.
 
-Usage:
+Quick overview (see docs for more information, either in docs/ or on
+<http://packages.python.org/django-anonymizer>).
 
 * Install using setup.py or pip/easy_install.
 
-* Add 'anonymizer' to your ``INSTALLED_APPS`` setting. It would be advisable
-  to arrange it so that this only happens on development machines, and not
-  anywhere with access to the live database.
+* Add 'anonymizer' to your ``INSTALLED_APPS`` setting.
 
-* To create some stub files for your anonymizers, do::
+* Create some stub files for your anonymizers::
 
     ./manage.py create_anonymizers app_name1 [app_name2...]
 
   This will create a file ``anonymizers.py`` in each of the apps you specify.
   (It will not overwrite existing files).
 
-  The file will contain autogenerated classes that attempt to use appropriate
-  functions for generating fake data.
-
-* Edit the generated ``anonymizers.py`` files, adjusting as necessary, and
-  adding any filtering. You can override any of the public methods defined in
-  ``anonymizer.base.Anonymizer`` in order to do filtering and other
-  customization.
-
-  The 'attributes' dictionary is the key attribute to edit. The keys are the
-  attribute names of attributes on the model that need to be set.  The values
-  are either strings or callables. If strings, they will be interpreted as a
-  function in the module ``anonymizer.replacers``. This module can be browsed
-  to find suitable functions to use to anonymize data.
-
-  If callables are used as the keys, they should have a signature compatible
-  with the callables in ``anonymizer.replacers``. You can use ``lambda *args:
-  my_constant_value`` to return a constant.
-
-  For some fields, you will want to remove them from the list of attributes, so
-  that the values will be unchanged - especially things like denormalised
-  fields. You can also override the 'alter_object' method to do any fixing that
-  may be necessary.
-
-  An example Anonymizer for django.contrib.auth.models.User might look like
-  this::
-
-      from datetime import datetime
-
-      from anonymizer import Anonymizer
-      from django.contrib.auth.models import User
-
-      class UserAnonymizer(Anonymizer):
-
-          model = User
-
-          attributes = {
-              'username':   'username',
-              'first_name': 'first_name',
-              'last_name':  'last_name',
-              'email':      'email',
-              'date_joined': 'similar_datetime'
-              # Set to today:
-              'last_login': lambda *args: datetime.now()
-          }
-
-          def alter_object(self, obj):
-              if obj.is_superuser:
-                  return False # don't change, so we can still log in.
-              super(UserAnonymizer, self).alter_object(obj)
-              # Destroy all passwords for everyone else
-              obj.set_unusable_password()
+* Edit the generated ``anonymizers.py`` files, adjusting or deleting as
+  necessary, using the functions in module ``anonymizer.replacers`` or
+  custom functions.
 
 * If you need to create anonymizers for apps that you do not control, you may
   want to move the contents of the anonymizers.py file to an app that you **do**
   will probably want to move the contents of django/contrib/auth/anonymizers.py
   into yourprojectapp/anonymizers.py)
 
-* To run the anonymizers, do::
+* Run the anonymizers::
 
     ./manage.py anonymize_data app_name1 [app_name2...]
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.