Using python-keyring, can one dump all of the available passwords? I'm looking for an iterate_passwords() or similar, but it doesn't seem to exist.
According to this blog post, this is possible using gnomekeyring, but I can't find anything similar in python-keyring, which appears to be a much more prevalent library.
According to the python-keyring documentation, the keyring backends only specify get_, set_ and delete_ methods for single passwords. For example, see the Gnome backend.
There is an open issue on this, which states:
The current API does not provide a way to enumerate keys.
Related
I'm new to python and I'm comming from the c# world.
Over there it seemed like the repository pattern was the way to go, but I am having trouble finding any tutorials of how to best do this on Python.
edit I understand that it can be implemented, I'm just wondering if there is any reason why I am finding close to nothing for how to go about doing this.
Thanks!
I wasn't immediately familiar with the "repository pattern", so I looked it up. It appears to be the idea of putting a more general API, like a dictionary-like key/value lookup, in front of a database or other data store. It seems that the idea is to add an additional layer of abstraction that can allow multiple types of data sources (like both a relational database and a CVS file) to be accessed transparently via a common API.
Given this definition, I can think of no reason why this design pattern wouldn't be equally applicable to a problem addressed with Python vs any other programming language.
I am creating a food search. I want to simply be able to type a food into a search box and have it return results. I also want to be able to add priority to certain terms so that they show up. For example, searching for "orange" would bring up the fruit first as opposed to the juice.
I haven't been able to determine the better search solution for this scenario in django.
Let me know which is the better solution for this scenario.
I'm the current maintainer of Django-SphinxQL, an implementation for Sphinx in Django, and maintainer of the Xapian backend for Haystack.
I recommend using Haystack:
Haystack allows you to choose between different backends, support most standard features of search (e.g. highlight), and already stood the test of time on search engines for Django.
Django-SphinxQL is in pre-alpha (other implementations such has Django-Sphinx have stalled), and only support a minimal set of functionality.
The only reason I see to choose Sphinx search in detriment of Haystack (e.g. using Django-SphinxQL) is if you specifically have a use case where Sphinx is clearly superior to any Haystack backend.
For instance, Sphinx is known to be very fast indexing in the plain index, but it requires you to re-index everything when you update the database. This particular setup is very convenient for me because I'm using it to index a database that only changes once a day.
I use Sphinx and the autodocs feature to ensure we have good docs in our project.
So I'm familiar with info field lists and I'm familiar with using cross-referencing in our docs.
However, when writing docstring for a method or function I find it useful to refer to their parameters in the text. But there doesn't seem to be a structured way to do this.
We could say e.g.
Use ``name`` to set the username
but that has no structure, requires you to remember what style you used for that and if you change style you have to hunt down and kill all the incorrect styles.
:param: doesn't work outside of a info field list so you can't write
Use :param:`name` to set the username
I've seen some projects use :parm: but that isn't documented and doesn't seem to work. So they must have some customisation
I could use generic_roles but that seems like me working around a problem that I'm sure others have encountered.
So hopefully I've just missed something blindingly obvious.
You can write your own extension using autodoc-process-docstring - it's really simple.
Have the extension search for :param: and replace it with your choice of style.
Are there any example add-ons where to look at when one would like to
1) Create custom action adapters for PloneFormGen
2) Add new field types to PloneFormGen
The Plone collective has several examples:
http://svn.plone.org/svn/collective//Products.PloneFormGen has a directory 'adapters' with two example and 'fields' with one example.
Grepping through an 'svn ls' of the collective gives these results:
collective.civicrm.civicrmpfgadaptor/
collective.documentpfgadapter/
collective.pfg.creditcardfields/
collective.pfg.downloadfield/
collective.pfg.masterselect/
collective.pfg.silverpop/
collective.pfg.sslfield/
collective.pfg.verkkomaksut/
pfg.donationform/
pfg.drafts/
raptus.multilanguagepfg/
sc.pfg.brazilianfields/
uwosh.pfg.d2c/
Of those, I have seen a lot of activity recently on collective.pfg.verkkomaksut.
http://plone.org/products/salesforcepfgadapter has some examples, but probably on the more complex side.
All PFG types, adapters etc. are all based on Archetypes. Related example code can be found in PloneFormGen/content. The saveDataAdapter.py or fields.py files provide reasonable example code...
This is related to a similar question about BIND, but in this case I'm trying to see if there's any easy way to parse various zone files into a dictionary, list, or some other manageable data structure, with the final goal being committing the data to a database.
I'm using BIND 8.4.7 and Python 2.4. I may be able to convince management to use a later Python version if needed, but the BIND version is non-negotiable at the moment.
ISTM, easyzone might meet your needs. It sits on top of dnspython, which would be an alternative API.