← Back to team overview

pyneighborhood team mailing list archive

[Branch ~pyneighborhood/pyneighborhood/devel] Rev 560: Improved hidden Shares Option, fixes #669025

 

------------------------------------------------------------
revno: 560
committer: Stefan J. Betz <info@xxxxxxxxxxxxxxx>
branch nick: pyneighborhood
timestamp: Sun 2011-01-23 15:06:31 +0100
message:
  Improved hidden Shares Option, fixes #669025
modified:
  pyneighborhood/smbclient.py


--
lp:pyneighborhood
https://code.launchpad.net/~pyneighborhood/pyneighborhood/devel

Your team pyNeighborhood is subscribed to branch lp:pyneighborhood.
To unsubscribe from this branch go to https://code.launchpad.net/~pyneighborhood/pyneighborhood/devel/+edit-subscription
=== modified file 'pyneighborhood/smbclient.py'
--- pyneighborhood/smbclient.py	2010-09-17 06:04:10 +0000
+++ pyneighborhood/smbclient.py	2011-01-23 14:06:31 +0000
@@ -56,12 +56,13 @@
             sharename = match.group(1).rstrip()
             comment = match.group(2).rstrip()
             result = cursor.execute("""SELECT * FROM shares WHERE name = ? AND host = ?""", (sharename,host_id[0][0])).fetchall()
-            if len(result) == 0 and not (sharename.endswith('$') and config.get('Main','hidden_shares') == 'False'):
-                dblock.acquire()
-                cursor.execute("""INSERT INTO shares (name,host,comment,manual) VALUES (?,?,?,?);""", (sharename,host_id[0][0],comment, manual))
-                dblock.release()
-            elif len(result) == 1:
-                dblock.acquire()
-                cursor.execute("""UPDATE shares SET validated = 1 WHERE id = ?""", (result[0][0],))
-                dblock.release()
+            if not (sharename.endswith('$') and config.get('Main','hidden_shares') == 'False'):
+                if len(result) == 0:
+                    dblock.acquire()
+                    cursor.execute("""INSERT INTO shares (name,host,comment,manual) VALUES (?,?,?,?);""", (sharename,host_id[0][0],comment, manual))
+                    dblock.release()
+                elif len(result) == 1:
+                    dblock.acquire()
+                    cursor.execute("""UPDATE shares SET validated = 1 WHERE id = ?""", (result[0][0],))
+                    dblock.release()
             match = sharere.search(output, match.end())